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

Unable to see the error for shell script

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Not A Defect
    • Icon: Blocker Blocker
    • _unsorted
    • None

       stage('Docker Publish to Registry') {
      steps {
      echo "Publishing to Docker: ${dockerRegistry}/${dockerImageRepo}:${dockerImageTag}"
      script {
      def passwordMask = [
      $class: 'MaskPasswordsBuildWrapper',
      varPasswordPairs: [[
      password: secrets.dtrToken
      ]]
      ]
      wrap(passwordMask) {
      sh """
      docker login --username ${secrets.dtrUsername} --password \"${secrets.dtrToken}\" ${dockerRegistry}
      statusCode=\$(curl -X POST -u ${secrets.dtrUsername}:${secrets.dtrToken} -H "Content-Type: application/json" -d '${JsonOutput.toJson(createRepoRequest)}' -o -I -L -s -w "%{http_code}" ${createRepoApi})
      if [ "\$statusCode" = '201' ]
      then
      echo 'Created docker repository with appropriate permissions.'
      else
      echo 'Create docker repository manually since auto create was not successful.'
      fi
      """
      dockerImage.push();
      }
      }
      }
      }
       Above is the stage I am trying to execute in my jenkins file.
       its only printing below line and stopped in console output.
       echo "Publishing to Docker: ${dockerRegistry}/${dockerImageRepo}:${dockerImageTag}"
       
       And its not printing  sh """docker login --username
       anything from this line 
       
       

       
       
       
       
       
       
       
       
      Send a message
       
       

            Unassigned Unassigned
            adilm Adil
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: