This directory contains the Tekton Tasks
and Pipelines
used to create Dashboard releases.
These tasks run on your local cluster, and then copy the release artifacts - docker images and yaml files - into the tekton releases
bucket in Google Cloud Platform. Your cluster must contain keys from a google account with the necessary authorization in order for this to work.
First, ensure that your credentials are set up correctly. You will need an account with access to Google Cloud Platform. Your account must have 'proper authorization to release the images and yamls' in the tekton-releases
GCP project. Your account must have Permission iam.serviceAccountKeys.create
. Contact @bobcatfish or @dlorenc if you are going to be creating dashboard releases and require this authorization.
- You will need to install the
gcloud
CLI in order to get keys out of Google Cloud and into your local cluster. These credentials will be patched onto the service account to be used by the Tekton PipelineRuns. You do not need to create a new GCP project or pay Google any money. - It's convenient to use the 'tkn' CLI to kick off builds, so grab that as well.
KEY_FILE=release.json
GENERIC_SECRET=release-secret
# The kubernetes ServiceAccount that will be used by your Tekton tasks. 'default' is the default. It should already exist.
SERVICE_ACCOUNT=default
GCP_ACCOUNT="release-right-meow@tekton-releases.iam.gserviceaccount.com"
# 1. Create a GCP private key for the service account. It is vital to keep a copy safe since there is a limit of ten keys in total.
gcloud iam service-accounts keys create --iam-account $GCP_ACCOUNT $KEY_FILE
# 2. Sore GCP key in a secret
kubectl create secret generic $GENERIC_SECRET --from-file=./$KEY_FILE
# 3. Patch the GCP key onto the service account to be used to run the release pipeline.
kubectl patch serviceaccount $SERVICE_ACCOUNT -p "{\"secrets\": [{\"name\": \"$GENERIC_SECRET\"}]}"
Next:
- Install Tekton pipelines into your local cluster.
- Create a GitHub release by pushing a tag to the dashboard repository. This should be of the form, `vX.Y.Z' e.g.' 'v0.2.5'.
- Change the
version
label inbase/300-deployment.yaml
to the same as the tag in the previous step. - Edit the
tekton-dashboard-git
PipelineResource inresources.yaml
and setspec.params.revision.value
to 'vX.Y.Z' e.g.,v0.2.5
. This can also be a git commit if you have not created a release yet. - From the root directory of the dashboard repository, create the Tekton Dashboard release pipeline:
PIPELINE_NAMESPACE=tekton-pipelines
kubectl apply -f tekton -n $PIPELINE_NAMESPACE
You may want to run a test release first. To do this:
- Create a directory in the Google Cloud bucket
- Add that directory to the associated PipelineResource
- Apply your changes
- Run a test release
- Clean up
So for example, we might want to run one or more test releases under the name 'test-release'.
- Go to https://console.cloud.google.com/storage/browser/tekton-releases/dashboard and click 'Create folder'. Create the folder Buckets/tekton-releases/dashboard/test-release.
- Modify the tekton-bucket-dashboard PipelineResource:
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: tekton-bucket-dashboard
spec:
type: storage
params:
- name: type
value: gcs
- name: location
value: gs://tekton-releases/dashboard/test-release # If you're testing use your bucket name here instead of test-release
- name: dir
value: "y"
- Apply your changes
PIPELINE_NAMESPACE=tekton-pipelines
kubectl apply -f tekton -n $PIPELINE_NAMESPACE
Run a test release:
VERSION_TAG=test-1
PIPELINE_NAMESPACE=tekton-pipelines
tkn pipeline start dashboard-release -p versionTag=$VERSION_TAG -r dashboard-source-repo=tekton-dashboard-git -r bucket-for-dashboard=tekton-bucket-dashboard -r builtDashboardImage=dashboard-image -n $PIPELINE_NAMESPACE -s $SERVICE_ACCOUNT -p bucketName=mytestbucket
This will result in release artifacts appearing in the Google Cloud bucket gs://tekton-releases/dashboard/mytestbucket/test-1
. If you need to run a second build, incremement $VERSION_TAG. Once you're finished, clean up:
- delete /mytestbucket from the PipelineResource and reapply your changes
- delete the temporary /mytestbucket bucket in Google Cloud
Now you can kick off the release build:
VERSION_TAG=vX.Y.Z
PIPELINE_NAMESPACE=tekton-pipelines
tkn pipeline start dashboard-release -p versionTag=$VERSION_TAG -r dashboard-source-repo=tekton-dashboard-git -r bucket-for-dashboard=tekton-bucket-dashboard -r builtDashboardImage=dashboard-image -n $PIPELINE_NAMESPACE -s $SERVICE_ACCOUNT -p bucketName=latest
Monitor the build logs to see the image coordinates that the image is pushed to. The release yaml files should appear under https://console.cloud.google.com/storage/browser/tekton-releases/dashboard.
We have a number of tasks that are yet to be automated:
- Write the release notes
- Attach
.yaml
files from https://console.cloud.google.com/storage/browser/tekton-releases/dashboard - be sure you copy the locked down image ones (look underprevious
): any containers such askubectl
andoauth-proxy
should reference an image sha and not a tag such aslatest
- Optionally repeat for the Webhooks Extension (automation in progress)
- Fix up image coordinates in
/README.md
for the normal and Openshift installs - Publish the GitHub release