Skip to content

CI: fix chart release flow, skip the exist chart version. #160

CI: fix chart release flow, skip the exist chart version.

CI: fix chart release flow, skip the exist chart version. #160

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@v4
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