Latest docker image is not pulled when used within stage

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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

            Assignee:
            Andrew Bayer
            Reporter:
            Chris Stylianou
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: