feat: pull any updates and log what we're doing

This commit is contained in:
zkldi
2022-12-09 20:46:53 +00:00
parent 33825e39fe
commit 1c7a1d2a51
+13 -1
View File
@@ -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({});