Skip to content

Commit

Permalink
ci: automate image version updates
Browse files Browse the repository at this point in the history
Adds a github action to use kustomize to update the image versions to
match the pushed tag and commit it back to the repo.
ctrox committed Jun 23, 2024
1 parent b58414d commit 247cef0
Showing 4 changed files with 53 additions and 22 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/build_push.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
@@ -61,3 +61,31 @@ jobs:
push: true
tags: ${{ steps.meta_manager.outputs.tags }}
labels: ${{ steps.meta_manager.outputs.labels }}

update-manifests:
name: Update Manifests
needs: push_to_registry
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.ACTIONS_SYSTEM_USER }}

- name: Update Deployment Image Tag
working-directory: "config/production"
run: |
kustomize edit set image installer=${{ env.REGISTRY }}/${{ env.MANAGER_IMAGE_NAME }}:${{ github.ref_name }}
kustomize edit set image manager=${{ env.REGISTRY }}/${{ env.MANAGER_IMAGE_NAME }}:${{ github.ref_name }}
- name: Commit files
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "chore: update image versions"
- name: Push changes
uses: ad-m/github-push-action@master
with:
# branch: ${{ github.head_ref }}
branch: release-autoupdate-images
5 changes: 3 additions & 2 deletions .github/workflows/build_push_criu.yml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
@@ -42,6 +42,7 @@ jobs:
file: ./criu/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.REGISTRY }}/${{ env.CRIU_IMAGE_NAME }}:${{ env.CRIU_VERSION }}
tags:
${{ env.REGISTRY }}/${{ env.CRIU_IMAGE_NAME }}:${{env.CRIU_VERSION}}
labels: ${{ steps.meta_criu.outputs.labels }}
build-args: CRIU_VERSION=${{ env.CRIU_VERSION }}
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ jobs:
staticcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
@@ -21,7 +21,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
@@ -34,7 +34,7 @@ jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
@@ -68,7 +68,7 @@ jobs:
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
32 changes: 17 additions & 15 deletions config/production/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
resources:
- ../base
images:
- name: manager
newName: ghcr.io/ctrox/zeropod-manager
newTag: v0.3.1
- name: installer
newName: ghcr.io/ctrox/zeropod-installer
newTag: v0.3.1
patches:
- patch: |-
- op: add
path: /spec/template/spec/initContainers/0/args/-
value: -criu-image=ghcr.io/ctrox/zeropod-criu:v3.19
target:
kind: DaemonSet
- ../base
# uncommment to enable in-place scaling
# components:
# - ../in-place-scaling
images:
- name: installer
newName: ghcr.io/ctrox/zeropod-installer
newTag: v0.3.1
- name: manager
newName: ghcr.io/ctrox/zeropod-installer
newTag: v0.3.1
patches:
- patch: |-
- op: add
path: /spec/template/spec/initContainers/0/args/-
value: -criu-image=ghcr.io/ctrox/zeropod-criu:v3.19
target:
kind: DaemonSet
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

0 comments on commit 247cef0

Please sign in to comment.