-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: kubernetes-plugin, workflow-multibranch-plugin
-
None
We have the following job definition:
Â
pipelineJob("$FOLDER_NAME/k8s-promote") {   displayName('k8s-promote')   parameters {     stringParam('RELEASE_TAG', '', ''. (Required)')   }   definition {     cpsScmFlowDefinition {       scm {         gitSCM {           userRemoteConfigs {             userRemoteConfig {               url '<private BB server>'               credentialsId 'bitbucket-buildmaster'               name ''               refspec ''             }           }           branches {             branchSpec {               name 'refs/tags/v-${RELEASE_TAG}'             }           }           browser {}           gitTool 'Default'         }       }       scriptPath 'Jenkinsfile-k8s'       lightweight false     }   } }
Â
One of the steps tries to spawn a k8s agent base on a pod.yaml in the repo:
Â
stage('10. tests') { Â Â when { Â Â Â Â ... Â Â } Â Â agent { Â Â Â Â kubernetes { Â Â Â Â Â Â label 'tests' Â Â Â Â Â Â defaultContainer 'chrome' Â Â Â Â Â Â yamlFile '.ci/chrome.yaml' Â Â Â Â Â Â workspaceVolume emptyDirWorkspaceVolume(true) Â Â Â Â } Â Â } Â Â environment { Â Â Â Â ... Â Â } Â Â steps { Â Â Â Â .. Â Â } }
Â
As soon as the build comes to this step, it will fail with the following error:
Â
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress --prune -- origin +refs/tags/v-${RELEASE_TAG}:refs/remotes/origin/v-${RELEASE_TAG}" returned status code 128:stdout:Â stderr: fatal: couldn't find remote ref refs/tags/v-${RELEASE_TAG} at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2846) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185) at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635) at PluginClassLoader for git//jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:408)Also:Â Â org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 770c278b-36aa-4c5f-bdba-13885c4b73eaCaused: java.io.IOException at PluginClassLoader for git//jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:413) at PluginClassLoader for scm-api//jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:219) at PluginClassLoader for scm-api//jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:191) at PluginClassLoader for scm-api//jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174) at PluginClassLoader for workflow-multibranch//org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:116) at PluginClassLoader for workflow-multibranch//org.jenkinsci.plugins.workflow.multibranch.ReadTrustedStep$Execution.run(ReadTrustedStep.java:93) at PluginClassLoader for workflow-step-api//org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.base/java.util.concurrent.FutureTask.run(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)Finished: FAILURE
Â
I tested replacing the variable in the branchSpec definition with a concrete version and it was working, so I am assuming the variable is not substituted in this case.
Â
We continued with a workaround of providing the podYaml inline of the jenkinsfile and the job completed successfully.
Â
Â
Â