Gitlab Merge Request
kind: gitlab/mergerequest
On this page
Description
The action section describes the Gitlab Merge Requests that updatecli is expected to open (or update) when a target is modified.
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| allowcollaboration | boolean | allowcollaboration indicates whether to allow commits from members who can merge to the target branch default: false remark: when set to true, members with write access to the repository can push commits to the source branch of the merge request | |
| assignees | array | “assignees” contains the list of assignee to add to the merge request default: empty remark: assignees only accept GitLab User IDs. To find the user ID:
| |
| body | string | “body” defines a custom mergerequest body default: By default a mergerequest body is generated out of a pipeline execution. remark: Unless you know what you are doing, you shouldn’t set this value and rely on the sane default. “body” is useful to provide additional information when reviewing mergerequest, such as changelog url. | |
| labels | array | “labels” defines labels for the merge request. | |
| mergecommitmessage | string | mergecommitmessage defines the commit message used when the merge request is merged default: empty remark: if empty, GitLab will use the default message format defined in the project settings | |
| mergewhenpipelinesucceeds | boolean | mergewhenpipelinesucceeds indicates whether to merge the merge request when the pipeline succeeds default: false remark: | |
| owner | string | “owner” defines the GitLab repository owner. remark: unless you know what you are doing, you shouldn’t set this value and rely on the scmid to provide the sane default. | |
| removesourcebranch | boolean | “removesourcebranch” is a flag indicating if a merge request should remove the source branch when merging default: false | |
| repository | string | “repository” defines the GitLab repository for a specific owner remark: unless you know what you are doing, you shouldn’t set this value and rely on the scmid to provide the sane default. | |
| reviewers | array | “reviewers” contains the list of reviewers to add to the merge request default: empty remark: assignees only accept GitLab User IDs. To find the user ID:
| |
| sourcebranch | string | “sourcebranch” defines the branch name used as a source to create the GitLab mergerequest. default: “sourcebranch” inherits the value from the scm branch if a scm of kind “gitlab” is specified by the action. remark: unless you know what you are doing, you shouldn’t set this value and rely on the scmid to provide the sane default. | |
| squash | boolean | “squash” defines if all commits should be squashed into a single commit on merge default: false remark: project settings might override this value | |
| squashcommitmessage | string | squashcommitmessage defines the commit message used when the merge request is squashed and merged default: empty remark: if empty, GitLab will use the default message format defined in the project settings | |
| targetbranch | string | “targetbranch” defines the branch name used as a target to create the GitLab mergerequest. default: “targetbranch” inherits the value from the scm working branch if a scm of kind “gitlab” is specified by the action. remark: unless you know what you are doing, you shouldn’t set this value and rely on the scmid to provide the sane default. the GitLab scm will create and use a working branch such as updatecli_xxxx | |
| title | string | “title” defines the GitLab mergerequest title default: A GitLab mergerequest title is defined by one of the following location (first match) 1. title is defined by the spec such as: remark: usually we prefer to go with option 2 | |
| token | string | “token” defines the credential used to authenticate with GitLab remark: A token is a sensitive information, it’s recommended to not set this value directly in the configuration file but to use an environment variable or a SOPS file. The value can be set to https://github.com/getsops/sops | |
| url | string | “url” defines the GitLab url to interact with default: “gitlab.com” | |
| username | string | “username” defines the username used to authenticate with GitLab |
Example
# updatecli.yaml
# updatecli diff --config updatecli.yaml
#
name: Show Gitlab pipeline example
# Sources are responsible to fetch information from third location such as npm registry.
sources:
updatecli:
name: Get latest axios version
kind: npm
spec:
name: axios
# Targets are responsible to update targeted files such as a yaml file.
targets:
npm:
name: Update e2e test file
kind: yaml
sourceid: updatecli
scmid: gitlab
spec:
file: e2e/updatecli.d/success.d/npm.yaml
key: conditions.axios.spec.version
###
# Actions such as gitlab/mergerequest is triggered if a target is updated.
actions:
default:
title: Bump axios version
kind: gitlab/mergerequest
scmid: gitlab
scms:
gitlab:
kind: gitlab
spec:
owner: "olblak"
repository: "updatecli"
branch: main
# For the change to be apply, we need to specify gitlab credentials
#username: gitlab_username
#token: gitlab_token