-
Notifications
You must be signed in to change notification settings - Fork 20
52 lines (46 loc) · 1.72 KB
/
validate-cilium-chart.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Validate Cilium Helm chart
on:
pull_request: {}
push:
branches:
- master
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
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}'"
if [[ -n "${chart_version}" ]]; then
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
- name: Validate Helm chart
if: ${{ steps.vars.outputs.chartPath != '' }}
run: |
./validate_helm_chart.sh ${{ steps.vars.outputs.chartPath }}