From e9723d3f22f1e5af276819685e89e596371de6a0 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sat, 27 Aug 2022 07:46:30 +0000 Subject: [PATCH] fix: cleanup build cache as well --- apps/api/src/lib/common.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index 0d452a320..d6e30aa03 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -1977,6 +1977,12 @@ export async function cleanupDockerStorage(dockerId, lowDiskSpace, force) { } catch (error) { //console.log(error); } + // Cleanup build caches + try { + await executeDockerCmd({ dockerId, command: `docker builder prune -a -f` }) + } catch (error) { + //console.log(error); + } } } @@ -2022,3 +2028,27 @@ export function defaultComposeConfiguration(network: string): any { } } } +export function decryptApplication(application: any) { + if (application) { + if (application?.gitSource?.githubApp?.clientSecret) { + application.gitSource.githubApp.clientSecret = decrypt(application.gitSource.githubApp.clientSecret) || null; + } + if (application?.gitSource?.githubApp?.webhookSecret) { + application.gitSource.githubApp.webhookSecret = decrypt(application.gitSource.githubApp.webhookSecret) || null; + } + if (application?.gitSource?.githubApp?.privateKey) { + application.gitSource.githubApp.privateKey = decrypt(application.gitSource.githubApp.privateKey) || null; + } + if (application?.gitSource?.gitlabApp?.appSecret) { + application.gitSource.gitlabApp.appSecret = decrypt(application.gitSource.gitlabApp.appSecret) || null; + } + if (application?.secrets.length > 0) { + application.secrets = application.secrets.map((s: any) => { + s.value = decrypt(s.value) || null + return s; + }); + } + + return application; + } +} \ No newline at end of file