Skip to content

Commit

Permalink
feat: Add helm3 binary
Browse files Browse the repository at this point in the history
Add the helm beta version 3 binary into the docker container under the
name helm3. Can be selected with the helm input argument.
  • Loading branch information
colinjfw committed Sep 9, 2019
1 parent 8df38ce commit 5e2cd2f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
22 changes: 20 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
FROM alpine/helm:2.14.0
RUN apk add --no-cache jq curl bash nodejs && helm init --client-only
FROM alpine:3.10.2

ENV BASE_URL="https://get.helm.sh"
ENV HELM_2_FILE="helm-v2.14.3-linux-amd64.tar.gz"
ENV HELM_3_FILE="helm-v3.0.0-beta.3-linux-amd64.tar.gz"

RUN apk add --no-cache ca-certificates jq curl bash nodejs && \
# Install helm version 2:
curl -L ${BASE_URL}/${HELM_2_FILE} |tar xvz && \
mv linux-amd64/helm /usr/bin/helm && \
chmod +x /usr/bin/helm && \
rm -rf linux-amd64 && \
# Install helm version 3:
curl -L ${BASE_URL}/${HELM_3_FILE} |tar xvz && \
mv linux-amd64/helm /usr/bin/helm3 && \
chmod +x /usr/bin/helm3 && \
rm -rf linux-amd64 && \
# Init version 2 helm:
helm init --client-only

COPY . /usr/src/
ENTRYPOINT ["node", "/usr/src/index.js"]
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ async function run() {
const version = getInput("version");
const valueFiles = getValueFiles(getInput("value_files"));
const removeCanary = getInput("remove_canary");
const helm = getInput("helm") || "helm";

const dryRun = core.getInput("dry-run");
const secrets = getSecrets(core.getInput("secrets"));
Expand Down Expand Up @@ -204,21 +205,21 @@ async function run() {

// Remove the canary deployment before continuing.
if (removeCanary) {
core.debug(`removing canart ${appName}-canary`);
await exec.exec("helm", ["delete", `${appName}-canary`, "--purge"], {
core.debug(`removing canary ${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"], {
await exec.exec(helm, ["delete", release, "--purge"], {
...opts,
ignoreReturnCode: true
});
} else {
await exec.exec("helm", args, opts);
await exec.exec(helm, args, opts);
}

await status("success");
Expand Down

0 comments on commit 5e2cd2f

Please sign in to comment.