1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-21 05:55:35 +00:00
catalog/task/gitlab-add-label/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
..
gitlab-add-label.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

GitLab

A collection of tasks to help working with the GitLab API.

GitLab token

Most tasks would expect to have a secret set in the kubernetes secret gitlab with a GitLab token in the key token. Check this to get personal access token for Gitlab. You can easily create it on the command line with kubectl like this :

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

or

apiVersion: v1
kind: Secret
metadata:
  name: gitlab
type: Opaque
stringData:
  token: $(personal_access_token)

Add labels to the GitLab issue or Merge Request

This task can be used to add labels to the gitlab issue or merge request (pull request).

Install the Task

kubectl apply -f https://api.hub.tekton.dev/v1/resource/tekton/task/gitlab-add-label/0.1/raw

Parameters

  • GITLAB_HOST_URL: The Gitlab host(default:gitlab.com).
  • API_PATH_PREFIX: The API path prefix (default.:api/v4).
  • REQUEST_URL: The Gitlab issue or merge request URL where we want to add labels (e.g.https://gitlab.com/foo/bar/issues/10).
  • LABELS: The actual labels to add.
  • GITLAB_TOKEN_SECRET: The name of the secret holding the gitlab-token (default:gitlab).
  • GITLAB_TOKEN_SECRET_KEY: The name of the secret key holding the gitlab-token (default:token).

Secrets

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

Platforms

The Task can be run on linux/amd64 platform.

Usage

This task expects a secret named gitlab to exist, with a Gitlab token in token with enough privileges to add label to an issue.

To add labels to an issue or merge request, put all the required params, add required secrets and labels will be created.

Taskrun can be created as follows:

apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
  name: gitlab-add-label-run
spec:
  taskRef:
    name: gitlab-add-label
  params:
    - name: REQUEST_URL
      value: https://gitlab.com/Divyanshu42/aws-cli/-/issues/1  # or https://gitlab.com/Divyanshu42/aws-cli/-/merge_requests/1
    - name: LABELS
      value:
        - bug
        - kind/feature