Matrix with docker agent throwing bad creds error

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Team,

      Am trying to use the docker agent(to pull mvn image) to execute the test parallelly with Matrix. Which is throwing "Bad props auth-token:" error for some of the axis and working fine for others. Any suggestions, please?

      Method 1:

      stage('Serenity') {
            matrix {
              agent {
                docker {
                  reuseNode true
                  image "${MVN_IMAGE_NAME}"
                  args '-v $WORKSPACE:/usr/src/app'
                 }
              }
              axes {
                axis {
                  name 'STORY_BATCH'
                  values 1,2,3,4,5,6
                }
              }
              stages {
                stage ('Matrix Docker login') {
                  steps {
                    withCredentials([usernamePassword(credentialsId: 'dockerhub-deployer', passwordVariable: 'DOCKERHUB_PASSWORD', usernameVariable: 'DOCKERHUB_USERNAME')]) {
                      sh "docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD ${env.DOCKERHUB_HOST}"
                    }
                  }
                }
                stage('Java Tests') {
                  steps {
                    dir('tests/bdd/java') {
                      sh "mvn -B -Pprovided clean verify -Dstory.batch=${STORY_BATCH}"
                    }
                  }
                }
              }
            }
          }
      

      Method 2:

       stage('Serenity') {
              matrix {
                agent {
                  docker {
                    reuseNode true
                    image "${MVN_IMAGE_NAME}"
                    args '-v $WORKSPACE:/usr/src/app'
                    registryUrl 'https://dockerhub.cisco.com'
                    registryCredentialsId 'dockerhub-xse-deployer'
                  }
                }
                axes {
                  axix {
                    name 'STORY_BATCH'
                    values 1,2,3,4,5,6
                  }
                }
                stages {
                  stage('Docker login for Mvn'){
                    steps {
                        sh "mvn --version"
                        sh "echo ${STORY_BATCH}"              }
                  }
                }
              }
            }  
          }
      

      Error :

            Assignee:
            Unassigned
            Reporter:
            gowthamakanthan gopal
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: