1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-21 05:55:35 +00:00
catalog/task/create-github-release/0.1
Quan Zhang e294e1246b [TEP-0110] Update Tekton Catalog installation instructions
Prior to this change, the installation instructions directly use the resource urls in the Catalog repo, which results in tight coupling between the organization and how users fetch resources (as described in TEP-0110). This commit updates the installation guide to install Tekton Catalog resources via Tekton Hub Api: https://github.com/tektoncd/hub/pull/539

This change decouples the Tekton Catalog organization from resouces resolution, which enables Tekton Catalog reorganization.
2022-08-16 16:25:52 +01:00
..
samples Modifies directory names based on the proposal 2020-07-14 19:01:58 +01:00
create-github-release.yaml Add linux/amd64 platform annotation to the rest of the tasks 2021-10-29 17:08:38 +01:00
README.md [TEP-0110] Update Tekton Catalog installation instructions 2022-08-16 16:25:52 +01:00

Create Github Release

It is typical to create a Github tag at the moment of release to introduce a checkpoint in your source code history, but in most cases users will need compiled objects or other assets output, not just the raw source code.

Github Releases are a way to track deliverables in your project. Consider them a snapshot in time of the source, build output, artifacts, and other metadata associated with a released version of your code.

This task can be used to make a github release.

Task can also be used to upload multiple assets including binaries of the released version and the release notes, with the release.

Install the Task

kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/create-github-release/0.1/raw

Parameters

  • TAG: A git tag name that will be created with this release (e.g:v1.0.0).
  • REVISION: A Git revision to create a release from (branch, tag, sha, ref…) (default:master).
  • RELEASE_FILE_NAME: Name of the file that has to be uploaded as release notes (default:release.md).
  • GITHUB_TOKEN_SECRET: The name of the secret holding the github-token (default:github-token).
  • GITHUB_TOKEN_SECRET_KEY: The name of the secret key holding the github-token (default:GITHUB_TOKEN).

Workspace

  • input: To mount asset which has to be uploaded with the release.
  • source: Contains Github repository on which release has to be made.
  • release-notes: To mount file that has to provided as release notes in the release.

Secrets

  • Secret to provide Github access token to authenticate to the Github.

Check this to get personal access token for Github.

Platforms

The Task can be run on linux/amd64 platform.

Usage

This task expects a secret named github-token to exists, with a GitHub token in GITHUB_TOKEN with enough privileges to create a release.

This task can upload multiple assets with the release on the github, in order to do that any volume (supported in workspace) can be mounted in the workspace named input containing all the assets that needs to be uploaded.

Release Notes can also be uploaded with the release by mounting the the release notes file in the workspace named release-notes. Name of the release notes file should also be provided in the params, default is release.md.

Release can be created at a particular branch, tag or commit sha, to achieve that, required branch, tag or commit sha can be added in the param commitish.

Github repository on which release has to be performed must be available in the workspace named source. This can be done using git-clone task as shown here.

To make a release put all the required params, add required secrets and release will be done.

Secrets can be created as follows:

apiVersion: v1
kind: Secret
metadata:
  name: github-token
type: Opaque
stringData:
  GITHUB_TOKEN: $(personal_access_token)

This example uses ConfigMap for mounting asset file to the workspace, ConfigMap can be created as follows:

kubectl create configmap upload-asset --from-file=file1.txt --from-file=file2.txt 

Note

  • If case asset is not to be uploaded with the release, then emptyDir needs to be mounted in the workspace as shown below:

    workspaces:
      - name: input
        emptyDir: {}
    
    
  • Task uses image from quay.io/diagrawa/github-hub which is based on this Dockerfile.