I have the next step in my declarative jenkins project: I am creating a script that comes from my folder resources/using libraryResource. This script contains credentials for my user autobuildand for some user admintest.
stage('Build1') {
steps {
node{
def script = libraryResource 'tests/test.sh'
writeFile file: 'script.sh', text: script
sh 'chmod +x script.sh'
withCredentials([usernamePassword(credentialsId: xxx, usernameVariable: 'AUTOBUILD_USER', passwordVariable: 'AUTOBUILD_PASSWD')]){
sh './script.sh "
}
}
}
It works great. I can use my user autobuild. Now I am looking for the best way how I can also include my user capabilities admintest. Should I "nest" it with the second part, withCredentialsor can I add an array again usernamePassword?
source
share