1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-22 06:02:51 +00:00
catalog/task/github-create-deployment-status/0.1
Sunghoon Kang 45742091e5 Add github-create-deployment-status task
This task allows to update a status of GitHub deployment from a
Tekton pipeline. This task can be used while deploying or
after deployed (with `finally`) to show status at
GitHub deployment status tab.

Signed-off-by: Sunghoon Kang <hoon@linecorp.com>
2021-04-02 17:22:46 +01:00
..
samples Add github-create-deployment-status task 2021-04-02 17:22:46 +01:00
tests Add github-create-deployment-status task 2021-04-02 17:22:46 +01:00
github-create-deployment-status.yaml Add github-create-deployment-status task 2021-04-02 17:22:46 +01:00
README.md Add github-create-deployment-status task 2021-04-02 17:22:46 +01:00

GitHub Create Deployment Status

The github-create-deployment-status Task lets you create a status for GitHub deployment.

See GitHub's deployment API on Create a deployment status for more information.

Install the Task

kubectl apply -f https://raw.githubusercontent.com/tektoncd/catalog/main/task/github-create-deployment-status/0.1/github-create-deployment-status.yaml

Secrets

This Task requires access to a GitHub token set via a Kubernetes Secret. By default, the name of this Secret should be github and the secret key should be token, but you can configure this via the GITHUB_TOKEN_SECRET_NAME and GITHUB_TOKEN_SECRET_KEY parameters described below.

To create such a Secret via kubectl:

kubectl create secret generic github --from-literal token="MY_TOKEN"

Token must have repo_deployment scope to create deployment status. See GitHub's documentation on Scopes for OAuth Apps for details.

Parameters

  • GITHUB_HOST_URL: The GitHub host domain. (default: api.github.com)
  • API_PATH_PREFIX: The GitHub Enterprise has a prefix for the API path. (e.g.: /api/v3)
  • REPO_FULL_NAME: The GitHub repository full name. (e.g.: tektoncd/catalog)
  • DEPLOYMENT_ID: The ID of deployment. (e.g.: "1")
  • STATE: The state of the status. This can be one of "error", "failure", "inactive", "in_progress", "queued", "pending" or "success". (e.g.: in_progress)
  • LOG_URL: The full URL of the deployment's output. (default: "")
  • DESCRIPTION: Short description of the status. (default: "")
  • ENVIRONMENT: Name for the target deployment environment. (default: "")
  • ENVIRONMENT_URL: The URL for accessing environment. (default: "")
  • AUTO_INACTIVE: Adds a new inactive status to all prior non-transient, non-production environment deployments with the same repository and environment name as the created status's deployment. (default: "true")
  • GITHUB_TOKEN_SECRET_NAME: The name of the Kubernetes Secret that contains the GitHub token. (default: github).
  • GITHUB_TOKEN_SECRET_KEY: The key within the Kubernetes Secret that contains the GitHub token. (default: token).

Usage

This TaskRun creates a status for the given GitHub deployment.

---
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  labels:
    tekton.dev/task: github-create-deployment-status
  name: github-create-tektoncd-catalog-deployment-status
spec:
  taskRef:
    kind: Task
    name: github-create-deployment-status
  params:
    - name: REPO_FULL_NAME
      value: tektoncd/catalog
    - name: DEPLOYMENT_ID
      value: "1"
    - name: STATE
      value: in_progress