-
Notifications
You must be signed in to change notification settings - Fork 6
86 lines (74 loc) · 2.73 KB
/
Copy pathchart-diff.yaml
File metadata and controls
86 lines (74 loc) · 2.73 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: chart-diff
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
env:
KUBEBUILDER_VERSION: v4.11.1
GITOPS_PROMOTER_VERSION: e783f3e7c7bebf393659d5cd7b5f568d96d32efc # latest will be pinned to next release
jobs:
chart-diff:
name: Chart Diff
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Install Helm
run: |
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
# - name: Get latest gitops-promoter release tag
# id: get-release
# run: |
# LATEST_TAG=$(curl -s https://api.github.com/repos/argoproj-labs/gitops-promoter/releases/latest | jq -r '.tag_name')
# echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
# echo "Latest release: $LATEST_TAG"
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
path: current-repo
- name: Checkout gitops-promoter at latest release
uses: actions/checkout@v4
with:
repository: argoproj-labs/gitops-promoter
ref: ${{ env.GITOPS_PROMOTER_VERSION }}
path: gitops-promoter
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Install kubebuilder
run: |
curl -L -o kubebuilder "https://github.com/kubernetes-sigs/kubebuilder/releases/download/${{ env.KUBEBUILDER_VERSION }}/kubebuilder_$(go env GOOS)_$(go env GOARCH)"
chmod +x kubebuilder && sudo mv kubebuilder /usr/local/bin/
kubebuilder version
- name: Run KubeBuilder
working-directory: gitops-promoter
run: |
kubebuilder edit --plugins=helm/v2-alpha --output-dir=new_charts
ls -la new_charts/*
- name: Remove example blocks from generated CRDs
run: |
sed -i '/Example:/,/urlQueryEscape/d' gitops-promoter/new_charts/chart/templates/crd/argocdcommitstatuses.promoter.argoproj.io.yaml
- name: Diff charts
run: |
echo "=== Diff between generated manifests and current Helm chart ==="
diff -ruN --exclude='.git' --exclude='*.orig' --exclude='extra' gitops-promoter/new_charts/chart current-repo/chart > /tmp/chart-diff.diff || true
if [ -s /tmp/chart-diff.diff ]; then
echo "Differences found:"
cat -n /tmp/chart-diff.diff
exit 1
else
echo "No differences found"
fi
- name: Upload diff artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: chart-diff
path: /tmp/chart-diff.diff
if-no-files-found: ignore