I have some shell script as like below
echo $BUILD_NUMBER
echo $GIT_BRANCH
echo $SUNNY
How to copy the snippet to created job using dsl script? I know we can achieve it by shell(readFileFromWorkspace('build.sh'))
But is there anyway copy the script using dsl script instead of providing using a .sh file?
There are three ways to configure a shell step.
you can use a script from the seed job's workspace as in your example
job('example') { steps { shell(readFileFromWorkspace('build.sh')) } }
you can use an inline script
job('example') { steps { shell('''echo $BUILD_NUMBER echo $GIT_BRANCH echo $SUNNY''') } }
you can call a script in the generated job's workspace
job('example') { steps { shell('./build.sh') } }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.