On this page
GitLab Tag
| source | condition | target |
|---|---|---|
✔ | ✔ | ✗ |
Description
The gitlab/tag resource queries the tags of a repository hosted on GitLab, through the GitLab API rather than over the git protocol.
- source
Returns the tag matching
versionfilter.- condition
Tests that
tagexists in the repository.- target
Not supported - a target fails with
target not supported for the plugin GitLab Tags. Say so on the issue tracker if you would use one.
Note | An scm attached to a condition is ignored, with a warning. The lookup always goes to the GitLab API. |
Tip | To work with tags over the git protocol instead, on any host (and to create one), use gittag. |
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| age | object | “age” defines the minimum or maximum age of a tag to be considered valid. compatible:
remark:
| |
| maximum | string | “maximum” defines the maximum age a release may have to be considered. remark:
example:
| |
| minimum | string | “minimum” defines the minimum age a release must have to be considered. remark:
example:
| |
| owner | string | “owner” defines the owner of the GitLab repository. compatible:
example:
| |
| repository | string | “repository” defines the name of the GitLab repository, for a specific owner. compatible:
example:
| |
| tag | string | “tag” defines the name of the tag to look for. compatible:
default: the output of the associated source. example:
| |
| token | string | “token” defines the credential used to authenticate with GitLab. remark:
example:
| |
| url | string | “url” defines the GitLab url to interact with. default: gitlab.com remark:
example:
| |
| username | string | “username” defines the username used to authenticate with GitLab. | |
| versionfilter | object | “versionfilter” defines the version pattern and kind used to select the tag, such as regex, semver or latest. compatible:
default: kind: latest | |
| kind | string | “kind” defines the versioning scheme used to select a version. default: latest remark:
example:
| |
| pattern | string | “pattern” defines the version pattern, according to “kind”. default:
remark:
example:
| |
| regex | string | “regex” defines the regular expression extracting the version from each entry. remark:
example:
| |
| replaceall | object | “replaceall” applies a regular expression replacement to each version before filtering. remark:
example: turns “curl-8_15_0” into “curl-8.15.0”. | |
| strict | boolean | “strict” enforces strict semantic versioning rules when parsing versions. default: false remark:
|
owner and repository are mandatory. url defaults to gitlab.com. Set it for a self-managed instance.
tagCondition only - the tag being checked.
versionfilterSource only.
kind: semveris the usual choice for release tags. See the "Version Filtering" page.
Authentication
token authenticates against the GitLab API. It is sensitive, so read it from the environment or a SOPS file rather than writing it into the manifest:
spec:
url: gitlab.com
token: '{{ requiredEnv "GITLAB_TOKEN" }}'
owner: updatecli
repository: updatecliReading a public repository works without any credential.
Example
# updatecli.yaml
name: "Show Gitlab tag usage"
sources:
default:
name: "Get tag using versionfilter from a Gitlab repository"
kind: "gitlab/tag"
spec:
# Default to gitlab.com
# url: "gitlab.com"
owner: "olblak"
repository: "updatecli-test"
versionfilter:
kind: "semver"
pattern: "~0.0"
latest:
name: "Get latest tag tag from a Gitlab repository"
kind: "gitlab/tag"
spec:
# Default to gitlab.com
# url: "gitlab.com"
owner: "olblak"
repository: "updatecli-test"
conditions:
default:
name: "Test tag '0.0.2' exist on the Gitlab repository"
kind: "gitlab/tag"
disablesourceinput: true
spec:
# Default to gitlab.com
# url: "gitlab.com"
owner: "olblak"
repository: "updatecli"
tag: "v0.2.0"
sourcedefault:
name: "Test that the tag retrieved from source 'default' exist on the Gitlab repository"
kind: "gitlab/tag"
sourceid: "default"
spec:
# Default to gitlab.com
# url: "gitlab.com"
owner: "olblak"
repository: "updatecli"
latest:
name: "Test that the tag retrieved from source 'latest' exist on the Gitlab repository"
kind: "gitlab/tag"
sourceid: "latest"
spec:
# Default to gitlab.com
# url: "gitlab.com"
owner: "olblak"
repository: "updatecli"
Links
The
gitlabscm - to clone and push