From a0a9f0dd216a97fbc06df7e9c4facda6ba6dcf8c Mon Sep 17 00:00:00 2001
From: Paul Abel
Date: Wed, 24 Jan 2024 10:07:17 +0000
Subject: [PATCH 1/2] switch to using static file for version
---
.github/data/version.txt | 2 ++
.github/workflows/ci.yml | 16 +++++++++++++---
.goreleaser.yml | 2 +-
Makefile | 3 ++-
4 files changed, 18 insertions(+), 5 deletions(-)
create mode 100644 .github/data/version.txt
diff --git a/.github/data/version.txt b/.github/data/version.txt
new file mode 100644
index 0000000000..c7dab5cdea
--- /dev/null
+++ b/.github/data/version.txt
@@ -0,0 +1,2 @@
+IC_VERSION=3.5.0
+HELM_CHART_VERSION=1.2.0
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f15a979024..69588e3dd7 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -36,6 +36,7 @@ jobs:
go_code_md5: ${{ steps.vars.outputs.go_code_md5 }}
chart_version: ${{ steps.vars.outputs.chart_version }}
binary_cache_hit: ${{ steps.binary-cache.outputs.cache-hit }}
+ ic_version: ${{ steps.vars.outputs.ic_version }}
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -57,7 +58,6 @@ jobs:
| sed 's/^.\{1\}//' \
| tr -d '\n')
echo "k8s_latest=$kindest_latest" >> $GITHUB_OUTPUT
- echo "chart_version=$(yq '.version' > $GITHUB_OUTPUT
echo "go_path=$(go env GOPATH)" >> $GITHUB_OUTPUT
kindest_versions=$(curl -s "https://hub.docker.com/v2/repositories/kindest/node/tags" \
| grep -o '"name": *"[^"]*' \
@@ -72,7 +72,10 @@ jobs:
| sed 's/, $//' \
| jq -R -s -c 'split("\n")[:-1]')
echo "latest_kindest_node_versions=$kindest_versions" >> $GITHUB_OUTPUT
- echo go_code_md5=$(find . -type f \( -name "*.go" -o -name go.mod -o -name go.sum -o -name "*.tmpl" \) -not -path "./docs*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }') >> $GITHUB_OUTPUT
+ echo go_code_md5=$(find . -type f \( -name "*.go" -o -name go.mod -o -name go.sum -o -name "*.tmpl" -o -name .goreleaser.yml \) -not -path "./docs*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }') >> $GITHUB_OUTPUT
+ source .github/data/version.txt
+ echo "ic_version=${IC_VERSION}" >> $GITHUB_OUTPUT
+ echo "chart_version=${HELM_CHART_VERSION}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Fetch Cached Binary Artifacts
@@ -201,6 +204,7 @@ jobs:
AZURE_STORAGE_ACCOUNT: ${{ secrets.AZURE_STORAGE_ACCOUNT }}
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }}
AZURE_BUCKET_NAME: ${{ secrets.AZURE_BUCKET_NAME }}
+ GORELEASER_CURRENT_TAG: ${{ needs.checks.outputs.ic_version }}
if: ${{ needs.checks.outputs.binary_cache_hit != 'true' }}
- name: Store Artifacts in Cache
@@ -513,7 +517,13 @@ jobs:
- name: Package
id: package
run: |
- output=$(helm package ${{ github.ref_type != 'tag' && '--app-version edge --version 0.0.0-edge' || '' }} kic/charts/nginx-ingress)
+ helm_versions=""
+ if [ ${{ github.ref_type }} != "tag" ]; then
+ helm_versions="--app-version edge --version 0.0.0-edge"
+ else
+ helm_versions="--app-version ${{ steps.checks.outputs.ic_version }} --version ${{ steps.checks.outputs.chart_version }}"
+ fi
+ output=$(helm package ${helm_versions} kic/charts/nginx-ingress)
echo "path=$(basename -- $(echo $output | cut -d: -f2))" >> $GITHUB_OUTPUT
- name: Push to OCI registries
diff --git a/.goreleaser.yml b/.goreleaser.yml
index 8a058e2e40..994e3ce8ae 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -137,4 +137,4 @@ milestones:
- close: true
snapshot:
- name_template: 'edge'
+ name_template: '{{.Version}}'
diff --git a/Makefile b/Makefile
index 9589e65acc..0da24455f8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
# variables that should not be overridden by the user
+VER = $(shell grep IC_VERSION .github/data/version.txt | cut -d '=' -f 2)
GIT_TAG = $(shell git tag --sort=-version:refname | head -n1 || echo untagged)
-VERSION = $(GIT_TAG)-SNAPSHOT
+VERSION = $(VER)-SNAPSHOT
PLUS_ARGS = --secret id=nginx-repo.crt,src=nginx-repo.crt --secret id=nginx-repo.key,src=nginx-repo.key
# Additional flags added here can be accessed in main.go.
From ac6c17e951690d863200f8c314782d3bd2376487 Mon Sep 17 00:00:00 2001
From: Paul Abel
Date: Thu, 25 Jan 2024 11:21:59 +0000
Subject: [PATCH 2/2] monitor version.txt for binary rebuilds
---
.github/workflows/ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 69588e3dd7..95c0fc8849 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -72,7 +72,7 @@ jobs:
| sed 's/, $//' \
| jq -R -s -c 'split("\n")[:-1]')
echo "latest_kindest_node_versions=$kindest_versions" >> $GITHUB_OUTPUT
- echo go_code_md5=$(find . -type f \( -name "*.go" -o -name go.mod -o -name go.sum -o -name "*.tmpl" -o -name .goreleaser.yml \) -not -path "./docs*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }') >> $GITHUB_OUTPUT
+ echo go_code_md5=$(find . -type f \( -name "*.go" -o -name go.mod -o -name go.sum -o -name "*.tmpl" -o -name .goreleaser.yml -o -name .github/data/version.txt \) -not -path "./docs*" -exec md5sum {} + | LC_ALL=C sort | md5sum | awk '{ print $1 }') >> $GITHUB_OUTPUT
source .github/data/version.txt
echo "ic_version=${IC_VERSION}" >> $GITHUB_OUTPUT
echo "chart_version=${HELM_CHART_VERSION}" >> $GITHUB_OUTPUT