Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into autoApprovePr
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisseah authored Apr 13, 2020
2 parents c253252 + 6d3e3ce commit 1a6421f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
9 changes: 7 additions & 2 deletions src/commands/hld/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,13 @@ export const execute = async (
await installHldToManifestPipeline(opts);
await exitFn(0);
} catch (err) {
logError(buildError(errorStatusCode.CMD_EXE_ERR, "", err));
logger.error(err);
logError(
buildError(
errorStatusCode.CMD_EXE_ERR,
"hld-install-manifest-pipeline-cmd-failed",
err
)
);
await exitFn(1);
}
};
Expand Down
38 changes: 27 additions & 11 deletions src/commands/service/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
} from "../../lib/pipelines/pipelines";
import { logger } from "../../logger";
import decorator from "./pipeline.decorator.json";
import { build as buildError } from "../../lib/errorBuilder";
import { build as buildError, log as logError } from "../../lib/errorBuilder";
import { errorStatusCode } from "../../lib/errorStatusCode";
import {
validateOrgNameThrowable,
Expand Down Expand Up @@ -139,26 +139,35 @@ export const installBuildUpdatePipeline = async (
definition
);
} catch (err) {
logger.error(err); // caller will catch it and exit
throw Error(
`Error occurred during pipeline creation for ${values.pipelineName}`
throw buildError(
errorStatusCode.CMD_EXE_ERR,
{
errorKey: "service-install-build-pipeline-cmd-pipeline-creation-err",
values: [values.pipelineName],
},
err
);
}
if (typeof builtDefinition.id === "undefined") {
const builtDefnString = JSON.stringify(builtDefinition);
throw Error(
`Invalid BuildDefinition created, parameter 'id' is missing from ${builtDefnString}`
);
throw buildError(errorStatusCode.VALIDATION_ERR, {
errorKey: "service-create-revision-cmd-err-source-branch-missing",
values: [builtDefnString],
});
}
logger.info(`Created pipeline for ${values.pipelineName}`);
logger.info(`Pipeline ID: ${builtDefinition.id}`);
try {
await queueBuild(devopsClient, values.devopsProject, builtDefinition.id);
} catch (err) {
logger.error(
`Error occurred when queueing build for ${values.pipelineName}`
throw buildError(
errorStatusCode.CMD_EXE_ERR,
{
errorKey: "service-install-build-pipeline-cmd-queue-build-err",
values: [values.pipelineName],
},
err
);
throw err; // caller will catch it and exit
}
};

Expand Down Expand Up @@ -204,7 +213,14 @@ export const execute = async (
await installBuildUpdatePipeline(pipelinesYamlPath, opts);
await exitFn(0);
} catch (err) {
logger.error(err);
logError(
buildError(
errorStatusCode.CMD_EXE_ERR,
"service-install-build-pipeline-cmd-failed",
err
)
);

await exitFn(1);
}
};
Expand Down
5 changes: 5 additions & 0 deletions src/lib/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@

"project-init-cmd-failed": "Project init was not successfully executed.",

"service-install-build-pipeline-cmd-failed": "Service install build pipeline was not successfully executed.",
"service-install-build-pipeline-cmd-pipeline-creation-err": "Error occurred when creating pipeline '{0}'. See the error details.",
"service-install-build-pipeline-cmd-id-missing-err": "Parameter 'id' was not found in '{0}'. Specify a value for 'id'.",
"service-install-build-pipeline-cmd-queue-build-err": "Error occurred queueing build for '{0}'. See error details.",

"service-create-revision-cmd-failed": "Service create revision was not successfully executed.",
"service-create-revision-cmd-err-pr-source-branch": "A pull request for a branch cannot be made against itself. Ensure your target branch(es) '{0}' do not include your source branch '{1}'",
"service-create-revision-cmd-err-default-branch-missing": "Default branch/ring was not found. Specify the default branch/ring in {0} or provide it via --target-branch",
Expand Down

0 comments on commit 1a6421f

Please sign in to comment.