Gitlab Merge Request

kind: gitlab/mergerequest

Description

The action section describes the Gitlab Merge Requests that updatecli is expected to open (or update) when a target is modified.

Parameters

NameTypeDescriptionRequired
bodystring

“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.
ownerstring

“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.
repositorystring

“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.
sourcebranchstring

“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.
targetbranchstring

“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
titlestring

“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:

				actions:
					default:
						kind: gitlab/mergerequest
						scmid: default
						spec:
							title: This is my awesome title

			2. title is defined by the action such as:

				actions:
					default:
						kind: gitlab/mergerequest
						scmid default
						title: This is my awesome title

			3. title is defined by the first associated target title

			4. title is defined by the pipeline title

	remark:
		usually we prefer to go with option 2
tokenstring

“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 {{ requiredEnv "GITLAB_TOKEN"}} to retrieve the token from the environment variable GITHUB_TOKEN or {{ .gitlab.token }} to retrieve the token from a SOPS file.

  For more information, about a SOPS file, please refer to the following documentation:

https://github.com/getsops/sops

urlstring

“url” defines the GitLab url to interact with

default: “gitlab.com”

usernamestring“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

Top