Skip to content

Commit

Permalink
use a 'latest' tag for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
djeebus committed Mar 22, 2024
1 parent 946b84b commit e4ef592
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .github/actions/build-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
image_tag:
description: The image tag
required: true
tag_latest:
description: Tag latest as well as the provided tag
default: "false"
token:
description: Github token
required: true
Expand Down Expand Up @@ -40,6 +43,7 @@ runs:
run: >-
./earthly
--push
+build
+docker-multiarch
${{ inputs.tag_latest != 'false' && format('--LATEST_IMAGE_NAME=ghcr.io/{0}:latest', github.repository) || '' }}
--GIT_TAG=${{ inputs.image_tag }}
--IMAGE_NAME=ghcr.io/${{ github.repository }}:${{ inputs.image_tag }}
1 change: 1 addition & 0 deletions .github/workflows/on_release_published.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ jobs:
- uses: ./.github/actions/build-image
with:
image_tag: ${{ github.ref_name }}
tag_latest: true
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
earthly 0.7.23
earthly 0.8.6
golang 1.21.6
golangci-lint 1.56.1
helm 3.12.2
Expand Down
5 changes: 3 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ci-helm:
BUILD +test-helm
BUILD +release-helm

build:
docker-multiarch:
BUILD --platform=linux/amd64 --platform=linux/arm64 +docker

release:
Expand Down Expand Up @@ -129,7 +129,8 @@ docker:

CMD ["./kubechecks", "controller"]
ARG --required IMAGE_NAME
SAVE IMAGE --push $IMAGE_NAME
ARG LATEST_IMAGE_NAME=""
SAVE IMAGE --push $IMAGE_NAME $LATEST_IMAGE_NAME

dlv:
ARG --required GOLANG_VERSION
Expand Down
4 changes: 2 additions & 2 deletions charts/kubechecks/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
name: kubechecks
description: A Helm chart for kubechecks
version: 0.4.3
appVersion: "1.3.3"
version: 0.4.4
appVersion: latest
type: application
maintainers:
- name: zapier
2 changes: 1 addition & 1 deletion charts/kubechecks/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
containers:
- name: {{ .Chart.Name }}
{{- with .Values.deployment.image }}
image: "{{ .name }}:{{ coalesce .tag (printf "v%s" $.Chart.AppVersion) }}"
image: "{{ .name }}:{{ coalesce .tag $.Chart.AppVersion }}"
imagePullPolicy: {{ .pullPolicy }}
{{- end }}
{{- with .Values.deployment.args }}
Expand Down
14 changes: 12 additions & 2 deletions charts/kubechecks/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,18 @@ templates: [deployment.yaml]
values: [basics.min-values.yaml]

tests:
- it: defaults to latest image tag
asserts:
- equal:
path: metadata.labels["app.kubernetes.io/version"]
value: latest
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/zapier/kubechecks:latest

- it: should render
chart:
appVersion: 1.0.0
appVersion: v1.0.0
version: 0.1.0
release:
name: kubechecks
Expand All @@ -23,8 +32,9 @@ tests:
app.kubernetes.io/instance: kubechecks
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: kubechecks
app.kubernetes.io/version: 1.0.0
app.kubernetes.io/version: v1.0.0
helm.sh/chart: kubechecks-0.1.0

- it: should allow arbitrary annotations
set:
deployment:
Expand Down

0 comments on commit e4ef592

Please sign in to comment.