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

Recipe for Jenkinsfile updates #531

Open
jonesbusy opened this issue Dec 29, 2024 · 7 comments
Open

Recipe for Jenkinsfile updates #531

jonesbusy opened this issue Dec 29, 2024 · 7 comments
Labels
enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted

Comments

@jonesbusy
Copy link
Collaborator

What feature do you want to see added?

Right now the recipes doesn't override the Jenkinsfile in order to not alternate exotic configuration.

We need more logic here when we modernize a plugin. For example

  • Add a java version with platform
  • remove totally a java version
  • add first level args, like useContainerAgent

Etc.

See already groovy visitor that extract such information

Upstream changes

None

Are you interested in contributing this feature?

None

@jonesbusy jonesbusy added the enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Jan 4, 2025
@jonesbusy
Copy link
Collaborator Author

jenkins-infra/pipeline-library#897

As information related to implicit settings

@basil
Copy link

basil commented Jan 8, 2025

add first level args, like useContainerAgent

But only if the plugin is not running Docker-based tests. A few previous modernization PRs incorrectly added useContainerAgent and accidentally disabled Docker-based tests.

@jonesbusy
Copy link
Collaborator Author

@basil Thanks, do you have any example of such recent PR ?

The current state is to not overwrite anything if a Jenkinsfile is present until we have logic :

I think we should be able to detect such types (pom, import) to know detect if we are using docker tests or not

The idea behind openrewrite is not not do any destructive changes (For example a Jenkinsfile adding configuration like https://github.com/jenkinsci/warnings-ng-plugin/blob/main/Jenkinsfile#L9-L11 should not lost it's information

@basil
Copy link

basil commented Jan 9, 2025

@basil Thanks, do you have any example of such recent PR ?

An example is jenkinsci/saml-plugin#157, which (incorrectly) set useContainerAgent: true, thereby disabling Docker-based testing. I set useContainerAgent: false in jenkinsci/saml-plugin#446 and confirmed that LiveTest was again running in CI builds. Fortunately, the test had not regressed during that time!

To be clear, it is always* OK to add an explicit useContainerAgent: false (*except if enforcing Spotless on Windows, pending jenkins-infra/helpdesk#3865), but it is only OK to add an explicit useContainerAgent: true if there are no Docker-based tests.

@jonesbusy
Copy link
Collaborator Author

Thanks. I almost forget about the spotless issue (that I was facing 1-2 times).

I did a small PR to detect such test : https://github.com/jenkins-infra/plugin-modernizer-tool/pull/604/files#diff-bb3dc0c26bd6ab3a8127376a14a65c96c2d5711b783a53a587baa4ae0fc6e690R22-R25

This would help setting the useContainerAgent attribute if missing (typically the buildPlugin() that use VM even if not running container test)

if (_import.getPackageName().startsWith("org.testcontainers.containers")) {

By experience to you know other framework/library that execute docker test (that are not testcontainer)

@basil
Copy link

basil commented Jan 10, 2025

By experience to you know other framework/library that execute docker test (that are not testcontainer)

The only other one I have seen is https://github.com/jenkinsci/docker-fixtures which is our homegrown (but less well maintained these days) predecessor to Testcontainers.

@jglick
Copy link

jglick commented Jan 10, 2025

And https://github.com/jenkinsci/kubernetes-plugin/blob/c91e951eaebd823be6ad34478eba9fd50e6a631d/Jenkinsfile#L23-L29 is clearly a snowflake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted
Projects
None yet
Development

No branches or pull requests

3 participants