Skip to content

Commit c89de24

Browse files
feat: upload release manifests to oracle cloud
1 parent 9972d62 commit c89de24

File tree

2 files changed

+81
-48
lines changed

2 files changed

+81
-48
lines changed

.github/workflows/nightly-builds.yaml

Lines changed: 43 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Tekton Nightly Build
22

3-
on:
3+
"on":
44
schedule:
55
# Run at 03:00 UTC daily
66
- cron: "0 3 * * *"
@@ -11,16 +11,17 @@ on:
1111
required: false
1212
default: 'v1.33.x'
1313
nightly_bucket:
14-
description: 'Nightly bucket for builds'
14+
description: 'Oracle Cloud bucket name for builds'
1515
required: false
16-
default: 'gs://tekton-releases-nightly/pipeline'
16+
default: 'tekton-releases-nightly'
1717
type: string
1818

1919
env:
2020
KUBERNETES_VERSION: ${{ inputs.kubernetes_version || 'v1.33.x' }}
2121
REGISTRY: ghcr.io
2222
PACKAGE: github.com/${{ github.repository }}
23-
BUCKET: ${{ inputs.nightly_bucket || 'gs://tekton-releases-nightly/pipeline' }}
23+
BUCKET: ${{ inputs.nightly_bucket || 'tekton-releases-nightly' }}
24+
REPO_NAME: ${{ github.event.repository.name }}
2425
IMAGE_REGISTRY_PATH: ${{ github.repository }}
2526
IMAGE_REGISTRY_USER: tekton-robot
2627

@@ -37,7 +38,7 @@ jobs:
3738

3839
steps:
3940
- name: Checkout repository
40-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
41+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4142
with:
4243
fetch-depth: 0
4344

@@ -50,12 +51,12 @@ jobs:
5051
echo "latest_sha=${latest_sha}" >> "$GITHUB_OUTPUT"
5152
5253
- name: Set up Kind cluster
53-
uses: chainguard-dev/actions/setup-kind@1b32103f5aa389c31ab0be75a8edc38d7e4750d8 # v1.5.7
54+
uses: chainguard-dev/actions/setup-kind@1b32103f5aa389c31ab0be75a8edc38d7e4750d8 # v1.5.7
5455
with:
5556
k8s-version: ${{ env.KUBERNETES_VERSION }}
5657

5758
- name: Set up Tekton
58-
uses: tektoncd/actions/setup-tektoncd@0986bcdfbaf4f83a8a7b19bc2fa360c44ee55929 # main
59+
uses: tektoncd/actions/setup-tektoncd@0986bcdfbaf4f83a8a7b19bc2fa360c44ee55929 # main
5960
with:
6061
pipeline_version: latest
6162
setup_registry: "true"
@@ -65,27 +66,27 @@ jobs:
6566
env:
6667
GITHUB_TOKEN: ${{ secrets.GHCR_TOKEN || github.token }}
6768
run: |
68-
# Create Git authentication secret with proper Tekton annotations
69+
# Create Git authentication secret as basic-auth type for Git resolver
6970
kubectl create secret generic git-resolver-secret \
70-
--from-literal=token="${GITHUB_TOKEN}" \
71+
--type=kubernetes.io/basic-auth \
72+
--from-literal=username=git \
73+
--from-literal=password="${GITHUB_TOKEN}" \
7174
-n tekton-pipelines-resolvers || true
7275
7376
kubectl annotate secret git-resolver-secret \
7477
tekton.dev/git-0=github.com \
75-
-n tekton-pipelines-resolvers || true
76-
77-
kubectl create secret generic git-resolver-secret \
78-
--from-literal=token="${GITHUB_TOKEN}" \
79-
-n default || true
80-
81-
kubectl annotate secret git-resolver-secret \
82-
tekton.dev/git-0=github.com \
83-
-n default || true
78+
-n tekton-pipelines-resolvers --overwrite || true
8479
85-
kubectl patch configmap git-resolver-config -n tekton-pipelines-resolvers --patch='
80+
# Configure Git resolver to use the secret
81+
kubectl patch configmap git-resolver-config -n tekton-pipelines-resolvers --type=merge --patch='
8682
data:
87-
api-token-secret-name: "git-resolver-secret"
88-
api-token-secret-key: "token"
83+
default-url: "https://github.com"
84+
fetch-timeout: "1m"
85+
scm-type: "github"
86+
server-url: "https://api.github.com"
87+
api-secret-name: "git-resolver-secret"
88+
api-secret-key: "password"
89+
api-secret-namespace: "tekton-pipelines-resolvers"
8990
' || true
9091
9192
kubectl patch configmap feature-flags -n tekton-pipelines --patch='
@@ -94,7 +95,7 @@ jobs:
9495
' || true
9596
9697
- name: Install tkn CLI
97-
uses: tektoncd/actions/setup-tektoncd-cli@0986bcdfbaf4f83a8a7b19bc2fa360c44ee55929 # main
98+
uses: tektoncd/actions/setup-tektoncd-cli@0986bcdfbaf4f83a8a7b19bc2fa360c44ee55929 # main
9899
with:
99100
version: latest
100101

@@ -104,15 +105,29 @@ jobs:
104105
105106
- name: Create secrets, service account and PVC template
106107
env:
107-
GCS_SERVICE_ACCOUNT_KEY: ${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}
108+
OCI_API_KEY: ${{ secrets.OCI_API_KEY }}
109+
OCI_FINGERPRINT: ${{ secrets.OCI_FINGERPRINT }}
110+
OCI_TENANCY_OCID: ${{ secrets.OCI_TENANCY_OCID }}
111+
OCI_USER_OCID: ${{ secrets.OCI_USER_OCID }}
112+
OCI_REGION: ${{ secrets.OCI_REGION }}
108113
GHCR_TOKEN: ${{ secrets.GHCR_TOKEN || github.token }}
109114
IMAGE_REGISTRY_USER: ${{ env.IMAGE_REGISTRY_USER }}
110115
run: |
111-
# Create GCS service account secret for release bucket access
112-
echo "${GCS_SERVICE_ACCOUNT_KEY}" > /tmp/gcs-key.json
116+
# Create Oracle Cloud credentials secret for release bucket access
117+
echo "${OCI_API_KEY}" > /tmp/oci_api_key.pem
118+
echo "${OCI_FINGERPRINT}" > /tmp/fingerprint
119+
echo "${OCI_TENANCY_OCID}" > /tmp/tenancy_ocid
120+
echo "${OCI_USER_OCID}" > /tmp/user_ocid
121+
echo "${OCI_REGION}" > /tmp/region
122+
113123
kubectl create secret generic release-secret \
114-
--from-file=release.json=/tmp/gcs-key.json
115-
rm -f /tmp/gcs-key.json
124+
--from-file=oci_api_key.pem=/tmp/oci_api_key.pem \
125+
--from-file=fingerprint=/tmp/fingerprint \
126+
--from-file=tenancy_ocid=/tmp/tenancy_ocid \
127+
--from-file=user_ocid=/tmp/user_ocid \
128+
--from-file=region=/tmp/region
129+
130+
rm -f /tmp/oci_api_key.pem /tmp/fingerprint /tmp/tenancy_ocid /tmp/user_ocid /tmp/region
116131
117132
# Create a Kubernetes secret for GHCR authentication.
118133
# This version creates the secret with a custom key name `docker-config.json`
@@ -143,6 +158,7 @@ jobs:
143158
PIPELINE_RUN=$(tkn pipeline start pipeline-release \
144159
--serviceaccount=release-right-meow \
145160
--param package="${{ env.PACKAGE }}" \
161+
--param repoName="${{ env.REPO_NAME }}" \
146162
--param gitRevision="${{ steps.version.outputs.latest_sha }}" \
147163
--param versionTag="${{ steps.version.outputs.version_tag }}" \
148164
--param releaseBucket="${{ env.BUCKET }}" \
@@ -153,7 +169,6 @@ jobs:
153169
--param buildPlatforms="linux/amd64,linux/arm64,linux/s390x,linux/ppc64le" \
154170
--param publishPlatforms="linux/amd64,linux/arm64,linux/s390x,linux/ppc64le,windows/amd64" \
155171
--param koExtraArgs="" \
156-
--param serviceAccountPath=release.json \
157172
--param serviceAccountImagesPath=docker-config.json \
158173
--param releaseAsLatest="true" \
159174
--param runTests="false" \

tekton/release-pipeline.yaml

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ spec:
88
- name: package
99
description: package to release
1010
default: github.com/tektoncd/pipeline
11+
- name: repoName
12+
description: repository name (e.g., pipeline, triggers, etc.)
13+
default: pipeline
1114
- name: gitRevision
1215
description: the git revision to release
1316
- name: imageRegistry
@@ -26,7 +29,7 @@ spec:
2629
description: Version tag (vX.Y.Z for stable, vYYYYMMDD-abc1234 for nightly)
2730
- name: releaseBucket
2831
description: bucket where the release is stored. The bucket must be project specific.
29-
default: "gs://tekton-releases-nightly/pipeline" # Will be overridden based on releaseMode
32+
default: "tekton-releases-nightly" # Will be overridden based on releaseMode
3033
- name: releaseAsLatest
3134
description: Whether to tag and publish this release as latest
3235
default: "false" # Will be overridden based on releaseMode
@@ -42,8 +45,6 @@ spec:
4245
- name: koExtraArgs
4346
description: Extra args to be passed to ko
4447
default: "--preserve-import-paths"
45-
- name: serviceAccountPath
46-
description: The path to the service account file within the release-secret workspace
4748
- name: serviceAccountImagesPath
4849
description: The path to the service account file or credentials within the release-images-secret workspace
4950
- name: runTests
@@ -53,7 +54,7 @@ spec:
5354
- name: workarea
5455
description: The workspace where the repo will be cloned.
5556
- name: release-secret
56-
description: The secret that contains a service account authorized to push to the output bucket
57+
description: The secret that contains auth credentials to push to the output bucket
5758
- name: release-images-secret
5859
description: The secret that contains a service account authorized to push to the imageRegistry
5960
results:
@@ -202,15 +203,16 @@ spec:
202203
- name: release-secret
203204
workspace: release-images-secret
204205
timeout: 3h
206+
205207
- name: publish-to-bucket
206208
runAfter: [publish-images]
207209
taskRef:
208210
resolver: bundles
209211
params:
210212
- name: bundle
211-
value: ghcr.io/tektoncd/catalog/upstream/tasks/gcs-upload:0.3
213+
value: ghcr.io/tektoncd/catalog/upstream/tasks/oracle-cloud-storage-upload:0.1
212214
- name: name
213-
value: gcs-upload
215+
value: oracle-cloud-storage-upload
214216
- name: kind
215217
value: task
216218
workspaces:
@@ -220,12 +222,17 @@ spec:
220222
workspace: workarea
221223
subPath: bucket
222224
params:
223-
- name: location
224-
value: $(params.releaseBucket)/previous/$(params.versionTag)
225225
- name: path
226226
value: $(params.versionTag)
227-
- name: serviceAccountPath
228-
value: $(params.serviceAccountPath)
227+
- name: bucketName
228+
value: $(params.releaseBucket)
229+
- name: objectPrefix
230+
value: $(params.repoName)/previous/$(params.versionTag)/
231+
- name: replaceExistingFiles
232+
value: "true"
233+
- name: recursive
234+
value: "true"
235+
229236
- name: publish-to-bucket-latest
230237
runAfter: [publish-images]
231238
when:
@@ -236,9 +243,9 @@ spec:
236243
resolver: bundles
237244
params:
238245
- name: bundle
239-
value: ghcr.io/tektoncd/catalog/upstream/tasks/gcs-upload:0.3
246+
value: ghcr.io/tektoncd/catalog/upstream/tasks/oracle-cloud-storage-upload:0.1
240247
- name: name
241-
value: gcs-upload
248+
value: oracle-cloud-storage-upload
242249
- name: kind
243250
value: task
244251
workspaces:
@@ -248,25 +255,33 @@ spec:
248255
workspace: workarea
249256
subPath: bucket
250257
params:
251-
- name: location
252-
value: $(params.releaseBucket)/latest
253258
- name: path
254259
value: $(params.versionTag)
255-
- name: serviceAccountPath
256-
value: $(params.serviceAccountPath)
260+
- name: bucketName
261+
value: $(params.releaseBucket)
262+
- name: objectPrefix
263+
value: $(params.repoName)/latest/
264+
- name: replaceExistingFiles
265+
value: "true"
266+
- name: recursive
267+
value: "true"
257268
- name: deleteExtraFiles
258-
value: "true" # Uses rsync to copy content into latest
269+
value: "true" # Uses sync to copy content into latest
270+
259271
- name: report-bucket
260272
runAfter: [publish-to-bucket]
261273
params:
262274
- name: releaseBucket
263275
value: $(params.releaseBucket)
264276
- name: versionTag
265277
value: $(params.versionTag)
278+
- name: repoName
279+
value: $(params.repoName)
266280
taskSpec:
267281
params:
268282
- name: releaseBucket
269283
- name: versionTag
284+
- name: repoName
270285
results:
271286
- name: release
272287
description: The full URL of the release file in the bucket
@@ -280,9 +295,12 @@ spec:
280295
value: $(params.releaseBucket)
281296
- name: VERSION_TAG
282297
value: $(params.versionTag)
298+
- name: REPO_NAME
299+
value: $(params.repoName)
283300
script: |
284-
BASE_URL=$(echo "${RELEASE_BUCKET}/previous/${VERSION_TAG}")
285-
# If the bucket is in the gs:// return the corresponding public https URL
286-
BASE_URL=$(echo ${BASE_URL} | sed 's,gs://,https://storage.googleapis.com/,g')
301+
# Oracle Cloud Storage: Construct public URL
302+
# Format: https://infra.tekton.dev/tekton-releases-nightly/<repoName>/previous/<versionTag>
303+
BASE_URL="https://infra.tekton.dev/tekton-releases-nightly/${REPO_NAME}/previous/${VERSION_TAG}"
304+
287305
echo "${BASE_URL}/release.yaml" > $(results.release.path)
288306
echo "${BASE_URL}/release.notag.yaml" > $(results.release-no-tag.path)

0 commit comments

Comments
 (0)