Skip to content

Commit

Permalink
Merge pull request #283 from meshcloud/feature/colliehub-version-tag
Browse files Browse the repository at this point in the history
Feature/colliehub version tag
  • Loading branch information
florianow authored Mar 13, 2024
2 parents 50d186a + c170cac commit c55f39e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
5 changes: 1 addition & 4 deletions src/api/CliApiFacadeFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,13 @@ export class CliApiFacadeFactory {
public buildGit() {
const detectorRunner = this.buildQuietLoggingProcessRunner();
const detector = new GitCliDetector(detectorRunner);

const processRunner = this.buildQuietLoggingProcessRunner();

const resultHandler = new ProcessRunnerErrorResultHandler(detector);
const quietRunner = new ResultHandlerProcessRunnerDecorator(
new QuietProcessRunner(),
resultHandler,
);

return new GitCliFacade(processRunner, quietRunner);
return new GitCliFacade(detectorRunner, quietRunner);
}

public buildTerragrunt() {
Expand Down
2 changes: 2 additions & 0 deletions src/api/git/GitCliFacade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class GitCliFacade {
"--tags",
"--abbrev=0",
], { cwd: repoDir });

return result.stdout.trim();
}

Expand All @@ -35,6 +36,7 @@ export class GitCliFacade {
"git",
"tag",
], { cwd: repoDir });

return result.stdout.trim();
}

Expand Down
15 changes: 6 additions & 9 deletions src/model/CollieHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,14 @@ export class CollieHub {
await this.git.checkout(hubCacheDir, collieHubVersion);
this.config.setProperty("colliehubVersion", collieHubVersion!);
}
try {
const allTags = await this.git.getTags(hubCacheGitDir);
if (!allTags.includes(collieHubVersion)) {
throw new Error(
`version tag does not exist, possible are: ${allTags.split("\n")}`,
);
}
} catch (error) {
this.logger.error(`${error}`);
const allTags = await this.git.getTags(hubCacheGitDir);
if (!allTags.includes(collieHubVersion)) {
this.logger.error(
`version tag does not exist, possible are: ${allTags.split("\n")}`,
);
Deno.exit(1);
}

//collie-hub version is set by the if block
await this.git.checkout(hubCacheDir, collieHubVersion!);

Expand Down

0 comments on commit c55f39e

Please sign in to comment.