Skip to content

Commit 478d30f

Browse files
anithapriyanatarajanvdemeester
authored andcommitted
chore(release-pipeline): update references to oci bucket
Signed-off-by: Anitha Natarajan <anataraj@redhat.com>
1 parent 81efec1 commit 478d30f

File tree

3 files changed

+112
-57
lines changed

3 files changed

+112
-57
lines changed

tekton/README.md

Lines changed: 59 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -131,37 +131,70 @@ release and generate the `release.yaml`
131131
[`tektoncd/catalog`](https://github.com/tektoncd/catalog) and
132132
[`publish.yaml`](publish.yaml)'s `Task`.
133133

134-
### Service account and secrets
134+
### Dogfooding Cluster connectivity and secrets
135135

136-
In order to release, these Pipelines use the `release-right-meow` service account,
137-
which uses `release-secret` and has
138-
[`Storage Admin`](https://cloud.google.com/container-registry/docs/access-control)
139-
access to
140-
[`tekton-releases`]((https://github.com/tektoncd/plumbing/blob/main/gcp.md))
141-
and
142-
[`tekton-releases-nightly`]((https://github.com/tektoncd/plumbing/blob/main/gcp.md)).
136+
1. To connect to the cloud instance and OKE cluster we need the Oracle Cloud CLI client. Install Oracle Cloud CLI from https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm
143137

144-
After creating these service accounts in GCP, the kubernetes service account and
145-
secret were created with:
138+
1. The next step is to establish connection from the local client to the cloud instance. Login to the Oracle Cloud Console and create a new `API key` from the user profile.
139+
Follow the steps here: https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#two
140+
Download a Private Key and Add a new API key as mentioned in the doc. Copy the config file to `~/.oci/config` and update the path to the private key file in config.
141+
With this the config is ready for usage by the CLI.
146142

147-
```bash
148-
KEY_FILE=release.json
149-
GENERIC_SECRET=release-secret
150-
ACCOUNT=release-right-meow
151-
152-
# Connected to the `prow` in the `tekton-releases` GCP project
153-
GCP_ACCOUNT="$ACCOUNT@tekton-releases.iam.gserviceaccount.com"
143+
1. Test the connection by doing a get of the OKE cluster id.
144+
Refer here https://docs.oracle.com/en-us/iaas/tools/oci-cli/3.70.0/oci_cli_docs/cmdref/ce.html for the CLI options.
145+
Command to create a kubeconfig in your local could be obtained from console navigating to the OKE > Actions > Access Cluster. Run the command pointing to the PUBLIC_ENDPOINT and we should be connected to the cluster.
154146

155-
# 1. Create a private key for the service account
156-
gcloud iam service-accounts keys create $KEY_FILE --iam-account $GCP_ACCOUNT
147+
1. [Setup a context to connect to the dogfooding cluster](./release-cheat-sheet.md#setup-dogfooding-context)
157148

158-
# 2. Create kubernetes secret, which we will use via a service account and directly mounting
159-
kubectl create secret generic $GENERIC_SECRET --from-file=./$KEY_FILE
160-
161-
# 3. Add the docker secret to the service account
162-
kubectl apply -f tekton/account.yaml
163-
kubectl patch serviceaccount $ACCOUNT \
164-
-p "{\"secrets\": [{\"name\": \"$GENERIC_SECRET\"}]}"
149+
1. When executing release pipelines, some tasks require `oci cli` commands. The CLI requires credentials which should be created as a Kubernetes secret and mounted to the respective task's workspace. For example refer the precheck definition.
150+
```
151+
- name: precheck
152+
runAfter: [git-clone]
153+
taskRef:
154+
resolver: git
155+
params:
156+
- name: url
157+
value: https://github.com/tektoncd/plumbing
158+
- name: revision
159+
value: 8d3152d3d39982ce1768325b373d321efaa83031
160+
- name: pathInRepo
161+
value: tekton/resources/release/base/prerelease_checks_oci.yaml
162+
params:
163+
- name: package
164+
value: $(params.package)
165+
- name: versionTag
166+
value: $(params.versionTag)
167+
- name: releaseBucket
168+
value: $(params.releaseBucket)/$(params.repoName)
169+
workspaces:
170+
- name: source-to-release
171+
workspace: workarea
172+
subPath: git
173+
- name: oci-credentials
174+
workspace: release-secret
175+
```
176+
Sample secret template for reference:
177+
```
178+
apiVersion: v1
179+
kind: Secret
180+
metadata:
181+
name: oci-credentials
182+
type: Opaque
183+
stringData:
184+
# REQUIRED: OCI API Private Key (PEM format)
185+
oci_api_key.pem: |
186+
-----BEGIN RSA PRIVATE KEY-----
187+
YOUR_ACTUAL_PRIVATE_KEY_CONTENT_HERE
188+
-----END RSA PRIVATE KEY-----
189+
190+
# REQUIRED: API Key Fingerprint
191+
fingerprint: "YOUR_API_KEY_FINGERPRINT_HERE"
192+
193+
# OPTIONAL: These can be provided as task parameters instead
194+
tenancy_ocid: "ocid1.tenancy.oc1..example_tenancy_id"
195+
user_ocid: "ocid1.user.oc1..example_user_id"
196+
region: "us-ashburn-1"
197+
namespace: "your-namespace-here" # Will be auto-detected if not provided
165198
```
166199

167200
### Setup post processing

tekton/release-cheat-sheet.md

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ the pipelines repo, a terminal window and a text editor.
5858
TEKTON_OLD_VERSION= # Example: v0.68.0
5959
TEKTON_RELEASE_NAME="Oriental Longhair Omnibot" # Name of the release
6060
TEKTON_PACKAGE=tektoncd/pipeline
61+
TEKTON_REPO_NAME=pipeline
6162
EOF
6263
. ./release.env
6364
```
@@ -89,17 +90,16 @@ the pipelines repo, a terminal window and a text editor.
8990
9091
```bash
9192
tkn --context dogfooding pipeline start pipeline-release \
92-
--serviceaccount=release-right-meow \
9393
--param package=github.com/tektoncd/pipeline \
94+
--param repoName="${TEKTON_REPO_NAME}" \
9495
--param gitRevision="${TEKTON_RELEASE_GIT_SHA}" \
9596
--param imageRegistry=ghcr.io \
9697
--param imageRegistryPath=tektoncd/pipeline \
9798
--param imageRegistryRegions="" \
9899
--param imageRegistryUser=tekton-robot \
99-
--param serviceAccountPath=release.json \
100100
--param serviceAccountImagesPath=credentials \
101101
--param versionTag="${TEKTON_VERSION}" \
102-
--param releaseBucket=gs://tekton-releases/pipeline \
102+
--param releaseBucket=tekton-releases \
103103
--param koExtraArgs="" \
104104
--workspace name=release-secret,secret=release-secret \
105105
--workspace name=release-images-secret,secret=ghcr-creds \
@@ -122,8 +122,8 @@ the pipelines repo, a terminal window and a text editor.
122122
123123
NAME VALUE
124124
∙ commit-sha ff6d7abebde12460aecd061ab0f6fd21053ba8a7
125-
∙ release-file https://storage.googleapis.com/tekton-releases-nightly/pipeline/previous/v20210223-xyzxyz/release.yaml
126-
∙ release-file-no-tag https://storage.googleapis.com/tekton-releases-nightly/pipeline/previous/v20210223-xyzxyz/release.notag.yaml
125+
∙ release-file https://infra.tekton.dev/tekton-releases/pipeline/previous/v0.13.0/release.yaml
126+
∙ release-file-no-tag https://infra.tekton.dev/tekton-releases/pipeline/previous/v0.13.0/release.notag.yaml
127127
128128
(...)
129129
```
@@ -136,29 +136,42 @@ the pipelines repo, a terminal window and a text editor.
136136
1. Find the Rekor UUID for the release
137137
138138
```bash
139-
RELEASE_FILE=https://storage.googleapis.com/tekton-releases/pipeline/previous/${TEKTON_VERSION}/release.yaml
140-
CONTROLLER_IMAGE_SHA=$(curl $RELEASE_FILE | egrep 'ghcr.io.*controller' | cut -d'@' -f2)
139+
RELEASE_FILE=https://infra.tekton.dev/tekton-releases/triggers/previous/${VERSION_TAG}/release.yaml
140+
CONTROLLER_IMAGE_SHA=$(curl -L $RELEASE_FILE | sed -n 's/"//g;s/.*ghcr\.io.*controller.*@//p;')
141141
REKOR_UUID=$(rekor-cli search --sha $CONTROLLER_IMAGE_SHA | grep -v Found | head -1)
142142
echo -e "CONTROLLER_IMAGE_SHA: ${CONTROLLER_IMAGE_SHA}\nREKOR_UUID: ${REKOR_UUID}"
143143
```
144144
145145
1. Execute the Draft Release Pipeline.
146146
147-
```bash
148-
tkn --context dogfooding pipeline start \
149-
--workspace name=shared,volumeClaimTemplateFile=workspace-template.yaml \
150-
--workspace name=credentials,secret=release-secret \
151-
-p package="tektoncd/pipeline" \
152-
-p git-revision="$TEKTON_RELEASE_GIT_SHA" \
153-
-p release-tag="${TEKTON_VERSION}" \
154-
-p previous-release-tag="${TEKTON_OLD_VERSION}" \
155-
-p release-name="${TEKTON_RELEASE_NAME}" \
156-
-p bucket="gs://tekton-releases/pipeline" \
157-
-p rekor-uuid="$REKOR_UUID" \
158-
release-draft
159-
```
160-
161-
1. Watch logs of create-draft-release
147+
Create a pod template file:
148+
149+
```shell
150+
cat <<EOF > tekton/pod-template.yaml
151+
securityContext:
152+
fsGroup: 65532
153+
runAsUser: 65532
154+
runAsNonRoot: true
155+
EOF
156+
```
157+
```shell
158+
159+
tkn pipeline start \
160+
--workspace name=shared,volumeClaimTemplateFile=workspace-template.yaml \
161+
--workspace name=credentials,secret=oci-release-secret \
162+
--pod-template pod-template.yaml \
163+
-p package="${TEKTON_PACKAGE}" \
164+
-p git-revision="$TEKTON_RELEASE_GIT_SHA" \
165+
-p release-tag="${TEKTON_VERSION}" \
166+
-p previous-release-tag="${TEKTON_OLD_VERSION}" \
167+
-p release-name="${TEKTON_RELEASE_NAME}" \
168+
-p repo-name="${TEKTON_REPO_NAME}" \
169+
-p bucket="tekton-releases" \
170+
-p rekor-uuid="$REKOR_UUID" \
171+
release-draft-oci
172+
```
173+
174+
1. Watch logs of resulting pipeline run on pipeline `release-draft-oci`
162175
163176
1. On successful completion, a URL will be logged. Visit that URL and look through the release notes.
164177
1. Manually add upgrade and deprecation notices based on the generated release notes
@@ -195,12 +208,12 @@ the pipelines repo, a terminal window and a text editor.
195208
196209
```bash
197210
# Test latest
198-
kubectl --context my-dev-cluster apply --filename https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
211+
kubectl --context my-dev-cluster apply --filename https://infra.tekton.dev/tekton-releases/pipeline/latest/release.yaml
199212
```
200213
201214
```bash
202215
# Test backport
203-
kubectl --context my-dev-cluster apply --filename https://storage.googleapis.com/tekton-releases/pipeline/previous/v0.11.2/release.yaml
216+
kubectl --context my-dev-cluster apply --filename https://infra.tekton.dev/tekton-releases/pipeline/previous/v0.11.2/release.yaml
204217
```
205218
206219
1. Announce the release in Slack channels #general, #announcements and #pipelines.
@@ -221,15 +234,22 @@ Congratulations, you're done!
221234
1. Configure `kubectl` to connect to
222235
[the dogfooding cluster](https://github.com/tektoncd/plumbing/blob/main/docs/dogfooding.md):
223236
237+
The dogfooding cluster is currently an OKE cluster in oracle cloud. we need the Oracle Cloud CLI client. Install oracle cloud cli (https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm)
238+
224239
```bash
225-
gcloud container clusters get-credentials dogfooding --zone us-central1-a --project tekton-releases
240+
oci ce cluster create-kubeconfig --cluster-id <CLUSTER-OCID> --file $HOME/.kube/config --region <CLUSTER-REGION> --token-version 2.0.0 --kube-endpoint PUBLIC_ENDPOINT
226241
```
227242
228243
1. Give [the context](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)
229244
a short memorable name such as `dogfooding`:
230245
231246
```bash
232-
kubectl config rename-context gke_tekton-releases_us-central1-a_dogfooding dogfooding
247+
kubectl config current-context
248+
```
249+
get the context name and replace with current_context_name
250+
251+
```bash
252+
kubectl config rename-context <current_context_name> dogfooding
233253
```
234254
235255
1. **Important: Switch `kubectl` back to your own cluster by default.**

tekton/release-pipeline.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,22 @@ spec:
9696
- name: url
9797
value: https://github.com/tektoncd/plumbing
9898
- name: revision
99-
value: aeed19e5a36f335ebfdc4b96fa78d1ce5bb4f7b8
99+
value: 8d3152d3d39982ce1768325b373d321efaa83031
100100
- name: pathInRepo
101-
value: tekton/resources/release/base/prerelease_checks.yaml
101+
value: tekton/resources/release/base/prerelease_checks_oci.yaml
102102
params:
103103
- name: package
104104
value: $(params.package)
105105
- name: versionTag
106106
value: $(params.versionTag)
107107
- name: releaseBucket
108-
value: $(params.releaseBucket)
108+
value: $(params.releaseBucket)/$(params.repoName)
109109
workspaces:
110110
- name: source-to-release
111111
workspace: workarea
112112
subPath: git
113+
- name: oci-credentials
114+
workspace: release-secret
113115

114116
- name: unit-tests
115117
runAfter: [precheck]
@@ -210,7 +212,7 @@ spec:
210212
resolver: bundles
211213
params:
212214
- name: bundle
213-
value: ghcr.io/tektoncd/catalog/upstream/tasks/oracle-cloud-storage-upload:0.1
215+
value: ghcr.io/tektoncd/catalog/upstream/tasks/oracle-cloud-storage-upload:0.2
214216
- name: name
215217
value: oracle-cloud-storage-upload
216218
- name: kind
@@ -243,7 +245,7 @@ spec:
243245
resolver: bundles
244246
params:
245247
- name: bundle
246-
value: ghcr.io/tektoncd/catalog/upstream/tasks/oracle-cloud-storage-upload:0.1
248+
value: ghcr.io/tektoncd/catalog/upstream/tasks/oracle-cloud-storage-upload:0.2
247249
- name: name
248250
value: oracle-cloud-storage-upload
249251
- name: kind

0 commit comments

Comments
 (0)