rtDownload (
serverId: 'pe-jfrog',
spec: '''{
"files": [
"pattern": "my-local-repo-dev/test-${buildVersion}.tar"
}''',
buildName: 'my-test-build',
buildNumber: "${env.buildVersion}"
I use choice parameter to get buildversion. With this I'm able to download.
Now my requirement is how can I pass the value to pattern
I decalred variable as def jfrogrepo = "my-local-repo/test-${buildVersion}.tar"
I tried to call this variable as
"pattern" : "${jfrogrepo}"
"pattern" : jfrogrepo
None of it works.But on echoing the variable I'm getting correct output.
So is there a way to pass variable to pattern or is there any other way to download the artifacts by making use of the artifacory plugin.
–
there is difference in groovy for single/double quotes
i like this page
https://gist.github.com/Faheetah/e11bd0315c34ed32e681616e41279ef4
in quick
in single quotes variables will not be interpolated/evaluated. ${} this will not work
in double quotes vars ${} evaluated to actual value
env.
its global variable for jenkins pipeline treated as environment variable in sh script and global variable for jenkinsfile part of currentbuild object
parameters in pipeline used as ${params.VARIABLE}
see this
Why don't you use the CLI of JFrog for Jenkins? you can use Jfrog plugin for your purpose and after that you can add JFrog CLI as tools in JFrog artifactory, then you can use this command in Jenkinsfile and pipeline:
jf "rt dl my-local-repo/cool-froggy.zip"
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.