jenkinsci / jenkinsci/docker-workflow-plugin

[JENKINS-50687] When using docker.withRegistry withEnv repeats indefinitely.

Open
#561 3 comments 0 reactions 0 assignees View on GitHub
component:docker-workflow-plugin component:workflow-cps-plugin imported-jira-issue priority:blocker resolution:unresolved
Dominant language
Java
Stars
527
Forks
422
Avg merge
10m
Merged PRs (30d)
1

Description

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)

```

---
Originally reported by ahaaf, imported from: When using docker.withRegistry withEnv repeats indefinitely.


  • status: Open
  • priority: Blocker
  • component(s): docker-workflow-plugin, workflow-cps-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 2025-12-07

Raw content of original issue

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)

environment

```
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

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.