You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,7 @@
32
32
-[Accept merge request after build](#accept-merge-request)
33
33
-[Notify specific project by a specific GitLab connection](#notify-specific-project-by-a-specific-gitlab-connection)
34
34
-[Cancel pending builds on merge request update](#cancel-pending-builds-on-merge-request-update)
35
+
-[Check if a label is applied to a merge request](#check-if-a-label-is-applied-to-a-merge-request)
35
36
-[Compatibility](#compatibility)
36
37
-[Contributing to the Plugin](#contributing-to-the-plugin)
37
38
-[Testing With Docker](src/docker/README.md#quick-test-environment-setup-using-docker-for-linuxamd64)
@@ -96,6 +97,7 @@ gitlabMergedByUser
96
97
gitlabMergeRequestAssignee
97
98
gitlabMergeRequestLastCommit
98
99
gitlabMergeRequestTargetProjectId
100
+
gitlabMergeRequestLabels
99
101
gitlabTargetBranch
100
102
gitlabTargetRepoName
101
103
gitlabTargetNamespace
@@ -609,6 +611,22 @@ gitlabCommitStatus(
609
611
To cancel pending builds of the same merge request when new commits are pushed, check 'Cancel pending merge request builds on update' from the Advanced-section in the trigger configuration.
610
612
This saves time in projects where builds can stay long time in a build queue and you care only about the status of the newest commit.
611
613
614
+
### Check if a label is applied to a merge request
615
+
To handle conditional logic in your pipelines based on merge request labels, use:
616
+
```groovy
617
+
script {
618
+
if (GitLabMergeRequestLabelExists("bugfix"))
619
+
{
620
+
echo 'bugfix label detected!'
621
+
}
622
+
}
623
+
```
624
+
A comma separated string of the labels is also present as an environment variable: `gitlabMergeRequestLabels`.
625
+
e.g for a merge request with the labels: [`bugfix`, `review needed`], `env.gitlabMergeRequestLabels="bugfix,review needed"`.
626
+
#### *notes:*
627
+
- The environment variable will be null if no labels are applied to the merge request.
628
+
- This feature is not available for multibranch pipeline jobs or GitLab push hooks.
629
+
612
630
## Compatibility
613
631
614
632
Version 1.2.1 of the plugin introduces a backwards-incompatible change
Copy file name to clipboardExpand all lines: src/docker/README.md
+5-4
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,11 @@ In order to test the plugin on different versions of `GitLab` and `Jenkins` you
5
5
An example docker-compose file is available at `gitlab-plugin/src/docker` which the user can use to set up instances of the latest `GitLab` version and latest `Jenkins` LTS version for linux/amd64.
6
6
7
7
If they don't already exist, create the following directories and make sure the user that Docker is running as owns them:
8
-
* /srv/docker/gitlab/postgresql
9
-
* /srv/docker/gitlab/gitlab
10
-
* /srv/docker/gitlab/redis
11
-
* /srv/docker/jenkins
8
+
* /srv/docker/gitlab/postgresql
9
+
* /srv/docker/gitlab/gitlab
10
+
* /srv/docker/gitlab/redis
11
+
* /srv/docker/jenkins
12
+
12
13
To start the containers for Linux, run `docker-compose up -d` from the `src/docker` folder. If you have problems accessing the services in the containers, run `docker-compose up` by itself to see output from the services as they start, and the latter command is the verbose version of the former.
13
14
14
15
## Quick test environment setup using Docker for MacOS/arm64
0 commit comments