fix(cli): mark app store repo as git safe folder before pulling

This commit is contained in:
Nicolas Meienberger 2023-08-28 22:02:42 +02:00 committed by Nicolas Meienberger
parent 333c588293
commit 86ed9503a7
3 changed files with 16 additions and 1 deletions

View file

@ -62,10 +62,15 @@ export class AppExecutors {
*/
public installApp = async (appId: string, config: Record<string, unknown>) => {
try {
if (process.getuid && process.getgid) {
this.logger.info(`Installing app ${appId} as User ID: ${process.getuid()}, Group ID: ${process.getgid()}`);
} else {
this.logger.info(`Installing app ${appId}. No User ID or Group ID found.`);
}
const { rootFolderHost, appsRepoId } = getEnv();
const { appDirPath, repoPath, appDataDirPath } = this.getAppPaths(appId);
this.logger.info(`Installing app ${appId}`);
// Check if app exists in repo
const apps = await fs.promises.readdir(path.join(rootFolderHost, 'repos', appsRepoId, 'apps'));

View file

@ -76,6 +76,7 @@ export class RepoExecutors {
this.logger.info(`Pulling repo ${repoUrl} to ${repoPath}`);
await execAsync(`git config --global --add safe.directory ${repoPath}`);
await execAsync(`git -C ${repoPath} reset --hard`);
const { stdout, stderr } = await execAsync(`git -C ${repoPath} pull`);
if (stderr) {

View file

@ -1,3 +1,4 @@
/* eslint-disable no-await-in-loop */
import { Queue } from 'bullmq';
import fs from 'fs';
import cliProgress from 'cli-progress';
@ -117,6 +118,14 @@ export class SystemExecutors {
const apps = await fs.promises.readdir(path.join(this.rootFolder, 'apps'));
const appExecutor = new AppExecutors();
// eslint-disable-next-line no-restricted-syntax
for (const app of apps) {
spinner.setMessage(`Stopping ${app}...`);
spinner.start();
await appExecutor.stopApp(app, {}, true);
spinner.done(`${app} stopped`);
}
await Promise.all(
apps.map(async (app) => {
const appSpinner = new TerminalSpinner(`Stopping ${app}...`);