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

Support for dynamic/conditional agent definition

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: pipeline
    • Labels:
      None
    • Similar Issues:

      Description

      We have a common pipeline which our devs use - they provide some configuration parameters, and it runs a set of common steps (build, test, upload etc.). In our Linux environment we use containers to define the build environment, but on Windows we have resorted to VMs (as Windows Docker doesn't offer the support we need).

      With the current implementation of declarative pipelines, where agents are defined statically (upfront), we have to duplicate this code, which leads to extra maintenance and issues when they get out of sync. It would be nice if there was a way to define an agent dynamically/conditionally so that the same pipeline stages could be used, regardless of if Jenkins runs the steps inside a container (or not).

        Attachments

          Activity

          Hide
          tavin Tavin Cole added a comment -

          I was trying to get someone interested in this PR as a first step: https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/387

          The idea is to develop an annotation-based mechanism to pull in code snippets from other files, e.g.:

          pipeline {
          
              agent { ... }
          
              @Include('stages.groovy')
              stages
          }
          
          Show
          tavin Tavin Cole added a comment - I was trying to get someone interested in this PR as a first step: https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/387 The idea is to develop an annotation-based mechanism to pull in code snippets from other files, e.g.: pipeline { agent { ... } @Include( 'stages.groovy' ) stages }
          Hide
          canuck1987 Tim Brown added a comment -

          > I was trying to get someone interested in this PR as a first step: https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/387

          Looks like it would solve my use case - and probably others too. Seems to be a better (more generic) fix than the one I suggested .

          Show
          canuck1987 Tim Brown added a comment - > I was trying to get someone interested in this PR as a first step: https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/387 Looks like it would solve my use case - and probably others too. Seems to be a better (more generic) fix than the one I suggested .

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            canuck1987 Tim Brown
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: