diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4562462 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM alpine:latest + +ARG VERSION="1.2.0" + +COPY entrypoint.sh /entrypoint.sh + +RUN chmod +x /entrypoint.sh && \ + apk add --no-cache --update openssl curl ca-certificates && \ + curl -L https://github.com/argoproj/argo-rollouts/releases/download/v$VERSION/kubectl-argo-rollouts-linux-amd64 -o /usr/local/bin/kubectl-argo-rollouts && \ + chmod +x /usr/local/bin/kubectl-argo-rollouts && \ + rm -rf /var/cache/apk/* + +ENTRYPOINT ["/entrypoint.sh"] +CMD ["version"] \ No newline at end of file diff --git a/README.md b/README.md index 38ffcbb..0b78729 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ To use kubectl-argo-rollouts put this step into your workflow: env: KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} with: - args: get pods + args: get rollout ``` ## Environment variables diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..fe83df3 --- /dev/null +++ b/action.yml @@ -0,0 +1,12 @@ +name: 'kubectl-argo-rollouts cli' +description: 'GitHub Action for interacting with kubectl-argo-rollouts (kubectl-argo-rollouts)' +author: 'meakawa ' +branding: + icon: 'terminal' + color: 'blue' +inputs: + KUBE_CONFIG: + description: 'Kubernetes configuration' +runs: + using: 'docker' + image: 'Dockerfile' \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..9b20edd --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +if [ ! -d "$HOME/.kube" ]; then + mkdir -p $HOME/.kube +fi + +if [ ! -f "$HOME/.kube/config" ]; then + if [ ! -z "${KUBE_CONFIG}" ]; then + echo "$KUBE_CONFIG" | base64 -d > $HOME/.kube/config + else + echo "No authorization data found. Please provide KUBE_CONFIG variables. Exiting..." + exit 1 + fi +fi + +echo "/usr/local/bin/kubectl-argo-rollouts" >> $GITHUB_PATH + +kubectl-argo-rollouts $* \ No newline at end of file