Skip to content

Commit

Permalink
feat: Add remove canary option
Browse files Browse the repository at this point in the history
Allow for removing a canary deployment when running another deploy.
  • Loading branch information
colinjfw committed Sep 8, 2019
1 parent 7f5c85a commit 5f991c6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ async function run() {
const task = getInput("task");
const version = getInput("version");
const valueFiles = getValueFiles(getInput("value_files"));
const removeCanary = getInput("remove_canary");

const dryRun = core.getInput("dry-run");
const secrets = getSecrets(core.getInput("secrets"));
Expand All @@ -160,6 +161,7 @@ async function run() {
core.debug(`param: version = "${version}"`);
core.debug(`param: secrets = "${secrets}"`);
core.debug(`param: valueFiles = "${valueFiles}"`);
core.debug(`param: removeCanary = ${removeCanary}`);

// Setup command options and arguments.
const opts = { env: {} };
Expand Down Expand Up @@ -199,6 +201,15 @@ async function run() {
deployment: context.payload.deployment,
});

// Remove the canary deployment before continuing.
if (removeCanary) {
core.debug(`removing canart ${appName}-canary`);
await exec.exec("helm", ["delete", `${appName}-canary`, "--purge"], {
...opts,
ignoreReturnCode: true
});
}

// Actually execute the deployment here.
if (task === "remove") {
await exec.exec("helm", ["delete", release, "--purge"], {
Expand Down

0 comments on commit 5f991c6

Please sign in to comment.