1
0
mirror of https://github.com/tektoncd/catalog.git synced 2024-12-02 06:52:15 +00:00
catalog/gitlab
Divyansh42 265c6fe380 Add Gitlab Release task
This task can be used to make a release on the Gitlab.

Assets or binaries of the released version can also be uploaded with the release.

Signed-off-by: Divyansh42 <diagrawa@redhat.com>
2020-06-04 10:23:51 +01:00
..
create-gitlab-release Add Gitlab Release task 2020-06-04 10:23:51 +01:00
add-labels.yaml Add support for merge requests in gitlab add-labels task 2020-06-04 09:31:09 +01:00
README.md Add support for merge requests in gitlab add-labels task 2020-06-04 09:31:09 +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/v1beta1/gitlab/add-labels.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