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

When using docker.withRegistry withEnv repeats indefinitely.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • None
    • Jenkins ver. 2.107.1
      java.runtime.name OpenJDK Runtime Environment
      java.runtime.version 1.8.0_162-8u162-b12-1~deb9u1-b12
      OS: Debian Stretch 64bit

      I'm currently using a very simple Jenkinsfile to push a container to amazon ECR.

      node {
        checkout scm
      
        docker.withRegistry("https://${org_id}.dkr.ecr.us-west-2.amazonaws.com", "ecr:us-west-2:aws-jenkins-user") {
          def image = docker.build("convertus/ansible:${env.BUILD_ID}")
          image.push(env.BRANCH_NAME)
          if (env.BRANCH_NAME == 'master') {
            image.push('latest')
            image.push()
          }
        }
      }
      

      However when this happens, I get the following:

      Started by user _____
      Obtained Jenkinsfile from 4090a2fbd4e0dc03c42bc38b346e32dabaa1bf93
      Running in Durability level: PERFORMANCE_OPTIMIZED
      Loading library JenkinsLib@master
      Attempting to resolve master from remote references...
       > git --version # timeout=10
      using GIT_SSH to set credentials Jenkins Bitbucket SSH Key
       > git ls-remote -h -t git@bitbucket.org:myorg/jenkinslib.git # timeout=10
      Found match: refs/heads/master revision e9e1485e32123f462de79d7fa898fddf232455fb
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url git@bitbucket.org:myorg/jenkinslib.git # timeout=10
      Fetching without tags
      Fetching upstream changes from git@bitbucket.org:myorg/jenkinslib.git
       > git --version # timeout=10
      using GIT_SSH to set credentials Jenkins Bitbucket SSH Key
       > git fetch --no-tags --progress git@bitbucket.org:myorg/jenkinslib.git +refs/heads/*:refs/remotes/origin/*
      Checking out Revision e9e1485e32123f462de79d7fa898fddf232455fb (master)
       > git config core.sparsecheckout # timeout=10
       > git checkout -f e9e1485e32123f462de79d7fa898fddf232455fb
      Commit message: "Pull the "use our AWS Registry" into a seperate function"
       > git rev-list --no-walk e9e1485e32123f462de79d7fa898fddf232455fb # timeout=10
      [Bitbucket] Notifying commit build result
      [Pipeline] node
      Running on Jenkins in /var/lib/jenkins/jobs/myorg/jobs/ansible/branches/master/workspace
      [Pipeline] {
      [Pipeline] checkout
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url https://bitbucket.org/myorg/ansible.git # timeout=10
      Fetching without tags
      Fetching upstream changes from https://bitbucket.org/myorg/ansible.git
       > git --version # timeout=10
      using GIT_ASKPASS to set credentials Aaron Haaf's PW and stuff.
       > git fetch --no-tags --progress https://bitbucket.org/myorg/ansible.git +refs/heads/master:refs/remotes/origin/master
      Checking out Revision 4090a2fbd4e0dc03c42bc38b346e32dabaa1bf93 (master)
       > git config core.sparsecheckout # timeout=10
       > git checkout -f 4090a2fbd4e0dc03c42bc38b346e32dabaa1bf93
      Commit message: "Now the cows are baked right in the container for freshness."
       > git rev-list --no-walk 4090a2fbd4e0dc03c42bc38b346e32dabaa1bf93 # timeout=10
      [Bitbucket] Notifying commit build result
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] withEnv
      [Pipeline] {
      [Pipeline] withEnv
      [Pipeline] {
      //loops forever
      

      The wierd thing is that it worked last Thursday, but ended up not working this morning. I'm unsure what changed that would cause this to happen.

      It used to cause a StackOverflowError like the following until I updated the assorted Pipeline: Groovy plugin patches (v2.47). Now it just seems to loop indefinitely until canceled.

      java.lang.StackOverflowError
      	at java.lang.reflect.Field.get(Field.java:393)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:988)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:967)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:854)
      	at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1032)
      

            Unassigned Unassigned
            ahaaf Aaron Haaf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: