Server Fault Asked by hagits on November 16, 2021
I have a bulk of Jenkins jobs for each release we issue.
I want to be able to easily define a new release, and was happy to find Folder properties Pluging
I defined a folder property for the version:
After that I defined a try job, which use the folder defition, and echos it’s value.
.
I run it, and get the value on log:
version: master
echo 'folder version: master'
folder version: master
Finished: SUCCESS
Now, I added an SCM definition to the job:
But I get error on log. As you can see $folder_version did not get the “master” value.
git rev-parse refs/remotes/origin/$folder_version^{commit} # timeout=10
git rev-parse refs/remotes/origin/refs/heads/$folder_version^{commit} # timeout=10
git rev-parse refs/heads/$folder_version^{commit} # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
What am I missing here?
Thank you for using my plugin. About your question, I believe in a freestyle job, the SCM step does not try to interpolate the selector string and so you can see the console output will render this:
git rev-parse refs/remotes/origin/origin/$folder_version^{commit} # timeout=10
Where the $folder_version
is the intended place-holder not interpolated.
As an alternative, switch to Pipeline jobs and do something like this:
stage('Test SCM'){
node{
withFolderProperties{
echo("Branch is '${env.folder_version}'")
git branch: env.folder_version, credentialsId: 'my-github-credentials', url: 'https://github.com/my-org/my-project.git'
isUnix()?sh('ls -la'):bat('dir')
}
}
}
I hope this helps.
Answered by Mig82 on November 16, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP