-
Epic
-
Resolution: Unresolved
-
Major
-
-
Declarative - 1.2, Pipeline - December, Pipeline - April 2018
Goals
- We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author
- We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc)
- We want customers to try this new implementation without having to use patched plugins or special builds from a branch
Scope
- Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline
- The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2
- Must be able to use an off the shelf docker container without modifying it so it works with Jenkins
- Honour the entry point of the container
- Sharing the workspace from the top level agent to a per stage Docker agent (and back again!)
Out of scope
- Declarative Docker agent directive that specifies a Dockerfile
- Scripted docker.inside
- Scripted docker.build
- Building containers
- Linked containers
- Caching directories
Acceptance criteria
The following steps should work using the new implementation (even if modifications are needed to these steps):
- withMaven()
- dir()
- withCredentials
The following functionality should work:
- Tool installers
- Config File Provider
Examples
Per stage
pipeline {
options {
dockerPipelineVersion(2)
}
agent none // Will not reuse workspace
stages {
stage (‘build’) {
agent { docker ‘maven3’ }
steps {
sh ‘mvn clean test’
}
}
}
}
Whole Pipeline
pipeline {
options {
dockerPipelineVersion(2)
}
agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified
stages {
stage (‘build’) {
steps {
sh ‘mvn clean test’
}
}
}
}
- is related to
-
JENKINS-48284 pipeline-maven 3.0.3 update issues with certain maven plugins.
-
- Open
-
-
JENKINS-47823 withMaven fails to inject Maven settings files with docker-pipeline 1.14
-
- Closed
-
-
JENKINS-48135 kubernetes-plugin should support multiple containers in declarative templates
-
- Resolved
-
- relates to
-
JENKINS-47805 withMaven doesn't copy settings.xml to Docker container
-
- Closed
-
-
JENKINS-48460 When starting a node with dockerNode(), the error "uri was not specified" is thrown
-
- Open
-
-
JENKINS-40484 Unable to use withMaven() step inside docker container for old versions of Docker
-
- Reopened
-
-
JENKINS-36776 Support Windows Server Containers
-
- Resolved
-
-
JENKINS-58732 Invert pipeline-model-definition → docker-workflow dependency
-
- Resolved
-
- links to
[JENKINS-48050] Replace Declarative Docker agent directive with new implementation
Epic Link | New: JENKINS-47962 [ 186491 ] |
Description |
Original:
*Goal* We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author. _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins. *Out of scope* * Declarative Docker agent directive that specifies a Dockerfile * Scripted {{docker.inside}} * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * withMaven() * dir() |
New:
*Goal* We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author. _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a Dockerfile * Scripted {{docker.inside}} * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * withMaven() * dir() |
Description |
Original:
*Goal* We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author. _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a Dockerfile * Scripted {{docker.inside}} * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * withMaven() * dir() |
New:
*Goal* We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author. We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc) *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a Dockerfile * Scripted {{docker.inside}} * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * withMaven() * dir() *Examples* _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} |
Description |
Original:
*Goal* We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author. We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc) *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a Dockerfile * Scripted {{docker.inside}} * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * withMaven() * dir() *Examples* _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} |
New:
*Goal* We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author. We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc) *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a {{Dockerfile}} * Scripted {{docker.inside}} * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * {{withMaven()}} * {{dir()}} *Examples* _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} |
Description |
Original:
*Goal* We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author. We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc) *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a {{Dockerfile}} * Scripted {{docker.inside}} * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * {{withMaven()}} * {{dir()}} *Examples* _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} |
New:
*Goal* We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author. We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc) *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a {{Dockerfile}} * Scripted {{docker.inside}} * Scripted {{docker.build}} * Building containers * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * {{withMaven()}} * {{dir()}} *Examples* _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} |
Description |
Original:
*Goal* We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author. We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc) *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a {{Dockerfile}} * Scripted {{docker.inside}} * Scripted {{docker.build}} * Building containers * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * {{withMaven()}} * {{dir()}} *Examples* _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} |
New:
*Goals* * We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author * We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc) * We want customers to try this new implementation without having to use patched plugins or special builds from a branch *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a {{Dockerfile}} * Scripted {{docker.inside}} * Scripted {{docker.build}} * Building containers * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * {{withMaven()}} * {{dir()}} *Examples* _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} |
Description |
Original:
*Goals* * We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author * We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc) * We want customers to try this new implementation without having to use patched plugins or special builds from a branch *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a {{Dockerfile}} * Scripted {{docker.inside}} * Scripted {{docker.build}} * Building containers * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * {{withMaven()}} * {{dir()}} *Examples* _Per stage_ {code} pipeline { options { dockerPipelineVersion: 2 } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion: 2 } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} |
New:
*Goals* * We want to have a new implementation for running steps inside a Docker container that is transparent to the Pipeline author * We want to ensure that as this developed that we start making changes that allow us to swap out the implementation in the future (e.g. docker, k8, etc) * We want customers to try this new implementation without having to use patched plugins or special builds from a branch *Scope* * Declarative Docker agent directive can be used to run steps for a stage or for the whole pipeline * The new implementation can be enabled by specifying Pipeline->Options->dockerPipelineVersion = 2 * Must be able to use an off the shelf docker container without modifying it so it works with Jenkins * Honour the entry point of the container *Out of scope* * Declarative Docker agent directive that specifies a {{Dockerfile}} * Scripted {{docker.inside}} * Scripted {{docker.build}} * Building containers * Linked containers *Acceptance criteria* The following steps should work using the new implementation (even if modifications are needed to these steps): * {{withMaven()}} * {{dir()}} *Examples* _Per stage_ {code} pipeline { options { dockerPipelineVersion(2) } agent none // Will not reuse workspace stages { stage (‘build’) { agent { docker ‘maven3’ } steps { sh ‘mvn clean test’ } } } } {code} _Whole Pipeline_ {code} pipeline { options { dockerPipelineVersion(2) } agent { docker ‘maven3’ } // will reuse workspace for all stages unless specified stages { stage (‘build’) { steps { sh ‘mvn clean test’ } } } } {code} |
Component/s | New: pipeline-model-definition-plugin [ 21706 ] |
A couple more criteria I’d like to suggest:
The scope here also doesn’t address the question of sharing the workspace from the top level agent to a per stage Docker agent (and back again!). I think that’s important and should be retained, but not as important as the lack of additional master configuration.