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

No way to specify build-args for dockerfile

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      It looks like there is no way to specify some build args (--build-arg parameter for docker build) to build an image using the "dockerfile" option. It supports "args", but only to pass to subsequents docker run calls.

      pipeline {
        agent {
          dockerfile {
            filename 'foo/Dockerfile'
            args: '--privileged'
          }
        }
      }

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -
            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/136,  aiming at 1.2 release.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java
            pipeline-model-definition/src/test/resources/additionalDockerBuildArgs.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/04206b8d9122a9b87a0352ce963730212baaa919
            Log:
            [FIXED JENKINS-42693] Add additionalBuildArgs dockerfile parameter

            Allows specifying like
            dockerfile {
            additionalBuildArgs "--build-arg someArg=someValue"
            }
            which will get added to the "docker build ..." command line call.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfile.java pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineFromDockerfileScript.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AgentTest.java pipeline-model-definition/src/test/resources/additionalDockerBuildArgs.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/04206b8d9122a9b87a0352ce963730212baaa919 Log: [FIXED JENKINS-42693] Add additionalBuildArgs dockerfile parameter Allows specifying like dockerfile { additionalBuildArgs "--build-arg someArg=someValue" } which will get added to the "docker build ..." command line call.
            Show
            jouve Cyril Jouve added a comment - Hi, The feature is great but not documented. I looked here: https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki https://jenkins.io/doc/ https://www.google.fr/search?q=jenkins+pipeline+additionalBuildArgs  
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            content/doc/book/pipeline/syntax.adoc
            http://jenkins-ci.org/commit/jenkins.io/3c7f637f5b6e967e5da73b6dae1981e4bd449b30
            Log:
            JENKINS-42693 Add 'additionalBuildArgs' dockerfile option

            I'm not sure about the formatting - how do we want to handle/display
            multiple options for agent types?

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: content/doc/book/pipeline/syntax.adoc http://jenkins-ci.org/commit/jenkins.io/3c7f637f5b6e967e5da73b6dae1981e4bd449b30 Log: JENKINS-42693 Add 'additionalBuildArgs' dockerfile option I'm not sure about the formatting - how do we want to handle/display multiple options for agent types?
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Liam Newman
            Path:
            content/doc/book/pipeline/syntax.adoc
            http://jenkins-ci.org/commit/jenkins.io/e21249db275be9a02f02bb9403ee40820ff6f3b6
            Log:
            Merge pull request #751 from abayer/jenkins-42693

            JENKINS-42693 Add 'additionalBuildArgs' dockerfile option

            Compare: https://github.com/jenkins-infra/jenkins.io/compare/5f52f0166cb2...e21249db275b

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Liam Newman Path: content/doc/book/pipeline/syntax.adoc http://jenkins-ci.org/commit/jenkins.io/e21249db275be9a02f02bb9403ee40820ff6f3b6 Log: Merge pull request #751 from abayer/jenkins-42693 JENKINS-42693 Add 'additionalBuildArgs' dockerfile option Compare: https://github.com/jenkins-infra/jenkins.io/compare/5f52f0166cb2...e21249db275b

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                nervo nervo nervo
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: