Skip to content

Commit

Permalink
feat: allow different target builds (#3)
Browse files Browse the repository at this point in the history
* feat: allow different target archs

* feat: input for tracing verbosity

* feat: optional docker image

* fix: don't require new inputs

* fix: closes issue #1
  • Loading branch information
seslly authored Mar 15, 2024
1 parent c2bfc55 commit 9e4d259
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
FROM alpine:3.13

ARG KUBECTL_VERSION="1.21.2"
ARG TARGETARCH

RUN apk add py-pip curl wget ca-certificates git bash jq gcc alpine-sdk
RUN pip install 'awscli==1.22.26'
RUN curl -L -o /usr/bin/kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/kubectl
RUN set -x echo ${TARGETARCH}
RUN curl -L -o /usr/bin/kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/${TARGETARCH}/kubectl
RUN chmod +x /usr/bin/kubectl

RUN curl -o /usr/bin/aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/amd64/aws-iam-authenticator
RUN curl -o /usr/bin/aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.21.2/2021-07-05/bin/linux/${TARGETARCH}/aws-iam-authenticator
RUN chmod +x /usr/bin/aws-iam-authenticator

RUN wget https://get.helm.sh/helm-v3.8.0-linux-amd64.tar.gz -O - | tar -xzO linux-amd64/helm > /usr/local/bin/helm
RUN wget https://get.helm.sh/helm-v3.8.0-linux-${TARGETARCH}.tar.gz -O - | tar -xzO linux-${TARGETARCH}/helm > /usr/local/bin/helm
RUN chmod +x /usr/local/bin/helm

RUN wget "https://github.com/weaveworks/eksctl/releases/download/v0.147.0/eksctl_$(uname -s)_amd64.tar.gz" -O - | tar -xz -C /usr/local/bin
RUN wget "https://github.com/weaveworks/eksctl/releases/download/v0.147.0/eksctl_$(uname -s)_${TARGETARCH}.tar.gz" -O - | tar -xz -C /usr/local/bin

COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]:
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
aws-region: us-east-1

- name: helm deploy
uses: tensor-hq/eksctl-helm-action@master
uses: tensor-hq/eksctl-helm-action@main
with:
eks_cluster: my-prod-cluster
plugins: "https://github.com/jkroepke/helm-secrets" # optional
Expand Down
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ inputs:
eks_cluster:
description: "Name of your EKS cluster (i.e., from `eksctl get cluster`)"
required: true
image:
description: "Optionally use a pre-built image to save build time"
required: false
default: "Dockerfile"
verbose:
description: "Enables shell command tracing. Takes string input 'true' or 'false'. Defaults to false."
required: false
default: "false"
outputs:
result:
description: "Output returned by your Helm or kubectl command"
runs:
using: "docker"
image: "Dockerfile"
image: ${{ input.image }}
args:
- ${{ inputs.command }}
8 changes: 6 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/sh

set -xe
set -e

if [[ "${INPUT_VERBOSE}" == "true" ]]; then
set -x
fi

export KUBECONFIG="${PWD}/kubeconfig"
eksctl utils write-kubeconfig --cluster $INPUT_EKS_CLUSTER --kubeconfig $KUBECONFIG
Expand All @@ -19,6 +23,6 @@ fi

echo "running entrypoint command(s)"

response=$(sh -xc "$INPUT_COMMAND")
response=$(sh -c "$INPUT_COMMAND")

echo "::set-output name=response::$response"

0 comments on commit 9e4d259

Please sign in to comment.