fix: Space in repo names
This commit is contained in:
parent
f4ba60cf8f
commit
17d56aa972
2
src/app.d.ts
vendored
2
src/app.d.ts
vendored
@ -13,6 +13,8 @@ declare namespace App {
|
|||||||
isRunning: boolean;
|
isRunning: boolean;
|
||||||
appId: string;
|
appId: string;
|
||||||
readOnly: boolean;
|
readOnly: boolean;
|
||||||
|
source: string;
|
||||||
|
settings: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,8 @@ import child from 'child_process';
|
|||||||
import util from 'util';
|
import util from 'util';
|
||||||
import { dev } from '$app/env';
|
import { dev } from '$app/env';
|
||||||
import * as Sentry from '@sentry/node';
|
import * as Sentry from '@sentry/node';
|
||||||
import { uniqueNamesGenerator, Config, adjectives, colors, animals } from 'unique-names-generator';
|
import { uniqueNamesGenerator, adjectives, colors, animals } from 'unique-names-generator';
|
||||||
|
import type { Config } from 'unique-names-generator';
|
||||||
|
|
||||||
import * as db from '$lib/database';
|
import * as db from '$lib/database';
|
||||||
import { buildLogQueue } from './queues';
|
import { buildLogQueue } from './queues';
|
||||||
@ -107,11 +108,6 @@ export function getEngine(engine) {
|
|||||||
return engine === '/var/run/docker.sock' ? 'unix:///var/run/docker.sock' : engine;
|
return engine === '/var/run/docker.sock' ? 'unix:///var/run/docker.sock' : engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export async function saveSshKey(destination) {
|
|
||||||
// return await asyncExecShell(
|
|
||||||
// `echo '${destination.sshPrivateKey}' > /tmp/id_rsa_${destination.id} && chmod 600 /tmp/id_rsa_${destination.id}`
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
export async function removeContainer(id, engine) {
|
export async function removeContainer(id, engine) {
|
||||||
const host = getEngine(engine);
|
const host = getEngine(engine);
|
||||||
try {
|
try {
|
||||||
@ -133,8 +129,9 @@ export const removeDestinationDocker = async ({ id, engine }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const createDirectories = async ({ repository, buildId }) => {
|
export const createDirectories = async ({ repository, buildId }) => {
|
||||||
const repodir = `/tmp/build-sources/${repository}/`;
|
const dashedRepository = dashify(repository);
|
||||||
const workdir = `/tmp/build-sources/${repository}/${buildId}`;
|
const repodir = `/tmp/build-sources/${dashedRepository}/`;
|
||||||
|
const workdir = `/tmp/build-sources/${dashedRepository}/${buildId}`;
|
||||||
|
|
||||||
await asyncExecShell(`mkdir -p ${workdir}`);
|
await asyncExecShell(`mkdir -p ${workdir}`);
|
||||||
|
|
||||||
@ -151,3 +148,13 @@ export function generateTimestamp() {
|
|||||||
export function getDomain(domain) {
|
export function getDomain(domain) {
|
||||||
return domain?.replace('https://', '').replace('http://', '');
|
return domain?.replace('https://', '').replace('http://', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function dashify(str: string, options?: any): string {
|
||||||
|
if (typeof str !== 'string') return str;
|
||||||
|
return str
|
||||||
|
.trim()
|
||||||
|
.replace(/\W/g, (m) => (/[À-ž]/.test(m) ? m : '-'))
|
||||||
|
.replace(/^-+|-+$/g, '')
|
||||||
|
.replace(/-{2,}/g, (m) => (options && options.condense ? '-' : m))
|
||||||
|
.toLowerCase();
|
||||||
|
}
|
||||||
|
@ -27,3 +27,13 @@ export function getDomain(domain) {
|
|||||||
export function generateRemoteEngine(destination) {
|
export function generateRemoteEngine(destination) {
|
||||||
return `ssh://${destination.user}@${destination.ipAddress}:${destination.port}`;
|
return `ssh://${destination.user}@${destination.ipAddress}:${destination.port}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function dashify(str: string, options?: any): string {
|
||||||
|
if (typeof str !== 'string') return str;
|
||||||
|
return str
|
||||||
|
.trim()
|
||||||
|
.replace(/\W/g, (m) => (/[À-ž]/.test(m) ? m : '-'))
|
||||||
|
.replace(/^-+|-+$/g, '')
|
||||||
|
.replace(/-{2,}/g, (m) => (options && options.condense ? '-' : m))
|
||||||
|
.toLowerCase();
|
||||||
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
export function dashify(str: string, options?: any): string {
|
|
||||||
if (typeof str !== 'string') return str;
|
|
||||||
return str
|
|
||||||
.trim()
|
|
||||||
.replace(/\W/g, (m) => (/[À-ž]/.test(m) ? m : '-'))
|
|
||||||
.replace(/^-+|-+$/g, '')
|
|
||||||
.replace(/-{2,}/g, (m) => (options && options.condense ? '-' : m))
|
|
||||||
.toLowerCase();
|
|
||||||
}
|
|
@ -30,8 +30,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { dev } from '$app/env';
|
import { dev } from '$app/env';
|
||||||
import { getDomain } from '$lib/components/common';
|
import { getDomain, dashify } from '$lib/components/common';
|
||||||
import { dashify } from '$lib/github';
|
|
||||||
|
|
||||||
export let source;
|
export let source;
|
||||||
export let settings;
|
export let settings;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user