Skip to content

Commit

Permalink
feat: Add additional parameters to download a chart by url (#23)
Browse files Browse the repository at this point in the history
Adds the following parameters to allow downloading a chart by url:

* chart-version
* repository
  • Loading branch information
scarby authored Feb 27, 2020
1 parent 9013bbf commit 547935f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ payload if the action was triggered by a deployment.
- `namespace`: Kubernetes namespace name. (required)
- `chart`: Helm chart path. If set to "app" this will use the built in helm
chart found in this repository. (required)
- `chart_version`: The version of the helm chart you want to deploy (distinct from app version)
- `values`: Helm chart values, expected to be a YAML or JSON string.
- `track`: Track for the deployment. If the track is not "stable" it activates
the canary workflow described below.
Expand All @@ -33,6 +34,7 @@ payload if the action was triggered by a deployment.
- `helm`: Helm binary to execute, one of: [`helm`, `helm3`].
- `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

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
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,15 @@ async function run() {
const release = releaseName(appName, track);
const namespace = getInput("namespace", required);
const chart = chartName(getInput("chart", required));
const chartVersion = getInput("chart_version");
const values = getValues(getInput("values"));
const task = getInput("task");
const version = getInput("version");
const valueFiles = getValueFiles(getInput("value_files"));
const removeCanary = getInput("remove_canary");
const helm = getInput("helm") || "helm";
const timeout = getInput("timeout");

const repository = getInput("repository");
const dryRun = core.getInput("dry-run");
const secrets = getSecrets(core.getInput("secrets"));

Expand All @@ -174,6 +175,7 @@ async function run() {
core.debug(`param: appName = "${appName}"`);
core.debug(`param: namespace = "${namespace}"`);
core.debug(`param: chart = "${chart}"`);
core.debug(`param: chart_version = "${chartVersion}"`);
core.debug(`param: values = "${values}"`);
core.debug(`param: dryRun = "${dryRun}"`);
core.debug(`param: task = "${task}"`);
Expand All @@ -182,6 +184,8 @@ async function run() {
core.debug(`param: valueFiles = "${JSON.stringify(valueFiles)}"`);
core.debug(`param: removeCanary = ${removeCanary}`);
core.debug(`param: timeout = "${timeout}"`);
core.debug(`param: repository = "${repository}"`);


// Setup command options and arguments.
const opts = { env: {
Expand All @@ -195,11 +199,15 @@ async function run() {
"--wait",
"--atomic",
`--namespace=${namespace}`,
'--home=/root/.helm/',
];

if (dryRun) args.push("--dry-run");
if (appName) args.push(`--set=app.name=${appName}`);
if (version) args.push(`--set=app.version=${version}`);
if (chartVersion) args.push(`--version=${chartVersion}`);
if (timeout) args.push(`--timeout=${timeout}`);
if (repository) args.push(`--repo=${repository}`);
valueFiles.forEach(f => args.push(`--values=${f}`));
args.push("--values=./values.yml");

Expand Down

0 comments on commit 547935f

Please sign in to comment.