-
Bug
-
Resolution: Won't Fix
-
Major
-
None
For a pipeline job, using a declarative syntax with yamlFile, the job fails with the following exception during the yaml file loading step:
[Pipeline] Start of Pipeline [Pipeline] readTrusted [Pipeline] End of Pipeline hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH} --prune" returned status code 128: stdout: stderr: fatal: Couldn't find remote ref refs/heads/${BRANCH} at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2318) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1905) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:81) at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:488) at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:349) at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:198) at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174) at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:101) at org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:82) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47) at hudson.security.ACL.impersonate(ACL.java:290) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)
${BRANCH} is a job parameter.
Note that this is NOT the same as https://issues.jenkins-ci.org/browse/JENKINS-52623, as it only affects the yamlFile usage. Switching to yaml works fine.
It was also mentioned here: https://issues.jenkins-ci.org/browse/JENKINS-52259?focusedCommentId=344959&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-344959
- is blocked by
-
JENKINS-53705 readTrusted step doesn't resolve parameters from branch name
-
- Open
-
- is duplicated by
-
JENKINS-57930 Pipeline script from SCM does not expand build parameters/env variables for declarative pipeline with yamlFile specified
-
- Resolved
-
- relates to
-
JENKINS-52623 environment variables like COMMIT_ID, GIT_BRANCH etc are not published to kubernetes agent
-
- Resolved
-
-
JENKINS-52259 Read pod template yaml from external file
-
- Closed
-
- links to
Passing Git branches as a build parameter is not supported by the readTrusted step used internally here. Either use a multibranch project, or inline the YAML into the Jenkinsfile, or switch to Scripted syntax and use readFile to load YAML from an actual checkout (presumably preceding the pod used for the main build).