Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/publish-docker-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
- name: Build
run: |-
docker build \
--tag "europe-docker.pkg.dev/unicorn-985/public-images/helm-action:${{ github.sha }}" --tag "europe-docker.pkg.dev/unicorn-985/public-images/helm-action:v3" .
--tag "europe-docker.pkg.dev/unicorn-985/public-images/helm-action:${{ github.sha }}" --tag "europe-docker.pkg.dev/unicorn-985/public-images/helm-action:v4" .

# Push the Docker image to Google Container Registry
- name: Publish
run: |-
docker push "europe-docker.pkg.dev/unicorn-985/public-images/helm-action:${{ github.sha }}"
docker push "europe-docker.pkg.dev/unicorn-985/public-images/helm-action:v3"
docker push "europe-docker.pkg.dev/unicorn-985/public-images/helm-action:v4"
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,4 @@ jobs:
run: 'docker run --rm -i -v $PWD:/workspace --workdir=/workspace --entrypoint=/workspace/tests/charts/test.sh helm'

- name: 'Test helm version'
run: 'docker run --rm -i --entrypoint=helm helm version -c'

- name: 'Test helm3 version'
run: 'docker run --rm -i --entrypoint=helm3 helm version'
run: 'docker run --rm -i --entrypoint=helm helm version'
153 changes: 0 additions & 153 deletions CHANGELOG.md

This file was deleted.

31 changes: 11 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,33 @@
FROM alpine:3.22.0
FROM alpine:3.22.2

ENV BASE_URL="https://get.helm.sh"

ENV HELM_2_FILE="helm-v2.15.2-linux-amd64.tar.gz"
ENV HELM_3_FILE="helm-v3.13.3-linux-amd64.tar.gz"
ENV HELM_3_FILE="helm-v3.19.0-linux-amd64.tar.gz"

# coreutils is needed helm3 ttl plugin
# git is needed to install a helm3 plugin
# coreutils is needed for helm ttl plugin
# git is needed to install helm plugins
# python3 needed by gcloud
RUN apk add --no-cache ca-certificates \
--repository http://dl-3.alpinelinux.org/alpine/edge/community/ \
jq curl bash nodejs python3 git coreutils && \
# 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:
# Install Helm 3
curl -L ${BASE_URL}/${HELM_3_FILE} |tar xvz && \
mv linux-amd64/helm /usr/bin/helm3 && \
chmod +x /usr/bin/helm3 && \
mv linux-amd64/helm /usr/bin/helm && \
rm -rf linux-amd64 && \
# Init version 2 helm:
helm init --client-only --stable-repo-url https://charts.helm.sh/stable && \
# Install helm3 ttl plugin for temporary pr deploys \
helm3 plugin install https://github.com/gynzy/helm-release-plugin --version 06e297a76878eec0a54c45e1877dc981b665b621
# Install helm ttl plugin for temporary pr deploys
helm plugin install https://github.com/gynzy/helm-release-plugin --version 438a761e7ec825ead9d181e81ade9a2650b7d5c4

# Install google gcloud sdk
# Install google gcloud sdk.
RUN curl -sSL https://dl.google.com/dl/cloudsdk/channels/rapid/install_google_cloud_sdk.bash | PREFIX=/opt/ bash && \
# Install new kubernetes authentication method and kubectl \
/opt/google-cloud-sdk/bin/gcloud components install gke-gcloud-auth-plugin kubectl && \
# Symlink default location to actually installed location \
mkdir -p /usr/lib/google-cloud-sdk/bin && \
/opt/google-cloud-sdk/bin/gcloud components remove bq gsutil && \
ln -s /opt/google-cloud-sdk/bin/gcloud /usr/lib/google-cloud-sdk/bin/gcloud && \
ln -s /opt/google-cloud-sdk/bin/kubectl /usr/lib/google-cloud-sdk/bin/kubectl

ENV PYTHONPATH "/usr/lib/python3.8/site-packages/"
ENV PATH $PATH:/opt/google-cloud-sdk/bin
ENV PATH=$PATH:/opt/google-cloud-sdk/bin

