Skip to content

Prepare helm chart for release v1.18.11 #392

Prepare helm chart for release v1.18.11

Prepare helm chart for release v1.18.11 #392

name: Validate Cilium Helm chart
on:
pull_request: {}
push:
branches:
- master
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 6
strategy:
matrix:
chart-type:
- name: "Legacy Helm Chart"
- name: "OCI Chart (quay.io)"
registry: "oci://quay.io/cilium/charts/cilium"
name: ${{ matrix.chart-type.name }}
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10
with:
fetch-depth: 0
persist-credentials: false
- name: Set up job variables
id: vars
run: |
# Get last commit message
readonly local last_commit_log=$(git log -1 --grep "^Add cilium" \
--pretty=format:"%s")
echo "last commit log: $last_commit_log"
readonly local chart_version=$(echo "$last_commit_log" \
| grep -Eo "Add cilium v[^@]+" \
| sed 's/Add\ cilium\ v//' )
echo "Helm chart detected version: '${chart_version}'"
echo "chartVersion=${chart_version}" >> $GITHUB_OUTPUT
if [[ -n "${chart_version}" ]]; then
if [[ -n "${{ matrix.chart-type.registry }}" ]]; then
# OCI chart
echo "isOCI=true" >> $GITHUB_OUTPUT
echo "chartPath=${{ matrix.chart-type.registry }}:${chart_version}" >> $GITHUB_OUTPUT
else
# Non-OCI chart
echo "isOCI=false" >> $GITHUB_OUTPUT
if [ "${{ github.event_name }}" = "pull_request" ] ; then
# Use the local chart file for pull requests.
echo "chartPath=./cilium-${chart_version}.tgz" >> $GITHUB_OUTPUT
else
# Download the chart from the Helm repository on push.
helm repo add cilium https://helm.cilium.io
helm repo update
mkdir tmp
until helm pull cilium/cilium -d tmp --version "${chart_version}"
do
echo "helm pull failed. Retrying..."
sleep 1
helm repo update
done
echo "chartPath=./tmp/cilium-${chart_version}.tgz" >> $GITHUB_OUTPUT
fi
fi
fi
- name: Validate Helm chart
if: ${{ steps.vars.outputs.chartPath != '' }}
run: |
./validate_helm_chart.sh ${{ steps.vars.outputs.chartPath }}
- name: Install Cilium CLI
if: ${{ steps.vars.outputs.chartPath != '' }}
run: |
curl -LO https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz
curl -sSL --remote-name-all https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz{,.sha256sum}
sha256sum --check cilium-linux-amd64.tar.gz.sha256sum
sudo tar -xzvf cilium-linux-amd64.tar.gz -C /usr/local/bin
rm cilium-linux-amd64.tar.gz{,.sha256sum}
- name: Download kind-config.yaml
if: ${{ steps.vars.outputs.chartPath != '' }}
run: |
curl -LO https://raw.githubusercontent.com/cilium/cilium/main/.github/kind-config.yaml
- name: Create k8s Kind Cluster
if: ${{ steps.vars.outputs.chartPath != '' }}
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
with:
config: kind-config.yaml
- name: Install Cilium
if: ${{ steps.vars.outputs.chartPath != '' }}
run: |
helm install cilium ${{ steps.vars.outputs.chartPath }} \
--version "${{ steps.vars.outputs.chartVersion }}" \
--namespace kube-system
- name: Check Cilium Status
if: ${{ steps.vars.outputs.chartPath != '' }}
run: |
cilium status --wait --wait-duration 1m --interactive=false
- name: Post-test information gathering
if: ${{ failure() }}
run: |
cilium status
kubectl get pods --all-namespaces -o wide -v=6
cilium sysdump --output-filename cilium-sysdump-out
shell: bash {0} # Disable default fail-fast behaviour so that all commands run independently
- name: Upload artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: cilium-sysdump-out.zip
path: cilium-sysdump-out.zip
retention-days: 5