Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-66138

Matrix with docker agent throwing bad creds error

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • other
    • None

      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 :

            Unassigned Unassigned
            gowthamakanthan gowthamakanthan gopal
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: