I have the following step in my declarative jenkins pipeline:
I create script which comes from my resources/ folder using libraryResource. This script contains credentials for my autobuild user and for some admintest user.
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 "
                        }
                    }
                }   
This works fine. I can use my autobuild user. Now I'm searching for the best way how I can include also the crendentials of my admintest user.
Do I have to 'nest' it with a second withCredentials part or can I add again a usernamePassword 'array'?
 
     
     
    