1+ name : Tekton Chains Nightly Build
2+
3+ permissions :
4+ contents : read
5+
6+ ' on ' :
7+ schedule :
8+ # Run at 03:00 UTC daily
9+ - cron : " 0 3 * * *"
10+ workflow_dispatch :
11+ inputs :
12+ kubernetes_version :
13+ description : ' Kubernetes version to test with'
14+ required : false
15+ nightly_bucket :
16+ description : ' Nightly bucket for builds'
17+ required : false
18+
19+ env :
20+ KUBERNETES_VERSION : ${{ inputs.kubernetes_version || 'v1.33.x' }}
21+ REGISTRY : ghcr.io
22+ BUCKET : ${{ inputs.nightly_bucket || 'tekton-nightly' }}
23+ IMAGE_REGISTRY_PATH : ${{ github.repository }}
24+ IMAGE_REGISTRY_USER : tekton-robot
25+ REPO_NAME : ${{ github.event.repository.name }}
26+
27+ jobs :
28+ build :
29+ name : Nightly Build
30+ runs-on : ubuntu-24.04
31+ if : github.repository_owner == 'tektoncd' # do not run this elsewhere
32+
33+ permissions :
34+ contents : read
35+ packages : write
36+ id-token : write
37+
38+ steps :
39+ # - name: Harden runner
40+ # uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
41+ # with:
42+ # egress-policy: audit
43+
44+ - name : Checkout repository
45+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
46+ with :
47+ fetch-depth : 0
48+ persist-credentials : false
49+
50+ - name : Generate version info
51+ id : version
52+ run : |
53+ latest_sha=${{ github.sha }}
54+ date_tag=$(date +v%Y%m%d-${latest_sha:0:10})
55+ echo "version_tag=${date_tag}" >> "$GITHUB_OUTPUT"
56+ echo "latest_sha=${latest_sha}" >> "$GITHUB_OUTPUT"
57+
58+ - name : Setup Tekton Nightly Infra
59+ uses : tektoncd/plumbing/.github/actions/setup-nightly-infra@c4d1d3e6b8e8ac398636f75aef0faf50784a5ca7 # main
60+ with :
61+ kubernetes_version : ${{ env.KUBERNETES_VERSION }}
62+ image_registry_user : ${{ env.IMAGE_REGISTRY_USER }}
63+ ghcr_token : ${{ secrets.GHCR_TOKEN }}
64+ oci_api_key : ${{ secrets.OCI_API_KEY }}
65+ oci_fingerprint : ${{ secrets.OCI_FINGERPRINT }}
66+ oci_tenancy_ocid : ${{ secrets.OCI_TENANCY_OCID }}
67+ oci_user_ocid : ${{ secrets.OCI_USER_OCID }}
68+ oci_region : ${{ secrets.OCI_REGION }}
69+
70+ - name : Apply Build Pipeline Definition
71+ run : |
72+ kustomize build release | kubectl apply -f -
73+
74+ - name : Start Tekton Build Pipeline
75+ env :
76+ GIT_REVISION : ${{ steps.version.outputs.latest_sha }}
77+ VERSION_TAG : ${{ steps.version.outputs.version_tag }}
78+ RELEASE_BUCKET : ${{ env.BUCKET }}
79+ IMAGE_REGISTRY : ${{ env.REGISTRY }}
80+ IMAGE_REGISTRY_PATH : ${{ env.IMAGE_REGISTRY_PATH }}
81+ IMAGE_REGISTRY_USER : ${{ env.IMAGE_REGISTRY_USER }}
82+ REPO_NAME : ${{ env.REPO_NAME }}
83+ run : |
84+ set -euo pipefail # Exit on any error, undefined variables, or pipe failures
85+
86+ echo "Starting Tekton pipeline…"
87+
88+ PIPELINE_RUN=$(tkn pipeline start chains-release \
89+ --serviceaccount=release-right-meow \
90+ --param gitRevision="${GIT_REVISION}" \
91+ --param versionTag="${VERSION_TAG}" \
92+ --param releaseBucket="${RELEASE_BUCKET}" \
93+ --param imageRegistry="${IMAGE_REGISTRY}" \
94+ --param imageRegistryPath="${IMAGE_REGISTRY_PATH}" \
95+ --param imageRegistryUser="${IMAGE_REGISTRY_USER}" \
96+ --param imageRegistryRegions="" \
97+ --param koExtraArgs="" \
98+ --param repoName="${REPO_NAME}" \
99+ --param serviceAccountImagesPath=credentials \
100+ --param releaseAsLatest="true" \
101+ --workspace name=workarea,volumeClaimTemplateFile=workspace-template.yaml \
102+ --workspace name=release-secret,secret=release-secret \
103+ --workspace name=release-images-secret,secret=ghcr-creds \
104+ --tasks-timeout 1h \
105+ --pipeline-timeout 2h \
106+ --use-param-defaults \
107+ --output name) || {
108+ echo "Failed to start Tekton pipeline!"
109+ echo "$PIPELINE_RUN"
110+ exit 1
111+ }
112+
113+ echo "Pipeline started: ${PIPELINE_RUN}"
114+ tkn pipelinerun logs "${PIPELINE_RUN}" -f
115+
116+ # Check if pipeline succeeded
117+ tkn pipelinerun describe "${PIPELINE_RUN}" --output jsonpath='{.status.conditions[?(@.type=="Succeeded")].status}' | grep -q "True" || {
118+ echo "Pipeline failed!"
119+ tkn pipelinerun describe "${PIPELINE_RUN}"
120+ exit 1
121+ }
122+
123+ echo "✅ Pipeline Run completed successfully!"
0 commit comments