Skip to content

Commit 9879ecf

Browse files
anithapriyanatarajantekton-robot
authored andcommitted
fix-release-specific-review-comments
Signed-off-by: Anitha Natarajan <anataraj@redhat.com>
1 parent 1eaf944 commit 9879ecf

File tree

6 files changed

+219
-8
lines changed

6 files changed

+219
-8
lines changed

.github/workflows/nightly-builds.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ jobs:
133133
rm -f /tmp/docker-config.json
134134
135135
# Apply service account configuration with proper RBAC
136+
# NOTE: Adding this to kustomize might impact main release pipeline. so better to keep this step separate for nightly builds
136137
kubectl apply -f tekton/account.yaml
137138
138139
cat > workspace-template.yaml << EOF
@@ -150,7 +151,7 @@ jobs:
150151
151152
echo "Starting Tekton pipeline..."
152153
153-
PIPELINE_RUN=$(tkn pipeline start pipeline-release \
154+
PIPELINE_RUN=$(tkn pipeline start pruner-release \
154155
--serviceaccount=release-right-meow \
155156
--param package="${{ env.PACKAGE }}" \
156157
--param repoName="${{ env.REPO_NAME }}" \

tekton/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Tekton Repo CI/CD
2+
3+
_Why does Tekton pruner have a folder called `tekton`? Cuz we think it would
4+
be cool if the `tekton` folder were the place to look for CI/CD logic similar to other tektoncd org
5+
repos!_
6+
7+
We use Tekton Pipelines to build, test and release Tekton Pruner!
8+
9+
This directory contains the
10+
[`Tasks`](https://github.com/tektoncd/pipeline/blob/master/docs/tasks.md) and
11+
[`Pipelines`](https://github.com/tektoncd/pipeline/blob/master/docs/pipelines.md)
12+
that we use.
13+
14+
The Pipelines and Tasks in this folder are used for:
15+
16+
1. [Manually creating official releases from the official cluster](#create-an-official-release)
17+
18+
To start from scratch and use these Pipelines and Tasks:
19+
20+
1. [Install Tekton](https://github.com/tektoncd/pipeline/blob/master/tekton/README.md#install-tekton)
21+
1. [Setup the Tasks and Pipelines](https://github.com/tektoncd/pipeline/blob/master/tekton/README.md#install-tasks-and-pipelines)
22+
1. [Create the required service account + secrets](https://github.com/tektoncd/pipeline/blob/master/tekton/README.md#service-account-and-secrets)
23+
24+
## Create an official release
25+
26+
To create an official release, follows the steps in the [release-cheat-sheet](./release-cheat-sheet.md)

tekton/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
resources:
4-
- account.yaml
54
- publish.yaml
65
- release-pipeline.yaml

tekton/publish.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
apiVersion: tekton.dev/v1
22
kind: Task
33
metadata:
4-
name: publish-release
4+
name: publish-pruner-release
55
annotations:
66
chains.tekton.dev/transparency-upload: "true"
77
spec:
88
params:
99
- name: package
1010
description: package to release (e.g. github.com/<org>/<project>)
11-
default: github.com/tektoncd/pipeline
11+
default: github.com/tektoncd/pruner
1212
- name: images
1313
description: List of cmd/* paths to be published as images
1414
default: "controller webhook"
@@ -29,7 +29,7 @@ spec:
2929
description: Username to be used to login to the container registry
3030
default: "_json_key"
3131
- name: releaseAsLatest
32-
description: Whether to tag and publish this release as Pipelines latest
32+
description: Whether to tag and publish this release as Pruner latest
3333
default: "true"
3434
- name: platforms
3535
description: Platforms to publish for the images (e.g. linux/amd64,linux/arm64)
@@ -43,7 +43,7 @@ spec:
4343
be /go/src/$(params.package) however that is not possible today,
4444
see https://github.com/tektoncd/pipeline/issues/3786. To use this
4545
task on a fork of pipeline change the mountPath below
46-
mountPath: /go/src/github.com/tektoncd/pipeline
46+
mountPath: /go/src/github.com/tektoncd/pruner
4747
- name: release-secret
4848
description: The secret that contains a service account authorized to push to the imageRegistry and to the output bucket
4949
- name: output

tekton/release-cheat-sheet.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# Tekton Pruner Official Release Cheat Sheet
2+
3+
These steps provide a no-frills guide to performing an official release
4+
of Tekton Pruner. To follow these steps you'll need a checkout of
5+
the pruner repo, a terminal window and a text editor.
6+
7+
1. [Setup a context to connect to the dogfooding cluster](#setup-dogfooding-context) if you haven't already.
8+
9+
1. `cd` to root of Pruner git checkout.
10+
11+
1. Make sure the release `Pipeline` is up-to-date on the cluster.
12+
13+
- [pruner-release](https://github.com/tektoncd/pruner/blob/main/tekton/release-pipeline.yaml)
14+
```shell script
15+
kubectl apply -f tekton/release-pipeline.yaml
16+
```
17+
18+
1. Select the commit you would like to build the release from, most likely the
19+
most recent commit at https://github.com/tektoncd/pruner/commits/main
20+
and note the commit's hash.
21+
22+
1. Create environment variables for bash scripts in later steps.
23+
24+
```bash
25+
VERSION_TAG=# UPDATE THIS. Example: v0.6.2
26+
PRUNER_RELEASE_GIT_SHA=# SHA of the release to be released
27+
```
28+
29+
1. Confirm commit SHA matches what you want to release.
30+
31+
```bash
32+
git show $PRUNER_RELEASE_GIT_SHA
33+
```
34+
35+
1. Create a workspace template file:
36+
37+
```bash
38+
cat <<EOF > workspace-template.yaml
39+
spec:
40+
accessModes:
41+
- ReadWriteOnce
42+
resources:
43+
requests:
44+
storage: 1Gi
45+
EOF
46+
```
47+
48+
1. Execute the release pipeline.
49+
50+
**If you are back-porting include this flag: `--param=releaseAsLatest="false"`**
51+
52+
```bash
53+
tkn --context dogfooding pipeline start pruner-release \
54+
--param package=github.com/tektoncd/pruner \
55+
--param repoName=pruner
56+
--param imageRegistry=ghcr.io \
57+
--param imageRegistryPath=tektoncd/pruner \
58+
--param imageRegistryRegions="" \
59+
--param imageRegistryUser=tekton-robot \
60+
--param gitRevision="${PRUNER_RELEASE_GIT_SHA}" \
61+
--param versionTag="${VERSION_TAG}" \
62+
--param serviceAccountImagesPath=credentials \
63+
--param releaseBucket=tekton-releases \
64+
--param koExtraArgs="" \
65+
--workspace name=release-secret,secret=oci-release-secret \
66+
--workspace name=release-images-secret,secret=ghcr-creds \
67+
--workspace name=workarea,volumeClaimTemplateFile=workspace-template.yaml
68+
```
69+
70+
1. Watch logs of pruner-release.
71+
72+
1. Once the pipeline run is complete, check its results:
73+
74+
```bash
75+
tkn --context dogfooding pr describe <pipeline-run-name>
76+
77+
(...)
78+
📝 Results
79+
80+
NAME VALUE
81+
commit-sha 6ea31d92a97420d4b7af94745c45b02447ceaa19
82+
release-file https://infra.tekton.dev/tekton-releases/pruner/previous/v0.13.0/release.yaml
83+
release-file-no-tag https://infra.tekton.dev/tekton-releases/pruner/previous/v0.13.0/release.notag.yaml
84+
85+
(...)
86+
```
87+
88+
The `commit-sha` should match `$PRUNER_RELEASE_GIT_SHA`.
89+
The two URLs can be opened in the browser or via `curl` to download the release manifests.
90+
91+
1. The YAMLs are now released! Anyone installing Tekton pruner will now get the new version. Time to create a new GitHub release announcement:
92+
93+
1. Create additional environment variables
94+
95+
```bash
96+
PRUNER_OLD_VERSION=# Example: v0.11.1
97+
TEKTON_PACKAGE=tektoncd/pruner
98+
```
99+
100+
1. Find the Rekor UUID for the release
101+
102+
```bash
103+
RELEASE_FILE=https://infra.tekton.dev/tekton-releases/pruner/previous/${VERSION_TAG}/release.yaml
104+
CONTROLLER_IMAGE_SHA=$(curl $RELEASE_FILE | sed -n 's/"//g;s/.*ghcr\.io.*controller.*@//p;')
105+
REKOR_UUID=$(rekor-cli search --sha $CONTROLLER_IMAGE_SHA | grep -v Found | head -1)
106+
echo -e "CONTROLLER_IMAGE_SHA: ${CONTROLLER_IMAGE_SHA}\nREKOR_UUID: ${REKOR_UUID}"
107+
```
108+
109+
1. Execute the Draft Release task.
110+
111+
```bash
112+
tkn --context dogfooding pipeline start \
113+
--workspace name=shared,volumeClaimTemplateFile=workspace-template.yaml \
114+
--workspace name=credentials,secret=oci-release-secret \
115+
-p package="${TEKTON_PACKAGE}" \
116+
-p git-revision="${PRUNER_RELEASE_GIT_SHA}" \
117+
-p release-tag="${VERSION_TAG}" \
118+
-p previous-release-tag="${PRUNER_OLD_VERSION}" \
119+
-p release-name="Tekton Pruner" \
120+
-p bucket="tekton-releases" \
121+
-p rekor-uuid="$REKOR_UUID" \
122+
release-draft
123+
```
124+
125+
1. Watch logs of create-draft-release. On successful completion, a URL will be logged. Visit that URL and look through the release notes.
126+
127+
1. Manually add upgrade and deprecation notices based on the generated release notes. Double-check that the list of commits here matches your expectations
128+
for the release. You might need to remove incorrect commits or copy/paste commits
129+
from the release branch. Refer to previous releases to confirm the expected format.
130+
131+
1. Un-check the "This is a pre-release" checkbox since you're making a legit for-reals release!
132+
133+
1. Publish the GitHub release once all notes are correct and in order.
134+
135+
1. Edit `releases.md` on the `main` branch, add an entry for the release.
136+
- In case of a patch release, replace the latest release with the new one,
137+
including links to docs and examples. Append the new release to the list
138+
of patch releases as well.
139+
- In case of a minor or major release, add a new entry for the
140+
release, including links to docs and example
141+
- Check if any release is EOL, if so move it to the "End of Life Releases"
142+
section
143+
144+
1. Push & make PR for updated `releases.md`
145+
146+
1. Test release that you just made against your own cluster (note `--context my-dev-cluster`):
147+
148+
```bash
149+
# Test latest
150+
kubectl --context my-dev-cluster apply --filename https://infra.tekton.dev/tekton-releases/pruner/latest/release.yaml
151+
```
152+
153+
```bash
154+
# Test backport
155+
kubectl --context my-dev-cluster apply --filename https://infra.tekton.dev/tekton-releases/pruner/previous/v0.12.1/release.yaml
156+
```
157+
158+
1. For major releases, the [website sync configuration](https://github.com/tektoncd/website/blob/main/sync/config/pruner.yaml)
159+
to include the new release.
160+
161+
1. Announce the release in Slack channels #general, #pruner and #announcements.
162+
163+
Congratulations, you're done!
164+
165+
## Setup dogfooding context
166+
167+
1. Configure `kubectl` to connect to
168+
[the dogfooding cluster](https://github.com/tektoncd/plumbing/blob/main/docs/dogfooding.md):
169+
170+
```bash
171+
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
172+
```
173+
174+
1. Give [the context](https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/)
175+
a short memorable name such as `dogfooding`:
176+
177+
```bash
178+
kubectl config rename-context <REPLACE-WITH-NAME-FROM-CONFIG-CONTEXT> dogfooding
179+
```
180+
181+
## Important: Switch `kubectl` back to your own cluster by default.
182+
183+
```bash
184+
kubectl config use-context my-dev-cluster
185+
```

tekton/release-pipeline.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: tekton.dev/v1
33
kind: Pipeline
44
metadata:
5-
name: pipeline-release
5+
name: pruner-release
66
spec:
77
params:
88
- name: package
@@ -266,7 +266,7 @@ spec:
266266
- name: recursive
267267
value: "true"
268268
- name: deleteExtraFiles
269-
value: "true" # Uses sync to copy content into latest
269+
value: "true"
270270

271271
- name: report-bucket
272272
runAfter: [publish-to-bucket]

0 commit comments

Comments
 (0)