diff --git a/packages/backend/src/quiz-wizard/magic.ts b/packages/backend/src/quiz-wizard/magic.ts index 04a67ae..bf52ac3 100644 --- a/packages/backend/src/quiz-wizard/magic.ts +++ b/packages/backend/src/quiz-wizard/magic.ts @@ -29,7 +29,7 @@ export class Magic { const command = `docker exec -w /home/quizzer/quiz/ -u quizzer ${container} git branch --list '${branch}'`; const { stdoutData } = await this.sshService.executeSSHCommand(command); - return stdoutData !== ''; + return stdoutData.trim() !== ''; } async getConfig(container: string, key: string): Promise { @@ -99,4 +99,12 @@ export class Magic { return stdoutData; } + + async getRecentStashPatch(container: string): Promise { + const { stdoutData } = await this.sshService.executeSSHCommand( + `docker exec -u quizzer -w /home/quizzer/quiz ${container} sh -c "git stash show -p"`, + ); + + return stdoutData; + } } diff --git a/packages/backend/src/quiz-wizard/quiz-wizard.service.ts b/packages/backend/src/quiz-wizard/quiz-wizard.service.ts index 39bfbbe..c037c15 100644 --- a/packages/backend/src/quiz-wizard/quiz-wizard.service.ts +++ b/packages/backend/src/quiz-wizard/quiz-wizard.service.ts @@ -16,6 +16,7 @@ export class QuizWizardService { 8: (containerId: string) => this.checkCondition8(containerId), 9: (containerId: string) => this.checkCondition9(containerId), 10: (containerId: string) => this.checkCondition10(containerId), + 11: (containerId: string) => this.checkCondition11(containerId), 12: (containerId: string) => this.checkCondition12(containerId), 13: (containerId: string) => this.checkCondition13(containerId), 15: (containerId: string) => this.checkCondition15(containerId), @@ -171,6 +172,34 @@ index e69de29..3b18e51 100644 return true; } + async checkCondition11(containerId: string): Promise { + if (!(await this.magic.isBranchExist(containerId, 'hotfix/fixA'))) { + return false; + } + + if ( + (await this.magic.getRecentStashPatch(containerId)) !== + `diff --git a/login.js b/login.js +index e69de29..bf5c54f 100644 +--- a/login.js ++++ b/login.js +@@ -0,0 +1 @@ ++console.log("implementing login") +` + ) { + return false; + } + + if ( + (await this.magic.getTreeHead(containerId, 'hotfix/fixA')) !== + 'bebe52f7d1c8440fb4b1af9aa70ad9523d56336b' + ) { + return false; + } + + return true; + } + async checkCondition12(containerId: string): Promise { if ( (await this.magic.getTreeHead(containerId, 'main')) !==