Skip to content

Commit 7662fc5

Browse files
committed
.github/workflows: validate cilium OCI chart
Add logic to validate if Cilium chart is published in docker and quay registries. Signed-off-by: André Martins <andre@cilium.io>
1 parent 82c8efb commit 7662fc5

1 file changed

Lines changed: 35 additions & 14 deletions

File tree

.github/workflows/validate-cilium-chart.yaml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ jobs:
1010
validate:
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 6
13+
strategy:
14+
matrix:
15+
chart-type:
16+
- name: "Legacy Helm Chart"
17+
18+
- name: "OCI Chart (quay.io)"
19+
registry: "oci://quay.io/cilium/cilium"
20+
21+
- name: "OCI Chart (docker.io)"
22+
registry: "oci://docker.io/cilium/cilium"
23+
24+
name: ${{ matrix.chart-type.name }}
1325
steps:
1426
- name: Checkout code
1527
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
@@ -29,23 +41,32 @@ jobs:
2941
| grep -Eo "Add cilium v[^@]+" \
3042
| sed 's/Add\ cilium\ v//' )
3143
echo "Helm chart detected version: '${chart_version}'"
44+
echo "chartVersion=${chart_version}" >> $GITHUB_OUTPUT
3245
3346
if [[ -n "${chart_version}" ]]; then
34-
if [ "${{ github.event_name }}" = "pull_request" ] ; then
35-
# Use the local chart file for pull requests.
36-
echo "chartPath=cilium-${chart_version}.tgz" >> $GITHUB_OUTPUT
47+
if [[ -n "${{ matrix.chart-type.registry }}" ]]; then
48+
# OCI chart
49+
echo "isOCI=true" >> $GITHUB_OUTPUT
50+
echo "chartPath=${{ matrix.chart-type.registry }}:${chart_version}" >> $GITHUB_OUTPUT
3751
else
38-
# Download the chart from the Helm repository on push.
39-
helm repo add cilium https://helm.cilium.io
40-
helm repo update
41-
mkdir tmp
42-
until helm pull cilium/cilium -d tmp --version "${chart_version}"
43-
do
44-
echo "helm pull failed. Retrying..."
45-
sleep 1
52+
# Non-OCI chart
53+
echo "isOCI=false" >> $GITHUB_OUTPUT
54+
if [ "${{ github.event_name }}" = "pull_request" ] ; then
55+
# Use the local chart file for pull requests.
56+
echo "chartPath=./cilium-${chart_version}.tgz" >> $GITHUB_OUTPUT
57+
else
58+
# Download the chart from the Helm repository on push.
59+
helm repo add cilium https://helm.cilium.io
4660
helm repo update
47-
done
48-
echo "chartPath=tmp/cilium-${chart_version}.tgz" >> $GITHUB_OUTPUT
61+
mkdir tmp
62+
until helm pull cilium/cilium -d tmp --version "${chart_version}"
63+
do
64+
echo "helm pull failed. Retrying..."
65+
sleep 1
66+
helm repo update
67+
done
68+
echo "chartPath=./tmp/cilium-${chart_version}.tgz" >> $GITHUB_OUTPUT
69+
fi
4970
fi
5071
fi
5172
@@ -77,7 +98,7 @@ jobs:
7798
- name: Install Cilium
7899
if: ${{ steps.vars.outputs.chartPath != '' }}
79100
run: |
80-
helm install cilium ./${{ steps.vars.outputs.chartPath }} \
101+
helm install cilium ${{ steps.vars.outputs.chartPath }} \
81102
--version "${{ steps.vars.outputs.chartVersion }}" \
82103
--namespace kube-system
83104

0 commit comments

Comments
 (0)