From 1c7a1d2a51dcd55f80a651a5892444b33bb240db Mon Sep 17 00:00:00 2001 From: zkldi Date: Fri, 9 Dec 2022 20:46:53 +0000 Subject: [PATCH] feat: pull any updates and log what we're doing --- server/src/lib/database-seeds/repo.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/src/lib/database-seeds/repo.ts b/server/src/lib/database-seeds/repo.ts index 9cc0f95e7..9a0f635d3 100644 --- a/server/src/lib/database-seeds/repo.ts +++ b/server/src/lib/database-seeds/repo.ts @@ -42,11 +42,20 @@ export class DatabaseSeedsRepo { this.shouldDestroy = shouldDestroy; } + /** + * Pull any seeds changes in this repository. + */ + pull() { + this.logger.info(`Pulling updates.`); + return asyncExec(`git pull`); + } + /** * Switch this repository to a new branch. This operation may * fail if there are uncommitted changes. */ switchBranch(newBranch: string) { + this.logger.info(`Switching to '${newBranch}'...`); return asyncExec(`git switch '${newBranch}'`, this.baseDir); } @@ -234,7 +243,10 @@ export async function PullDatabaseSeeds( if (fetchFromLocalPath) { const local = new DatabaseSeedsRepo(fetchFromLocalPath); + // make sure we're on the right branch + // and up to date. await local.switchBranch(branch); + await local.pull(); return local; } @@ -289,7 +301,7 @@ export async function BacksyncCollectionToBothBranches( commitMessage: string ) { for (const branch of ["staging", `release/2.${VERSION_INFO.minor}`]) { - const repo = await PullDatabaseSeeds(null, branch); + const repo = await PullDatabaseSeeds(undefined, branch); let charts = await collection.find({});