我有一個腳本,其中一部分是:
我有一個腳本,其中一部分是:
stage('plan' ) {
withCredentials([
[$class: 'AmazonWebServicesCredentialsBinding', credentialsId: aws_cred_id,
accessKeyVariable。'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']】) {
string(credentialsId: 'xxxxcredx', variable: 'TF_VAR_token') {
docker.withRegistry('https://registry-1.docker.io/', 'dockerhub-creds') {
現在,當這個在Jenkins中運行時,我看到的輸出是:
java.lang. IllegalArgumentException: 期待命名的引數,但得到[{credentialsId=xxxxcredx, variable=TF_VAR_token}, org. jenkinsci.plugins.workflow.cps.CpsClosure2]
我怎樣才能修復或修改我的腳本,使其不出現這種錯誤,并讓Jenkins選擇憑證和var值。
uj5u.com熱心網友回復:
我相信它應該是這樣的(無法檢查)
credentials-binding docs。https://www.jenkins.io/doc/pipeline/steps/credentials-binding/withCredentials([
aws(credentialsId: aws_cred_id, accessKeyVariable: 'AWS_ACCESS_KEY_ID', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY')。)
string(credentialsId: 'xxxxcredx', variable: 'TF_VAR_token')。)
]) {
docker.withRegistry ...
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/318083.html
標籤:
