Skip to content

Commit

Permalink
fix(CI): Update image tag in helm charts
Browse files Browse the repository at this point in the history
Signed-off-by: Anurag Rajawat <[email protected]>
  • Loading branch information
Anurag Rajawat committed Sep 26, 2024
1 parent 13df8f9 commit 7f32e95
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 10 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/stable-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@

name: Stable release

on: workflow_dispatch

#on: workflow_dispatch
on:
create:
tags:
- "v*"
permissions: read-all

concurrency:
Expand All @@ -13,7 +16,7 @@ concurrency:

jobs:
release-nimbus-image:
if: github.repository == '5GSEC/nimbus'
# if: github.repository == '5GSEC/nimbus'
name: Build and push nimbus image
uses: ./.github/workflows/release-image.yaml
with:
Expand All @@ -22,7 +25,7 @@ jobs:
secrets: inherit

release-adapters-image:
if: github.repository == '5GSEC/nimbus'
# if: github.repository == '5GSEC/nimbus'
strategy:
matrix:
adapters: [ "nimbus-kubearmor", "nimbus-netpol", "nimbus-kyverno" ]
Expand All @@ -33,8 +36,33 @@ jobs:
NAME: ${{ matrix.adapters }}
secrets: inherit

update-image-tags-in-helm-charts:
#if: github.repository == '5GSEC/nimbus'
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Get tag
id: tag
run: |
if [ ${{ github.ref }} == "refs/heads/main" ]; then
echo "tag=latest" >> $GITHUB_OUTPUT
else
echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
fi
- name: Update images tag
run: |
./scripts/update-image-tag.sh ${{ steps.tag.outputs.tag }}
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5

release_helm_charts:
if: github.repository == '5GSEC/nimbus'
# if: github.repository == '5GSEC/nimbus'
permissions:
contents: write
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2023 Authors of Nimbus

# Image URL to use all building/pushing image targets
IMG ?= 5gsec/nimbus
IMG ?= ttl.sh/nimbus
# Image Tag to use all building/pushing image targets
TAG ?= latest

Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/nimbus-k8tls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2023 Authors of Nimbus

# Image URL to use all building/pushing image targets
IMG ?= 5gsec/nimbus-k8tls
IMG ?= ttl.sh/nimbus-k8tls
# Image Tag to use all building/pushing image targets
TAG ?= latest

Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/nimbus-kubearmor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2023 Authors of Nimbus

# Image URL to use all building/pushing image targets
IMG ?= 5gsec/nimbus-kubearmor
IMG ?= ttl.sh/nimbus-kubearmor
# Image Tag to use all building/pushing image targets
TAG ?= latest

Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/nimbus-kyverno/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2023 Authors of Nimbus

# Image URL to use all building/pushing image targets
IMG ?= 5gsec/nimbus-kyverno
IMG ?= ttl.sh/nimbus-kyverno
# Image Tag to use all building/pushing image targets
TAG ?= latest

Expand Down
2 changes: 1 addition & 1 deletion pkg/adapter/nimbus-netpol/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2023 Authors of Nimbus

# Image URL to use all building/pushing image targets
IMG ?= 5gsec/nimbus-netpol
IMG ?= ttl.sh/nimbus-netpol
# Image Tag to use all building/pushing image targets
TAG ?= latest

Expand Down
18 changes: 18 additions & 0 deletions scripts/update-image-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: Apache-2.0
# Copyright 2023 Authors of Nimbus

if ! command -v yq >/dev/null; then
echo "Installing yq..."
go install github.com/mikefarah/yq/v4@latest
fi

TAG=$1
DEPLOYMENT_ROOT_DIR="deployments"
DIRECTORIES=("${DEPLOYMENT_ROOT_DIR}/nimbus" "${DEPLOYMENT_ROOT_DIR}/nimbus-k8tls" \
"${DEPLOYMENT_ROOT_DIR}/nimbus-kubearmor" "${DEPLOYMENT_ROOT_DIR}/nimbus-kyverno" "${DEPLOYMENT_ROOT_DIR}/nimbus-netpol")

echo "Updating tag to $TAG"
for directory in "${DIRECTORIES[@]}"; do
yq -i ".image.tag = \"$TAG\"" "${directory}/values.yaml"
done

0 comments on commit 7f32e95

Please sign in to comment.