Skip to content

[JENKINS-70734] Add an optional agent type to declarative Pipeline #1467

@jenkins-infra-bot

Description

@jenkins-infra-bot

please enable a feature of optional selection of the agent type. So the same job could run according to the selected type as a parameter, something like that:

  when {
        expression { params.AGENT_TYPE == 'kubernetes' }
    }
  agent {
        kubernetes {defaultContainer 'my_k8s_template'}
    }
  when {
        expression { params.AGENT_TYPE == 'label' }
    }
    agent {
        label 'my_label'
    } 

 


Originally reported by dancho80, imported from: Add an optional agent type to declarative Pipeline
  • assignee: abdo123321
  • status: Open
  • priority: Minor
  • component(s): pipeline-model-definition-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 2025-12-06
Raw content of original issue

please enable a feature of optional selection of the agent type. So the same job could run according to the selected type as a parameter, something like that:

  when {
        expression { params.AGENT_TYPE == 'kubernetes' }
    }
  agent {
        kubernetes {defaultContainer 'my_k8s_template'}
    }
  when {
        expression { params.AGENT_TYPE == 'label' }
    }
    agent {
        label 'my_label'
    } 

 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions