Computer Science, asked by shrinivasab97, 4 months ago

What will the below mentioned syntax do while running a Jenkins pipeline?
agent [ label 'slave' ]


Choose the best option

1. It will execute the pipeline on Jenkins master node.

2.It will create a node with label slave

3.It will execute the pipeline on Jenkins slave.

4.It will create a workspace named slave​

Answers

Answered by Anonymous
0

Answer:

Explanation:

My Jenkins pipeline randomly alternates between running on master and on agent (slave) machines.

The whole pipeline has only one agent statement, thus:

pipeline {

 agent any

How can I get the build to run in load-balanced agents, and never master?

Maybe it could be done with agent { label 'some-label' }. Is there a predefined label that specifies agents and not master? Or do I have to label all agents myself?

This and this show how to choose a specific agent, but I want random balancing between agent machines.

This question discusses agent any vs agent none, but neither of those blocks the master from being used.

This page recommends wrapping everything in a node stanza, but that seems to force the build to run on master or a specified node, which again does not allow balancing of agents.

Similar questions