[JIRA] (JENKINS-60863) Pipeline fails on error within a sh command

4 views
Skip to first unread message

1codingmonkey@gmail.com (JIRA)

unread,
Jan 25, 2020, 3:14:04 AM1/25/20
to jenkinsc...@googlegroups.com
Coding Monkey created an issue
 
Jenkins / Bug JENKINS-60863
Pipeline fails on error within a sh command
Issue Type: Bug Bug
Assignee: Unassigned
Components: pipeline
Created: 2020-01-25 08:13
Environment: Jenkins ver. 2.176.3
Priority: Blocker Blocker
Reporter: Coding Monkey

I wrote a Jenkins pipeline to copy remote images to the OpenShift repository with skopeo. Unfortunately I can't make the pipeline run due to a "unable to retrieve auth token: 401 unauthorized" error which quits the pipeline. However using the same command in the terminal works fine.

So my guess is that Jenkins interpretes an error "{{Ping https://docker-registry.default.svc:5000/v2/ status 401" }}to fail and stop the whole command, while when I run the command in the terminal it shows the same message but continues and finish successfully.

My pipeline step:

sh """ 
   skopeo --tls-verify=false --debug inspect -- creds='${dest_user}:${dest_pw}' docker://${registry}/${namespace}/image:${build} 
"""

The Jenkins pipeline output from the skopeo inspect call:

time="2020-01-24T21:22:39Z" level=debug msg="Using registries.d directory /etc/containers/registries.d for sigstore configuration"
time="2020-01-24T21:22:39Z" level=debug msg=" No signature storage configuration found for docker-registry.default.svc:5000/path/image:latest"
time="2020-01-24T21:22:39Z" level=debug msg="GET https://docker-registry.default.svc:5000/v2/"
time="2020-01-24T21:22:39Z" level=debug msg="Ping https://docker-registry.default.svc:5000/v2/ err "
time="2020-01-24T21:22:39Z" level=debug msg="Ping https://docker-registry.default.svc:5000/v2/ status 401"
time="2020-01-24T21:22:39Z" level=fatal msg="unable to retrieve auth token: 401 unauthorized"

Then quits!

While in the terminal I see the same ping with "status 401", but it continues:

skopeo --tls-verify=false --debug inspect --creds=":" docker://docker-registry.default.svc:5000/path/image:latest
DEBU[0000] Using registries.d directory /etc/containers/registries.d for sigstore configuration
DEBU[0000] No signature storage configuration found for docker-registry.default.svc:5000/path/image:latest
DEBU[0000] GET https://docker-registry.default.svc:5000/v2/
DEBU[0000] Ping https://docker-registry.default.svc:5000/v2/ err
DEBU[0000] Ping https://docker-registry.default.svc:5000/v2/ status 401
DEBU[0000] GET https://docker-registry.default.svc:5000/v2/path/image/manifests/latest
DEBU[0000] Downloading path/image-ui/blobs/sha256:ab3917277e589c0515309dde9c623746f32bb93c2a5afc9027a873c9bd0b0660c
......

So something in Jenkins must force the command to stop. How can I avoid this and make Jenkins handle the command like it would be run from the Terminal.

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

1codingmonkey@gmail.com (JIRA)

unread,
Jan 25, 2020, 12:50:02 PM1/25/20
to jenkinsc...@googlegroups.com
Coding Monkey closed an issue as Not A Defect
Change By: Coding Monkey
Status: Open Closed
Resolution: Not A Defect
Reply all
Reply to author
Forward
0 new messages