Repository navigation
116 lines (99 loc) · 4.07 KB
/
Copy pathci.yaml
File metadata and controls
116 lines (99 loc) · 4.07 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: CI
on:
pull_request:
paths:
- 'charts/**'
- '.github/workflows/ci.yaml'
- '.github/ci/**'
push:
branches:
- main
paths:
- 'charts/**'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v5
with:
version: v3.14.0
- name: Set up chart-testing
uses: helm/chart-testing-action@v2
- name: Run chart-testing (lint)
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
- name: Verify AI agent chart configuration
run: bash .github/ci/agent-test.sh
- name: Render matrix (what radar-hub accepts, refuses and wires)
run: bash charts/radar-hub/tests/render-matrix.sh
# The default nodeSelector must pin the OS but NOT the architecture --
# the official images are amd64+arm64, and an arch pin silently makes an
# unmodified install unschedulable on arm64 nodes. Also assert that an
# operator-supplied arch key merges with the default rather than
# replacing it, which is what makes pinning one component possible.
- name: Verify radar-hub architecture selectors
run: |
set -euo pipefail
for component in hub web; do
template="templates/deployment-${component}.yaml"
helm template radar-hub charts/radar-hub \
--values charts/radar-hub/ci/test-values.yaml \
--show-only "$template" > "/tmp/${component}-default.yaml"
grep -Fq "kubernetes.io/os: linux" "/tmp/${component}-default.yaml"
if grep -Fq "kubernetes.io/arch:" "/tmp/${component}-default.yaml"; then
echo "default ${component} nodeSelector unexpectedly pins an architecture"
exit 1
fi
for arch in amd64 arm64; do
helm template radar-hub charts/radar-hub \
--values charts/radar-hub/ci/test-values.yaml \
--set-json "${component}.nodeSelector={\"kubernetes.io/arch\":\"${arch}\"}" \
--show-only "$template" > "/tmp/${component}-${arch}.yaml"
grep -Fq "kubernetes.io/os: linux" "/tmp/${component}-${arch}.yaml"
grep -Fq "kubernetes.io/arch: ${arch}" "/tmp/${component}-${arch}.yaml"
done
done
install:
name: Install & Upgrade Test
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v5
with:
version: v3.14.0
- name: Set up chart-testing
uses: helm/chart-testing-action@v2
- name: Check for changed charts
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Create kind cluster
if: steps.list-changed.outputs.changed == 'true'
uses: helm/kind-action@v1
# radar-hub is BYO-Postgres (never installs a DB). Stand up a
# disposable Postgres the chart's ci/test-values.yaml DSN points at,
# so the install test exercises migrate + hub readiness for real.
- name: Deploy throwaway Postgres
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl apply -f .github/ci/postgres.yaml
kubectl -n radar-hub-ci rollout status deploy/radar-hub-postgres --timeout=120s
# --namespace pins both the old (1.0.0) and current installs into the
# namespace that holds the Postgres above, so the bare-hostname DSN
# resolves for the upgrade test's old-revision install too.
- name: Run chart-testing (install & upgrade)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --upgrade --target-branch ${{ github.event.repository.default_branch }} --namespace radar-hub-ci