jenkinsci / jenkinsci/gitlab-plugin

Environment variables not expanded for build name in "Publish build status to Gitlab commit"

Open
#446 3 comments 0 reactions 1 assignee Claimed by @trance1st View on GitHub
bug
Dominant language
Java
Stars
1.4k
Forks
615
Avg merge
4h 32m
Merged PRs (30d)
10

Description

## Issue

### Context
- **Gitlab plugin version**: 1.4.3
- **Gitlab version**: 8.13.1
- **Jenkins version**: 2.30

### Problem description
The **Publish build status to Gitlab commit** post-build feature doesn't seem to be expanding environment variables correctly. In this case, I'm triggering a jenkins build using a java regex, and then parsing the string to get the Jenkins build name to trigger. I then use the [EnvInject](https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin) plugin to set the environment variable "TestTriggerName". This method works for the **Add note with build status on Gitlab merge request** post-build feature, where I define a custom message for success/fail/abort that includes the TestTriggerName variable. for the **Add note with build status on Gitlab merge request** feature, ${TestTriggerName} is correctly expanded and posted to gitlab; however in the **Publish build status to Gitlab commit** feature, the build name doesn't expand correctly. Listing the variable for the build name in jenkins:

![jenkins_side](https://cloud.githubusercontent.com/assets/16530166/20307826/45779ec0-ab0f-11e6-82f7-a642a37f453b.png)

produces the variable as literal on the gitlab side:

![bad_expansion_example](https://cloud.githubusercontent.com/assets/16530166/20307748/df1a9d4e-ab0e-11e6-8831-14549506d0de.png)

I would have expected the TestTriggerName variable to be expanded as the build note was in this case.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.