[JIRA] (JENKINS-57369) Docker build-args incorrectly rejected and successful build marked failed

26 views
Skip to first unread message

eli@treuherz.co.uk (JIRA)

unread,
May 8, 2019, 8:13:02 AM5/8/19
to jenkinsc...@googlegroups.com
Eli Treuherz created an issue
 
Jenkins / Bug JENKINS-57369
Docker build-args incorrectly rejected and successful build marked failed
Issue Type: Bug Bug
Assignee: Unassigned
Attachments: buildlog, Jenkinsfile
Components: docker-workflow-plugin
Created: 2019-05-08 12:12
Labels: docker
Priority: Major Major
Reporter: Eli Treuherz

Combination of two issues here.

  1. According to Docker's docs, running docker build --build-arg VARIABLE should be equivalent to docker build --build-arg VARIABLE=${VARIABLE}. However, the Docker Pipeline plugin throws an exception if this usage is passed to docker.build in a pipeline. (See attached Jenkinsfile and log).
  2. As shown in the log, these arguments are passed to the Docker client and the image builds fine. Only after this has happened is the exception logged and the build is marked as failed, despite the successful Docker build.

A workaround would be to just use --build-arg SSH_KEY="${env.SSH_KEY}", but as this would result in the private key being printed to the build logs I'm not really happy with that approach.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jack.peterson@gmail.com (JIRA)

unread,
May 14, 2019, 5:03:02 PM5/14/19
to jenkinsc...@googlegroups.com
Jack Peterson commented on Bug JENKINS-57369
 
Re: Docker build-args incorrectly rejected and successful build marked failed

I'm going to +1 this issue as a totally annoying problem here as I'm working on using Jenkins Dockerfiles that depend on an upstream private image as well as a private-key needing to be passed in in order to perform git clones of private repositories as part of a dependency management step in the primary Dockerfile. I too don't like how the credentials get displayed willy-nilly as soon as they become multiline parameters.

 

pipeline {
    agent none
...

   environment {
        GITHUB_SSH_PRIVATE_KEY=credentials('github_ssh_key')
        DOCKER_REGISTRY_CREDENTIALS=credentials('dockerhub')
    }
...
    stages {
        stage("run unit tests") {
            agent {
               dockerfile {
                   filename "Dockerfile"
                   additionalBuildArgs "--build-arg SSH_PRIVATE_KEY=\"${env.GITHUB_SSH_PRIVATE_KEY}\""
                   registryCredentialsId 'dockerhub'
               }
           }
           steps {
               sh '//commands run here'
           }

 

 

 

 

peter.niederlag@datenbetrieb.de (JIRA)

unread,
Jul 1, 2019, 4:57:03 AM7/1/19
to jenkinsc...@googlegroups.com

eli@treuherz.co.uk (JIRA)

unread,
Jul 1, 2019, 5:42:02 AM7/1/19
to jenkinsc...@googlegroups.com

Thanks for working on this Peter Niederlag. I've submitted some comments on the PR

peter.niederlag@datenbetrieb.de (JIRA)

unread,
Jul 1, 2019, 6:54:02 AM7/1/19
to jenkinsc...@googlegroups.com

Thx for your feedback Eli Treuherz I tried to reply yor comments in code. It seems IsMapWithSize is not available without further work (hamcrest 1.3 limit?). I'd suggest to keep changes on the tests in line with all tests in the class.

It'd be very great if someone with insight could check on handling the value on the argMap https://github.com/jenkinsci/docker-workflow-plugin/pull/178#pullrequestreview-256220189

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 2, 2019, 5:41:06 PM8/2/19
to jenkinsc...@googlegroups.com
Devin Nusbaum resolved as Fixed
 

A fix for this issue was just released in Docker Pipeline plugin version 1.19. From the release notes: 

Deprecate the dockerFingerprintFrom and dockerFingerprintRun steps and stop calling them during docker.build and image.run. Fixes various issues with Dockerfile parsing and parsing arguments to docker build.

Change By: Devin Nusbaum
Status: Open Resolved
Resolution: Fixed
Released As: docker-workflow 1.19
Reply all
Reply to author
Forward
0 new messages