Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to set the seed-job-agent to "Only build jobs with label expression matching this node" #1014

Open
renovate-eika opened this issue May 16, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers needs triage not-stale

Comments

@renovate-eika
Copy link

renovate-eika commented May 16, 2024

Describe the solution you'd like

  • 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: v1
kind: ConfigMap
metadata:
  name: seed-job-agent
data:
  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

@renovate-eika renovate-eika added the enhancement New feature or request label May 16, 2024
@brokenpip3
Copy link
Collaborator

Like I said in the operator chat this is something that we should add, the change is not complex and needs to be done here.

Any PR is welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers needs triage not-stale
Projects
None yet
Development

No branches or pull requests

2 participants