You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Be able to set the seed-job-agent to "Only build jobs with label expression matching this node"
Be able to scale the number of executors on the seed-job-agent
The reason behind this is that we have many multibranch pipelines which are pointing to Jenkinsfiles without any requirements of using node labels. We only use labels if they need to use a special node that is not on the "golden path". On the Jenkins server we decide which agents should be used as much as possible.
Describe alternatives you've considered
Since the seed-job is by default labeled/restricted to use "seed-job-agent", I think the agent could be set to only build the jobs with matching labels, or at least an option to set these settings.
I have tested to do this with the following groovy script added to "groovyScripts" without any success:
apiVersion: v1kind: ConfigMapmetadata:
name: seed-job-agentdata:
seed-job-agent.groovy: |2 import jenkins.model.Jenkins import hudson.model.Node.Mode def agentName = 'seed-job-agent' def newExecutors = 1 def agent = Jenkins.instance.getNode(agentName) if (agent != null) { agent.setNumExecutors(newExecutors) agent.setMode(Mode.EXCLUSIVE) agent.save() println("The number of executors for agent '${agentName}' has been set to ${newExecutors} and configuration saved.") Jenkins.instance.reload() }
Additional context
There may be use-cases I haven't thought through
The text was updated successfully, but these errors were encountered:
I dug into this one a bit and it seems like the goclient package hasn't been updated in a bit. There's an open PR for it at bndr/gojenkins#315 that would allow us to specify the mode as Exclusive instead of Normal to accomplish this task.
Given that the PR hasn't been merged in a year, I can take a look at if there would be a workaround for this, like running a script on the jenkins node after agent creation to set the mode instead.
lavigneer
added a commit
to lavigneer/jenkins-kubernetes-operator
that referenced
this issue
Nov 26, 2024
Describe the solution you'd like
The reason behind this is that we have many multibranch pipelines which are pointing to Jenkinsfiles without any requirements of using node labels. We only use labels if they need to use a special node that is not on the "golden path". On the Jenkins server we decide which agents should be used as much as possible.
Describe alternatives you've considered
Since the seed-job is by default labeled/restricted to use "seed-job-agent", I think the agent could be set to only build the jobs with matching labels, or at least an option to set these settings.
I have tested to do this with the following groovy script added to "groovyScripts" without any success:
Additional context
There may be use-cases I haven't thought through
The text was updated successfully, but these errors were encountered: