fix(cli): mark app store repo as git safe folder before pulling
This commit is contained in:
parent
333c588293
commit
86ed9503a7
3 changed files with 16 additions and 1 deletions
|
@ -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'));
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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}...`);
|
||||
|
|
Loading…
Add table
Reference in a new issue