1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-11-25 06:17:50 +00:00
catalog/task/gitlab-add-label/0.1
vinamra28 32f2913fd2 Fix Catlin error by adding Digest to the Images
- Previously catalog's task has some images that are not
  tagged properly,this patch fixes these images by adding
  the digest
- Soon once Catlin is added to the CI it will throw error
  for those images which don't have proper tags

co-authored by:- @PuneetPunamiya

Signed-off-by: vinamra28 <vinjain@redhat.com>
2020-10-26 09:03:20 +00:00
..
gitlab-add-label.yaml Fix Catlin error by adding Digest to the Images 2020-10-26 09:03:20 +00:00
README.md This patch splits gitlab-add-label task from the gitlab directory 2020-07-13 13:41:58 +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://raw.githubusercontent.com/tektoncd/catalog/master/task/gitlab-add-label/0.1/gitlab-add-label.yaml

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.

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