jenkinsci / jenkinsci/gitlab-plugin

some environment variables is empty

Open
#1,093 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
615
Avg merge
4h 32m
Merged PRs (30d)
10

Description

Hello, I'm using the environment variables in the gialab-plugin v1.5.13. Some of the values can be retrieved and some of the values are null, such as JenkinsFile below. I can get the value of GitLabUserEmail, but I can't get the value of GitLabTriggerPhrase
,Is there something wrong with my operation:
pipeline {
agent {
label 'build_cncf01'
}
environment {
GITLAB_URL = "http://10.2.10.220/"
}
triggers {
gitlab(
triggerOnPush: false,
triggerOnMergeRequest: true,
triggerOpenMergeRequestOnPush: "source",
triggerOnNoteRequest: true,
noteRegex: ".*\\[run\\W+ci\\].*",
skipWorkInProgressMergeRequest: true,
ciSkip: true,
setBuildDescription: true,
addNoteOnMergeRequest: true,
addCiMessage: true,
addVoteOnMergeRequest: true,
acceptMergeRequestOnSuccess: false,
branchFilterType: "All",
)
}
stages {
stage('test'){
steps{
sh '''
echo $gitlabTriggerPhrase
echo $gitlabUserEmail
'''
}
}
}
options {
gitLabConnection('gitlab')
}
}

Log as follows

Triggered by GitLab Merge Request #18: wenlong zhang/master => master
Obtained Jenkinsfile from git http://10.2.10.220/project_control/cncf_build/testjenkinsfile.git
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node (hide)
Running on build_cncf01 in /opt/jenkins/workspace/gitlab-project-pipeline-test-email
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
The recommended git tool is: NONE
using credential f9776b9e-7d69-4c97-8238-893537d67e96
Fetching changes from the remote Git repository
skipping resolution of commit 158cea666f1732405909b42e178581ffd3f07393, since it originates from another repository
Checking out Revision 3a9919eff8617c371acc4ffc552d3795590d4b07 (refs/remotes/origin/master)
Commit message: "*"
> git rev-parse --is-inside-work-tree # timeout=10
> git config remote.origin.url http://10.2.10.220/project_control/cncf_build/testjenkinsfile.git # timeout=10
Fetching upstream changes from http://10.2.10.220/project_control/cncf_build/testjenkinsfile.git
> git --version # timeout=10
> git --version # 'git version 1.8.3.1'
using GIT_ASKPASS to set credentials root/loongson
> git fetch --tags --progress http://10.2.10.220/project_control/cncf_build/testjenkinsfile.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git config core.sparsecheckout # timeout=10
> git checkout -f 3a9919eff8617c371acc4ffc552d3795590d4b07 # timeout=10
> git rev-list --no-walk 3a9919eff8617c371acc4ffc552d3795590d4b07 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (test)
[Pipeline] sh
+ echo

+ echo zhangwenlong@loongson.cn
zhangwenlong@loongson.cn
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

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.