-
Bug
-
Resolution: Duplicate
-
Minor
Here is my pipeline code:
node { checkout changelog: true, poll: true, scm: [ $class: 'GitSCM', branches: [[name: "${env.gitlabSourceRepoName}/${env.gitlabSourceBranch}"]], doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'PruneStaleBranch'], [ $class: 'PreBuildMerge', options: [ fastForwardMode: 'FF', mergeRemote: 'origin', mergeStrategy: 'default', mergeTarget: "${env.gitlabTargetBranch}" ] ], [$class: 'CleanCheckout'] ], userRemoteConfigs: [ [name: 'origin', url: 'git@gitlab.mydomain.com:user/project.git', credentialsId: '8949144f-cca9-4385-8597-ad3c14bbd7ce'], [name: "${env.gitlabSourceRepoName}", url: "${env.gitlabSourceRepoURL}", credentialsId: '8949144f-cca9-4385-8597-ad3c14bbd7ce'] ], browser: [$class: 'GitLab', repoUrl: 'http://gitlab.mydomain.com', version: '8.8'] ] echo """ |GIT_COMMIT: ${GIT_COMMIT} |GIT_BRANCH: ${GIT_BRANCH } """.stripMargin('|') }
But finally it gives me this error:
groovy.lang.MissingPropertyException: No such property: GIT_BRANCH for class: WorkflowScript
Is the environment variables still working for pipeline?
- duplicates
-
JENKINS-26100 SCM steps should return revision state
-
- Resolved
-
- is duplicated by
-
JENKINS-36436 Environment variables are always NULL
-
- Closed
-
- links to
[JENKINS-35230] The environment variables of git plugin not working in pipeline script.
Description |
Original:
Here is my pipeline code: {code} node { checkout changelog: true, poll: true, scm: [ $class: 'GitSCM', branches: [[name: "${env.gitlabSourceRepoName}/${env.gitlabSourceBranch}"]], doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'PruneStaleBranch'], [ $class: 'PreBuildMerge', options: [ fastForwardMode: 'FF', mergeRemote: 'origin', mergeStrategy: 'default', mergeTarget: "${env.gitlabTargetBranch}" ] ], [$class: 'CleanCheckout'] ], userRemoteConfigs: [ [name: 'origin', url: 'git@gitlab.mydomain.com:user/project.git', credentialsId: '8949144f-cca9-4385-8597-ad3c14bbd7ce'], [name: "${env.gitlabSourceRepoName}", url: "${env.gitlabSourceRepoURL}", credentialsId: '8949144f-cca9-4385-8597-ad3c14bbd7ce'] ], browser: [$class: 'GitLab', repoUrl: 'http://gitlab.mydomain.com', version: '8.8'] ] } echo """ |GIT_COMMIT: ${GIT_COMMIT} |GIT_BRANCH: ${GIT_BRANCH } """.stripMargin('|') {code} But finally it gives me this error: {code} groovy.lang.MissingPropertyException: No such property: GIT_BRANCH for class: WorkflowScript {code} Is the environment variables still working for pipeline? |
New:
Here is my pipeline code: {code} node { checkout changelog: true, poll: true, scm: [ $class: 'GitSCM', branches: [[name: "${env.gitlabSourceRepoName}/${env.gitlabSourceBranch}"]], doGenerateSubmoduleConfigurations: false, extensions: [ [$class: 'PruneStaleBranch'], [ $class: 'PreBuildMerge', options: [ fastForwardMode: 'FF', mergeRemote: 'origin', mergeStrategy: 'default', mergeTarget: "${env.gitlabTargetBranch}" ] ], [$class: 'CleanCheckout'] ], userRemoteConfigs: [ [name: 'origin', url: 'git@gitlab.mydomain.com:user/project.git', credentialsId: '8949144f-cca9-4385-8597-ad3c14bbd7ce'], [name: "${env.gitlabSourceRepoName}", url: "${env.gitlabSourceRepoURL}", credentialsId: '8949144f-cca9-4385-8597-ad3c14bbd7ce'] ], browser: [$class: 'GitLab', repoUrl: 'http://gitlab.mydomain.com', version: '8.8'] ] echo """ |GIT_COMMIT: ${GIT_COMMIT} |GIT_BRANCH: ${GIT_BRANCH } """.stripMargin('|') } {code} But finally it gives me this error: {code} groovy.lang.MissingPropertyException: No such property: GIT_BRANCH for class: WorkflowScript {code} Is the environment variables still working for pipeline? |
Assignee | Original: Mark Waite [ markewaite ] |
Link |
New:
This issue is duplicated by |
Workflow | Original: JNJira [ 171461 ] | New: JNJira + In-Review [ 184315 ] |
Component/s | New: workflow-scm-step-plugin [ 21717 ] |
Labels | New: pipeline |
Link |
New:
This issue duplicates |
Resolution | New: Duplicate [ 3 ] | |
Status | Original: Open [ 1 ] | New: Resolved [ 5 ] |
Assignee | New: Mark Waite [ markewaite ] |
Assignee | Original: Mark Waite [ markewaite ] |