Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made the atomic option configurable #45

Merged
merged 1 commit into from
Jan 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ payload if the action was triggered by a deployment.
- `version`: Version of the app, usually commit sha works here.
- `timeout`: specify a timeout for helm deployment
- `repository`: specify the URL for a helm repo to come from
- `atomic`: If true, upgrade process rolls back changes made in case of failed upgrade. Defaults to true.

Additional parameters: If the action is being triggered by a deployment event
and the `task` parameter in the deployment event is set to `"remove"` then this
Expand Down
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ inputs:
values:
description: Helm chart values, expected to be a YAML or JSON string.
required: false
dry-run:
task:
description: Task name. If the task is "remove" it will remove the configured
helm release.
required: false
dry-run:
description: Simulate an upgrade.
required: false
atomic:
description: If true, upgrade process rolls back changes made in case of failed upgrade. Defaults to true.
required: false
helm:
description: Helm binary to execute, one of [helm, helm3].
required: false
Expand Down
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ async function run() {
const repository = getInput("repository");
const dryRun = core.getInput("dry-run");
const secrets = getSecrets(core.getInput("secrets"));
const atomic = getInput("atomic") || true;

core.debug(`param: track = "${track}"`);
core.debug(`param: release = "${release}"`);
Expand All @@ -185,6 +186,7 @@ async function run() {
core.debug(`param: removeCanary = ${removeCanary}`);
core.debug(`param: timeout = "${timeout}"`);
core.debug(`param: repository = "${repository}"`);
core.debug(`param: atomic = "${atomic}"`);


// Setup command options and arguments.
Expand All @@ -194,7 +196,6 @@ async function run() {
chart,
"--install",
"--wait",
"--atomic",
`--namespace=${namespace}`,
];

Expand Down Expand Up @@ -223,6 +224,11 @@ async function run() {
args.push("--set=service.enabled=false", "--set=ingress.enabled=false");
}

// If true upgrade process rolls back changes made in case of failed upgrade.
if (atomic === true) {
args.push("--atomic");
}

// Setup necessary files.
if (process.env.KUBECONFIG_FILE) {
process.env.KUBECONFIG = "./kubeconfig.yml";
Expand Down