-
Notifications
You must be signed in to change notification settings - Fork 5
116 lines (101 loc) · 4.06 KB
/
charts_test-prow.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
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: Charts Test - Prow
on:
pull_request:
branches: [main]
paths:
- "charts/prow/**"
- ".github/workflows/chart*"
jobs:
chart-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.8.1
- uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up chart-testing
uses: helm/[email protected]
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: |
# from sub `charts` dir to uplevel dir.
for d in `find . -name charts -type d | sort -r`; do
ct lint --all --debug --chart-dirs=${d#./}
done
- name: Setup Kubernetes
uses: engineerd/[email protected]
with:
# renovate: datasource=go depName=sigs.k8s.io/kind
version: v0.12.0
- name: Add test optional files for charts/prow
run: |
ns=prow && kubectl create ns $ns
# jenkins secret
kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: prow-jenkins
namespace: $ns
stringData:
jenkins-admin-user: test
jenkins-admin-password: test
EOF
# prow-github secret
cat <<EOF > prow-github.yaml
apiVersion: v1
kind: Secret
metadata:
name: prow-github
stringData:
app-id: ""
app-private-key: ""
token: ""
secret: |
client_id: fake-client-id
client_secret: fake-client-secret
redirect_url: https://prow.test.io/github-login/redirect
final_redirect_url: https://prow.test.io/pr
EOF
yq -i e '.stringData["app-id"] = "${{ secrets.PROW_APP_ID }}"' prow-github.yaml
yq -i e '.stringData["app-private-key"] = "${{ secrets.PROW_APP_CERT }}"' prow-github.yaml
yq -i e '.stringData["token"] = "${{ secrets.GITHUB_TOKEN }}"' prow-github.yaml
kubectl -n $ns apply -f prow-github.yaml && rm prow-github.yaml
# prow-webhook secret
kubectl -n $ns create secret generic prow-webhook --from-literal hmac="${{ secrets.PROW_HMAC_TOKEN }}"
# prow-oauth-cookie secret
kubectl -n $ns create secret generic prow-oauth-cookie --from-literal secret="$(openssl rand -base64 32)"
# setup configMaps
orgName=${{ github.event.repository.owner.login }}
sed -iE "s/exampleOrg/${orgName}/g" .github/workflows/test-data/prow/configs/config.yaml
sed -iE "s/exampleOrg/${orgName}/g" .github/workflows/test-data/prow/configs/plugins.yaml
kubectl -n $ns create cm prow-config --from-file .github/workflows/test-data/prow/configs/config.yaml
kubectl -n $ns create cm prow-plugin --from-file .github/workflows/test-data/prow/configs/plugins.yaml
kubectl -n $ns create cm prow-job --from-file .github/workflows/test-data/prow/configs/job-1.yaml
kubectl -n prow get cm
kubectl -n prow get secrets
- name: Setup prow CRD
run: |
kubectl create -f https://raw.githubusercontent.com/kubernetes/test-infra/master/config/prow/cluster/prowjob-crd/prowjob_customresourcedefinition.yaml
- name: Run chart-testing (install)
run: |
ct install \
--charts charts/prow \
--chart-repos "bitnami=https://charts.bitnami.com/bitnami" \
--chart-repos "self=https://pingcap-qe.github.io/ee-ops" \
--helm-extra-set-args '-f .github/workflows/test-data/prow/ct-values.yaml' \
--namespace prow \
--debug