COPY . /usr/src/
ENTRYPOINT ["node", "/usr/src/index.js"]
66 changes: 13 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Gynzy `additions
# Gynzy additions
Fork from https://github.com/deliverybot/helm

Uses "our" helm version of helm 2.15.2

Releasing: The `v1` tag gets updated on **master merge**!
- stripped features we don't use.
- releasing: The `v4` tag gets updated on **master merge**!


# Helm Action

Deploys a helm chart using GitHub actions. Supports canary deployments and
provides a built in helm chart for apps that listen over http to get your ramped
up quickly.
Deploys a helm chart using GitHub actions. Provides a built in helm chart for
apps that listen over http to get you ramped up quickly.

View an example repository using this action at
[github.com/deliverybot/example-helm](https://github.com/deliverybot/example-helm).
Expand All @@ -24,7 +22,7 @@ payload if the action was triggered by a deployment.

#### Cluster authentication
- `clusterProject`: The project in which the GKE cluster resides (required)
- `clusterLocation`: The location(zone) in which the GKE cluster resides (required)
- `clusterLocation`: The location(zone) in which the GKE cluster resides (required)
- `clusterName`: The cluster name (required)
- `clusterSaJson`: The service account json secret to be used (required)

Expand All @@ -35,8 +33,7 @@ payload if the action was triggered by a deployment.
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.
- `track`: Track for the deployment (e.g., stable, staging).
- `task`: Task name. If the task is "remove" it will remove the configured helm
release.
- `dry-run`: Helm dry-run option.
Expand All @@ -46,21 +43,21 @@ payload if the action was triggered by a deployment.
JSON encoded array or a string.
- `secrets`: Secret variables to include in value file interpolation. Expects a
JSON encoded map.
- `helm`: Helm binary to execute, one of: [`helm`, `helm3`].
- `helm`: Helm binary to execute (defaults to `helm`, which uses Helm 3. Currently only supported version).
- `version`: Version of the app, usually commit sha works here.
- `timeout`: specify a timeout for helm deployment
- `wait`: If true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. (defaults to false)
- `timeout`: specify a timeout for helm deployment. to be used in conjunction with wait (default if omitted is 5m)
- `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.
- `ttl`: Optional ttl which can be set until the deployment will be deleted. For example `7 days`. Only works with helm3 and `release` *must* contain the string `-pr-`
- `ttl`: Optional ttl which can be set until the deployment will be deleted. For example `7 days`. The `release` *must* contain the string `-pr-`

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
action will execute a `helm delete $service`

#### Versions

- `helm`: v2.16.1
- `helm3`: v3.0.0
- `helm`: v3.19.0 (Helm 3)

### Environment

Expand Down Expand Up @@ -98,50 +95,13 @@ jobs:
name: foobar
value-files: >-
[
"values.yaml",
"values.yaml",
"values.production.yaml"
]
env:
KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}'
```

## Example canary

If a track is chosen that is equal to canary, this updates the helm chart
in a few ways:

1. Release name is changed to `{release}-{track}` (eg. myapp-canary).
2. The service is disabled on the helm chart `service.enabled=false`
3. The ingress is disabled on the helm chart `ingress.enabled=false`

Not enabling the service or ingress allows the stable ingress and service
resources to pick up the canary pods and route traffic to them.

```yaml
# .github/workflows/deploy.yml
name: Deploy
on: ['deployment']

jobs:
deployment:
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v1

- name: 'Deploy'
uses: 'deliverybot/helm@v1'
with:
release: 'nginx'
track: canary
namespace: 'default'
chart: 'app'
token: '${{ github.token }}'
values: |
name: foobar
env:
KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}'
```

## Example pr cleanup

If you are creating an environment per pull request with Helm you may have the
Expand Down
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ inputs:
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].
description: Helm binary to execute (defaults to Helm 3).
required: false
timeout:
description: specify a timeout for helm deployment. to be used in conjunction with wait (default if omitted is 5m)
required: false
wait:
description: If true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful.
required: false
token:
description: Github repository token. If included and the event is a deployment
Expand Down
9 changes: 6 additions & 3 deletions charts/app/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "app.fullname" . -}}
apiVersion: extensions/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $fullName }}
Expand Down Expand Up @@ -29,9 +29,12 @@ spec:
paths:
{{- range .paths }}
- path: {{ . }}
pathType: Prefix
backend:
serviceName: {{ $fullName }}
servicePort: http
service:
name: {{ $fullName }}
port:
name: http
{{- end }}
{{- end }}
{{- end }}
Loading