-
Bug
-
Resolution: Won't Do
-
Critical
-
None
-
OS: Ubuntu 16.04 (master), Windows 10 (slaves), Ubuntu 16.04 (slaves)
Java: OpenJDK 8 (master & ubuntu slaves), Oracle JRE 8 (windows slaves)
Jenkins version:
2.107.1
Plugin versions:
org.jenkins-ci.main:jenkins-war:2.107.1
org.jenkins-ci:crypto-util:1.1
commons-httpclient:commons-httpclient:3.1-jenkins-1
org.jenkins-ci.main:cli:2.107.1
aopalliance:aopalliance:1.0
org.kohsuke.stapler:stapler-jelly:1.254
com.google.inject:guice:4.0
org.jenkins-ci.modules:slave-installer:1.6
org.springframework:spring-dao:1.2.9
org.jenkins-ci.modules:instance-identity:2.1
org.jenkins-ci:constant-pool-scanner:1.2
org.connectbot.jbcrypt:jbcrypt:1.0.0
org.jenkins-ci.modules:ssh-cli-auth:1.4
org.ow2.asm:asm-commons:5.0.3
org.jenkins-ci:symbol-annotation:1.1
com.github.jnr:jnr-constants:0.9.8
org.jenkins-ci.modules:windows-slave-installer:1.9.2
commons-digester:commons-digester:2.1
commons-io:commons-io:2.4
org.kohsuke:trilead-putty-extension:1.2
commons-codec:commons-codec:1.9
net.sf.kxml:kxml2:2.3.0
org.kohsuke:libzfs:0.8
org.jenkins-ci.ui:jquery-detached:1.2
org.kohsuke.stapler:json-lib:2.4-jenkins-2
org.jvnet.robust-http-client:robust-http-client:1.2
org.ow2.asm:asm:5.0.3
net.java.sezpoz:sezpoz:1.12
org.kohsuke.stapler:stapler-adjunct-timeline:1.5
org.jenkins-ci:winstone:4.1
org.slf4j:log4j-over-slf4j:1.7.25
org.jenkins-ci:version-number:1.4
org.codehaus.groovy:groovy-all:2.4.11
org.jvnet.hudson:commons-jelly-tags-define:1.0.1-hudson-20071021
org.jenkins-ci:jmdns:3.4.0-jenkins-3
commons-lang:commons-lang:2.6
org.springframework:spring-jdbc:1.2.9
org.codehaus.woodstox:wstx-asl:3.2.9
org.springframework:spring-core:2.5.6.SEC03
org.springframework:spring-aop:2.5.6.SEC03
org.samba.jcifs:jcifs:1.3.17-kohsuke-1
org.jenkins-ci:bytecode-compatibility-transformer:1.8
org.jenkins-ci.main:remoting:3.17
org.apache.ant:ant:1.9.2
com.sun.solaris:embedded_su4j:1.1
javax.inject:javax.inject:1
org.jenkins-ci.modules:upstart-slave-installer:1.1
org.apache.commons:commons-compress:1.10
commons-beanutils:commons-beanutils:1.8.3
org.jvnet.localizer:localizer:1.24
org.fusesource.jansi:jansi:1.11
org.jenkins-ci.modules:sshd:2.4
org.springframework:spring-beans:2.5.6.SEC03
javax.xml.stream:stax-api:1.0-2
org.slf4j:slf4j-jdk14:1.7.25
org.jvnet.hudson:activation:1.1.1-hudson-1
commons-jelly:commons-jelly-tags-fmt:1.0
net.i2p.crypto:eddsa:0.2.0
jfree:jfreechart:1.0.9
org.jenkins-ci.main:jenkins-core:2.107.1
oro:oro:2.0.8
org.jenkins-ci:commons-jexl:1.1-jenkins-20111212
org.kohsuke.stapler:stapler-jrebel:1.254
org.jenkins-ci.plugins.icon-shim:icon-set:1.0.5
stax:stax-api:1.0.1
com.google.code.findbugs:jsr305:2.0.1
org.kohsuke.stapler:stapler:1.254
org.kohsuke:windows-package-checker:1.2
org.acegisecurity:acegi-security:1.0.7
commons-fileupload:commons-fileupload:1.3.1-jenkins-2
org.jenkins-ci.modules:launchd-slave-installer:1.2
org.jenkins-ci:annotation-indexer:1.12
org.kohsuke:libpam4j:1.8
jline:jline:2.12
com.github.jnr:jffi:1.2.15
org.jenkins-ci:task-reactor:1.5
org.kohsuke.stapler:stapler-adjunct-zeroclipboard:1.3.5-1
org.kohsuke.stapler:stapler-adjunct-codemirror:1.3
org.ow2.asm:asm-util:5.0.3
org.apache.sshd:sshd-core:1.7.0
org.slf4j:jcl-over-slf4j:1.7.25
org.kohsuke:access-modifier-annotation:1.12
org.kohsuke:akuma:1.10
org.kohsuke.stapler:stapler-groovy:1.254
javax.mail:mail:1.4.4
org.hamcrest:hamcrest-core:1.3
jfree:jcommon:1.0.12
org.springframework:spring-context-support:2.5.6.SEC03
com.google.guava:guava:11.0.1
org.jvnet.hudson:jtidy:4aug2000r7-dev-hudson-1
org.jenkins-ci:commons-jelly:1.1-jenkins-20120928
org.jenkins-ci.ui:handlebars:1.1.1
org.springframework:spring-context:2.5.6.SEC03
org.jenkins-ci.ui:jquery-detached:1.2.1
org.ow2.asm:asm-analysis:5.0.3
io.github.stephenc.crypto:self-signed-cert-generator:1.0.0
com.github.jnr:jffi:1.2.15
org.jvnet.winp:winp:1.25
javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1
commons-discovery:commons-discovery:0.4
org.jenkins-ci.dom4j:dom4j:1.6.1-jenkins-4
org.jenkins-ci:memory-monitor:1.9
org.jenkins-ci.modules:systemd-slave-installer:1.1
org.jvnet.hudson:xstream:1.4.7-jenkins-1
org.jvnet:tiger-types:2.2
com.sun.xml.txw2:txw2:20110809
org.springframework:spring-web:2.5.6.SEC03
org.kohsuke.jinterop:j-interop:2.0.6-kohsuke-1
org.jruby.ext.posix:jna-posix:1.0.3-jenkins-1
org.apache.ant:ant-launcher:1.9.2
com.github.jnr:jnr-ffi:2.1.4
com.github.jnr:jnr-posix:3.0.41
javax.annotation:javax.annotation-api:1.2
org.kohsuke.jinterop:j-interopdeps:2.0.6-kohsuke-1
com.infradna.tool:bridge-method-annotation:1.13
org.ow2.asm:asm-tree:5.0.3
args4j:args4j:2.0.31
org.kohsuke:asm5:5.0.1
antlr:antlr:2.7.6
relaxngDatatype:relaxngDatatype:20020414
com.jcraft:jzlib:1.1.3-kohsuke-1
org.jenkins-ci.ui:bootstrap:1.3.2
commons-collections:commons-collections:3.2.2
net.java.dev.jna:jna:4.2.1
junit:junit:4.12
org.jenkins-ci:trilead-ssh2:build-217-jenkins-11
org.slf4j:slf4j-api:1.7.25
net.sf.ezmorph:ezmorph:1.0.6
org.springframework:spring-webmvc:2.5.6.SEC03
com.github.jnr:jnr-x86asm:1.0.2
xpp3:xpp3:1.1.4c
jaxen:jaxen:1.1-beta-11
commons-jelly:commons-jelly-tags-xml:1.1OS: Ubuntu 16.04 (master), Windows 10 (slaves), Ubuntu 16.04 (slaves) Java: OpenJDK 8 (master & ubuntu slaves), Oracle JRE 8 (windows slaves) Jenkins version: 2.107.1 Plugin versions: org.jenkins-ci.main:jenkins-war:2.107.1 org.jenkins-ci:crypto-util:1.1 commons-httpclient:commons-httpclient:3.1-jenkins-1 org.jenkins-ci.main:cli:2.107.1 aopalliance:aopalliance:1.0 org.kohsuke.stapler:stapler-jelly:1.254 com.google.inject:guice:4.0 org.jenkins-ci.modules:slave-installer:1.6 org.springframework:spring-dao:1.2.9 org.jenkins-ci.modules:instance-identity:2.1 org.jenkins-ci:constant-pool-scanner:1.2 org.connectbot.jbcrypt:jbcrypt:1.0.0 org.jenkins-ci.modules:ssh-cli-auth:1.4 org.ow2.asm:asm-commons:5.0.3 org.jenkins-ci:symbol-annotation:1.1 com.github.jnr:jnr-constants:0.9.8 org.jenkins-ci.modules:windows-slave-installer:1.9.2 commons-digester:commons-digester:2.1 commons-io:commons-io:2.4 org.kohsuke:trilead-putty-extension:1.2 commons-codec:commons-codec:1.9 net.sf.kxml:kxml2:2.3.0 org.kohsuke:libzfs:0.8 org.jenkins-ci.ui:jquery-detached:1.2 org.kohsuke.stapler:json-lib:2.4-jenkins-2 org.jvnet.robust-http-client:robust-http-client:1.2 org.ow2.asm:asm:5.0.3 net.java.sezpoz:sezpoz:1.12 org.kohsuke.stapler:stapler-adjunct-timeline:1.5 org.jenkins-ci:winstone:4.1 org.slf4j:log4j-over-slf4j:1.7.25 org.jenkins-ci:version-number:1.4 org.codehaus.groovy:groovy-all:2.4.11 org.jvnet.hudson:commons-jelly-tags-define:1.0.1-hudson-20071021 org.jenkins-ci:jmdns:3.4.0-jenkins-3 commons-lang:commons-lang:2.6 org.springframework:spring-jdbc:1.2.9 org.codehaus.woodstox:wstx-asl:3.2.9 org.springframework:spring-core:2.5.6.SEC03 org.springframework:spring-aop:2.5.6.SEC03 org.samba.jcifs:jcifs:1.3.17-kohsuke-1 org.jenkins-ci:bytecode-compatibility-transformer:1.8 org.jenkins-ci.main:remoting:3.17 org.apache.ant:ant:1.9.2 com.sun.solaris:embedded_su4j:1.1 javax.inject:javax.inject:1 org.jenkins-ci.modules:upstart-slave-installer:1.1 org.apache.commons:commons-compress:1.10 commons-beanutils:commons-beanutils:1.8.3 org.jvnet.localizer:localizer:1.24 org.fusesource.jansi:jansi:1.11 org.jenkins-ci.modules:sshd:2.4 org.springframework:spring-beans:2.5.6.SEC03 javax.xml.stream:stax-api:1.0-2 org.slf4j:slf4j-jdk14:1.7.25 org.jvnet.hudson:activation:1.1.1-hudson-1 commons-jelly:commons-jelly-tags-fmt:1.0 net.i2p.crypto:eddsa:0.2.0 jfree:jfreechart:1.0.9 org.jenkins-ci.main:jenkins-core:2.107.1 oro:oro:2.0.8 org.jenkins-ci:commons-jexl:1.1-jenkins-20111212 org.kohsuke.stapler:stapler-jrebel:1.254 org.jenkins-ci.plugins.icon-shim:icon-set:1.0.5 stax:stax-api:1.0.1 com.google.code.findbugs:jsr305:2.0.1 org.kohsuke.stapler:stapler:1.254 org.kohsuke:windows-package-checker:1.2 org.acegisecurity:acegi-security:1.0.7 commons-fileupload:commons-fileupload:1.3.1-jenkins-2 org.jenkins-ci.modules:launchd-slave-installer:1.2 org.jenkins-ci:annotation-indexer:1.12 org.kohsuke:libpam4j:1.8 jline:jline:2.12 com.github.jnr:jffi:1.2.15 org.jenkins-ci:task-reactor:1.5 org.kohsuke.stapler:stapler-adjunct-zeroclipboard:1.3.5-1 org.kohsuke.stapler:stapler-adjunct-codemirror:1.3 org.ow2.asm:asm-util:5.0.3 org.apache.sshd:sshd-core:1.7.0 org.slf4j:jcl-over-slf4j:1.7.25 org.kohsuke:access-modifier-annotation:1.12 org.kohsuke:akuma:1.10 org.kohsuke.stapler:stapler-groovy:1.254 javax.mail:mail:1.4.4 org.hamcrest:hamcrest-core:1.3 jfree:jcommon:1.0.12 org.springframework:spring-context-support:2.5.6.SEC03 com.google.guava:guava:11.0.1 org.jvnet.hudson:jtidy:4aug2000r7-dev-hudson-1 org.jenkins-ci:commons-jelly:1.1-jenkins-20120928 org.jenkins-ci.ui:handlebars:1.1.1 org.springframework:spring-context:2.5.6.SEC03 org.jenkins-ci.ui:jquery-detached:1.2.1 org.ow2.asm:asm-analysis:5.0.3 io.github.stephenc.crypto:self-signed-cert-generator:1.0.0 com.github.jnr:jffi:1.2.15 org.jvnet.winp:winp:1.25 javax.servlet.jsp.jstl:javax.servlet.jsp.jstl-api:1.2.1 commons-discovery:commons-discovery:0.4 org.jenkins-ci.dom4j:dom4j:1.6.1-jenkins-4 org.jenkins-ci:memory-monitor:1.9 org.jenkins-ci.modules:systemd-slave-installer:1.1 org.jvnet.hudson:xstream:1.4.7-jenkins-1 org.jvnet:tiger-types:2.2 com.sun.xml.txw2:txw2:20110809 org.springframework:spring-web:2.5.6.SEC03 org.kohsuke.jinterop:j-interop:2.0.6-kohsuke-1 org.jruby.ext.posix:jna-posix:1.0.3-jenkins-1 org.apache.ant:ant-launcher:1.9.2 com.github.jnr:jnr-ffi:2.1.4 com.github.jnr:jnr-posix:3.0.41 javax.annotation:javax.annotation-api:1.2 org.kohsuke.jinterop:j-interopdeps:2.0.6-kohsuke-1 com.infradna.tool:bridge-method-annotation:1.13 org.ow2.asm:asm-tree:5.0.3 args4j:args4j:2.0.31 org.kohsuke:asm5:5.0.1 antlr:antlr:2.7.6 relaxngDatatype:relaxngDatatype:20020414 com.jcraft:jzlib:1.1.3-kohsuke-1 org.jenkins-ci.ui:bootstrap:1.3.2 commons-collections:commons-collections:3.2.2 net.java.dev.jna:jna:4.2.1 junit:junit:4.12 org.jenkins-ci:trilead-ssh2:build-217-jenkins-11 org.slf4j:slf4j-api:1.7.25 net.sf.ezmorph:ezmorph:1.0.6 org.springframework:spring-webmvc:2.5.6.SEC03 com.github.jnr:jnr-x86asm:1.0.2 xpp3:xpp3:1.1.4c jaxen:jaxen:1.1-beta-11 commons-jelly:commons-jelly-tags-xml:1.1
Pipeline from SCM does not populate environment with variables as claimed by https://wiki.jenkins.io/display/JENKINS/Git+Plugin when pipeline is non-multibranch.
Contrived example:
// a library with convenience functions // unused in this particular build, but relevant // as it's used in all 'real' builds @Library('jenkins-libraries') _ // ideally, we would love to know at least the remote branch name here node ('linux_staging') { stage('checkout') { checkout scm // the next best thing would be to know the branch name here sh "echo ${env.GIT_BRANCH}" // empty echo sh(script: "env | sort", returnStdout: true) // no sign of them here echo env.GIT_BRANCH // null } }
Build log
Started by an SCM change Checking out git git@git.tobii.intra:/project/oem/platform/tools/gitolite_testing.git into /jenkinsstorage/jenkins/workspace/infra/Tests/gitolite_hook_tests/test_trigger_feature@script to read Jenkinsfile > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url git@git.tobii.intra:/project/oem/platform/tools/gitolite_testing.git # timeout=10 Fetching upstream changes from git@git.tobii.intra:/project/oem/platform/tools/gitolite_testing.git > git --version # timeout=10 using GIT_SSH to set credentials These credentials are to be used by jenkins/nodes to connect with git using user tts-tools > git fetch --tags --progress git@git.tobii.intra:/project/oem/platform/tools/gitolite_testing.git +refs/heads/f/*:refs/remotes/origin/f/* Seen branch in repository origin/f/PTOOL-112233 Seen branch in repository origin/f/PTOOL-123456 Seen branch in repository origin/f/PTOOL-543 Seen branch in repository origin/f/PTOOL-666 Seen branch in repository origin/f/PTOOL-do-stuff Seen 5 remote branches > git show-ref --tags -d # timeout=10 Checking out Revision 54d55d769c0ea5e320f8706b2d016c7bea22fe55 (origin/f/PTOOL-do-stuff) > git config core.sparsecheckout # timeout=10 > git checkout -f 54d55d769c0ea5e320f8706b2d016c7bea22fe55 > git branch -a -v --no-abbrev # timeout=10 > git checkout -b f/PTOOL-do-stuff 54d55d769c0ea5e320f8706b2d016c7bea22fe55 Commit message: "Jenkinsfile" First time build. Skipping changelog. Running in Durability level: MAX_SURVIVABILITY Loading library jenkins-libraries@master Attempting to resolve master from remote references... > git --version # timeout=10 using GIT_SSH to set credentials These credentials are to be used by jenkins/nodes to connect with git using user tts-tools > git ls-remote -h -t git@git.tobii.intra:prereqs/jenkins_libraries.git # timeout=10 Found match: refs/heads/master revision 1dd4f56b1444ffa2b65de0e6d689c195d23632ff Cloning the remote Git repository Cloning repository git@git.tobii.intra:prereqs/jenkins_libraries.git > git init /jenkinsstorage/jenkins/workspace/infra/Tests/gitolite_hook_tests/test_trigger_feature@libs/jenkins-libraries # timeout=10 Fetching upstream changes from git@git.tobii.intra:prereqs/jenkins_libraries.git > git --version # timeout=10 using GIT_SSH to set credentials These credentials are to be used by jenkins/nodes to connect with git using user tts-tools > git fetch --tags --progress git@git.tobii.intra:prereqs/jenkins_libraries.git +refs/heads/*:refs/remotes/origin/* > git config remote.origin.url git@git.tobii.intra:prereqs/jenkins_libraries.git # timeout=10 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 > git config remote.origin.url git@git.tobii.intra:prereqs/jenkins_libraries.git # timeout=10 Fetching upstream changes from git@git.tobii.intra:prereqs/jenkins_libraries.git using GIT_SSH to set credentials These credentials are to be used by jenkins/nodes to connect with git using user tts-tools > git fetch --tags --progress git@git.tobii.intra:prereqs/jenkins_libraries.git +refs/heads/*:refs/remotes/origin/* Checking out Revision 1dd4f56b1444ffa2b65de0e6d689c195d23632ff (master) > git config core.sparsecheckout # timeout=10 > git checkout -f 1dd4f56b1444ffa2b65de0e6d689c195d23632ff Commit message: "PTOOL-1520_doublelock_remove_printouts" [Pipeline] node Running on linux_staging in /datadisk/jenkins/workspace/infra/Tests/gitolite_hook_tests/test_trigger_feature [Pipeline] { [Pipeline] stage [Pipeline] { (checkout) [Pipeline] checkout > git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository > git config remote.origin.url git@git.tobii.intra:/project/oem/platform/tools/gitolite_testing.git # timeout=10 Fetching upstream changes from git@git.tobii.intra:/project/oem/platform/tools/gitolite_testing.git > git --version # timeout=10 using GIT_SSH to set credentials These credentials are to be used by jenkins/nodes to connect with git using user tts-tools > git fetch --tags --progress git@git.tobii.intra:/project/oem/platform/tools/gitolite_testing.git +refs/heads/f/*:refs/remotes/origin/f/* Seen branch in repository origin/f/PTOOL-112233 Seen branch in repository origin/f/PTOOL-123456 Seen branch in repository origin/f/PTOOL-543 Seen branch in repository origin/f/PTOOL-666 Seen branch in repository origin/f/PTOOL-do-stuff Seen 5 remote branches > git show-ref --tags -d # timeout=10 Checking out Revision 54d55d769c0ea5e320f8706b2d016c7bea22fe55 (origin/f/PTOOL-do-stuff) > git config core.sparsecheckout # timeout=10 > git checkout -f 54d55d769c0ea5e320f8706b2d016c7bea22fe55 > git branch -a -v --no-abbrev # timeout=10 > git checkout -b f/PTOOL-do-stuff 54d55d769c0ea5e320f8706b2d016c7bea22fe55 Commit message: "Jenkinsfile" [Pipeline] sh [test_trigger_feature] Running shell script + echo null null [Pipeline] sh [test_trigger_feature] Running shell script + sort + env [Pipeline] echo BUILD_DISPLAY_NAME=#9 BUILD_ID=9 BUILD_NUMBER=9 BUILD_TAG=jenkins-infra-Tests-gitolite_hook_tests-test_trigger_feature-9 BUILD_URL=https://tobiitechjenkins.tobii.intra/job/infra/job/Tests/job/gitolite_hook_tests/job/test_trigger_feature/9/ CI=true EXECUTOR_NUMBER=0 HOME=/home/tt-tools HUDSON_COOKIE=4e1bdaa3-3ca4-4286-b9ee-6b8e57eb1a1a HUDSON_HOME=/jenkinsstorage/jenkins HUDSON_SERVER_COOKIE=8faf0bbbf409f2f0 HUDSON_URL=https://tobiitechjenkins.tobii.intra/ JENKINS_HOME=/jenkinsstorage/jenkins JENKINS_NODE_COOKIE=fdfcfdf6-6441-4673-acf3-382798ae6c69 JENKINS_SERVER_COOKIE=durable-1f3503ac3f6209410f79edc5a86ce920 JENKINS_URL=https://tobiitechjenkins.tobii.intra/ JOB_BASE_NAME=test_trigger_feature JOB_DISPLAY_URL=https://tobiitechjenkins.tobii.intra/job/infra/job/Tests/job/gitolite_hook_tests/job/test_trigger_feature/display/redirect JOB_NAME=infra/Tests/gitolite_hook_tests/test_trigger_feature JOB_URL=https://tobiitechjenkins.tobii.intra/job/infra/job/Tests/job/gitolite_hook_tests/job/test_trigger_feature/ LANG=en_US.UTF-8 LOGNAME=tt-tools MAIL=/var/mail/tt-tools NODE_LABELS=linux_staging NODE_NAME=linux_staging OLDPWD=/home/tt-tools PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games PWD=/datadisk/jenkins/workspace/infra/Tests/gitolite_hook_tests/test_trigger_feature RUN_CHANGES_DISPLAY_URL=https://tobiitechjenkins.tobii.intra/job/infra/job/Tests/job/gitolite_hook_tests/job/test_trigger_feature/9/display/redirect?page=changes RUN_DISPLAY_URL=https://tobiitechjenkins.tobii.intra/job/infra/job/Tests/job/gitolite_hook_tests/job/test_trigger_feature/9/display/redirect SHELL=/bin/bash SHLVL=1 SignPassword=* SSH_CLIENT=* SSH_CONNECTION=* STAGE_NAME=checkout USER=tt-tools _=/usr/bin/java WORKSPACE=/datadisk/jenkins/workspace/infra/Tests/gitolite_hook_tests/test_trigger_feature XDG_RUNTIME_DIR=/run/user/1000 XDG_SESSION_ID=2388 [Pipeline] echo null [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS
The more real use case is that we have builds that use the parallel-command to execute builds on multiple OS's using various compilers, each (well, most) separate parallel stages do a checkout scm before compilation starts. Finally, after parallel returns, a final stage is supposed to use information about what was actually built to perform common things.
Expected behavior:
Environment populated with GIT_XYZ variables after checkout scm, or even better when the build starts.
Actual behavior:
checkout scm does not lead to the environment being populated with GIT_XYZ, unless in a multibranch configuration. Technically we could use the map returned from checkout scm to populate the environment ourselves, but it feels like this functionality should be provided by the plugin itself. Furthermore, in this particular instance the branch name is only necessary in a final stage, after parallel building has completed, so if using the workaround that stage would have to checkout scm as well, or rely on one of the parallel stages to set a variable in the outer scope.