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

Make jenkins agent more flexible #1602

Merged
merged 8 commits into from
Sep 11, 2024

Conversation

Vlatombe
Copy link
Member

@Vlatombe Vlatombe commented Sep 5, 2024

  • The name of the agent container can now be customized (the jnlp deprecated name is no longer required)
  • It is no longer required to extend the jenkins inbound-agent image anymore, or provide the agent.jar in the image. Custom images only need to provide a JRE, and required build tools.

One example of usage

podTemplate(agentContainer:'foo',
            agentInjection: true,
            yaml:'''
spec:
  containers:
  - name: foo
    image: eclipse-temurin:22.0.2_9-jre
''') {
  node(POD_LABEL) {
    sh 'true'
  }
}

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

* The name of the agent container can now be customized (the `jnlp` deprecated name is no longer required)
* It is no longer required to extend the jenkins inbound-agent image anymore, or provide the agent.jar in the image. Custom images only need to provide a JRE, and required build tools.
@Vlatombe Vlatombe changed the title jenkins agent injection Make jenkins agent more flexible Sep 5, 2024
@Vlatombe Vlatombe added the enhancement Improvements label Sep 5, 2024
@Vlatombe Vlatombe requested a review from jglick September 5, 2024 15:23
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising! Now we just need to find a statically-linked JRE we can copy in as well…

@Vlatombe
Copy link
Member Author

Vlatombe commented Sep 9, 2024

we just need to find a statically-linked JRE we can copy in as well…

Not sure it exists yet
https://bugs.openjdk.org/browse/JDK-8303796

@Vlatombe Vlatombe marked this pull request as ready for review September 9, 2024 08:45
@Vlatombe Vlatombe requested a review from a team as a code owner September 9, 2024 08:45
@Vlatombe Vlatombe requested a review from jglick September 9, 2024 15:32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the change in this case is more confusing than helpful? It destroys the parallelism between the containers.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What parallelism ? You still have a maven and a golang container, the only difference is that the jnlp container is gone.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right but you are using both of these containers for similar purposes—running selected build steps—yet one is being used as the agent container merely because its toolchain happens to include a JRE.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as long as you have a JRE in the toolchain and you can avoid container step (and associated scalability issues), I think it is good.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vlatombe
Copy link
Member Author

master/README.md#multiple-containers-support should be updated too?

Done

@Vlatombe Vlatombe enabled auto-merge (squash) September 11, 2024 12:04
@Vlatombe Vlatombe merged commit 7345138 into jenkinsci:master Sep 11, 2024
8 checks passed
@Vlatombe Vlatombe deleted the jenkins-agent-injection branch September 11, 2024 13:32
@balakine
Copy link

I don't think this should be called done https://github.com/jenkinsci/kubernetes-plugin/blob/master/README.md

Within these pods, there is always one special container jnlp that is running the Jenkins agent.

Not true

Commands will be executed by default in the jnlp container

Not true

Multiple containers can be defined in a pod. One of them is automatically created with name jnlp, ...

Not true

If you want to provide your own Docker image for the inbound agent, you must name the container jnlp so it overrides the default one.

Not true

@Vlatombe
Copy link
Member Author

@balakine Feel free to provide a pull request to fix these

@balakine
Copy link

If only the author of the change that rendered the documentation obsolete was still in the room...

@Vlatombe
Copy link
Member Author

I'm sorry, but your comment, even if true, was rude. If you are unsatisfied, please help yourself.

@balakine
Copy link

I apologize for hurting your feelings. You are spending your personal time for a project I benefit from, so I should be choosing kinder words and comment in a more constructive manner.

Vlatombe added a commit to Vlatombe/kubernetes-plugin that referenced this pull request Sep 17, 2024
Following jenkinsci#1602, there are several sentences in the README that can be
made more generic, avoiding references to `jnlp`. As it is still the
default value, I couldn't remove all references, but I think it is
slightly clearer now.
Vlatombe added a commit that referenced this pull request Sep 18, 2024
* Update README with agent injection in mind

Following #1602, there are several sentences in the README that can be
made more generic, avoiding references to `jnlp`. As it is still the
default value, I couldn't remove all references, but I think it is
slightly clearer now.

* Fix review and refresh pod template screenshot

* Refresh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants