3
私は宣言型ジェンキンスパイプラインで次のステップを実行します: 私はresources/
フォルダからlibraryResourceを使用して作成されたスクリプトを作成します。このスクリプトには、私のautobuild
ユーザーとadmintest
ユーザーのための資格情報が含まれています。JenkinsパイプラインでwithCredentialsで複数の資格情報を使用する方法
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 "
}
}
}
これは問題なく動作します。私はautobuild
ユーザーを使用することができます。今私は私のadmintest
ユーザーのクレデンシャルをどのように含めることができるかを調べるための最善の方法を探しています。 2番目のwithCredentials
部分に「ネスト」する必要がありますか、usernamePassword
「配列」を再度追加することはできますか?