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

Latest docker image is not pulled when used within stage

    Details

    • Similar Issues:

      Description

      When a docker image is used as an agent at the pipeline level, `image.pull()` is called automatically to check for a newer version. E.g.:

      pipeline {
        agent { docker 'microsoft/dotnet' }
        stages {
          stage('x') {
            steps {
              sh '...'
            }
          }
        }
      }
      

      However, when a docker image is used as an agent at the stage level, `image.pull()` is never called, so potentially old images are used instead.E.g.:

      pipeline {
        agent none
        stages {
          stage('x') {
            agent { docker 'microsoft/dotnet' }
            steps {
              sh '...'
            }
          }
        }
      }
      

      Is it possible to automatically call `image.pull()` as well, or at least provide an option flag to state you want this behaviour?

      I believe the code that affects this is: https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/824b3b7a96cc9d4fc6fc636caccaed3d39343cfd/pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/agent/impl/DockerPipelineScript.groovy#L42

        Attachments

          Issue Links

            Activity

            chris5287 Chris Stylianou created issue -
            abayer Andrew Bayer made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            abayer Andrew Bayer made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            abayer Andrew Bayer made changes -
            Remote Link This issue links to "PR #182 (Web Link)" [ 17476 ]
            abayer Andrew Bayer made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            scottles Scott Hilleard made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            chris5287 Chris Stylianou made changes -
            Status Reopened [ 4 ] Open [ 1 ]
            chris5287 Chris Stylianou made changes -
            Status Open [ 1 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                chris5287 Chris Stylianou
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: