-
Notifications
You must be signed in to change notification settings - Fork 19
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
Use the detected JDK to use the right values in SetupJenkinsfile. #598
Comments
This could be a first step before #531 is fully implemented Until we have more logic to maintains the Jenkinsfile and make them evolve (For example Java 25) |
My thought if a contributor want to take this task (it's a rather easy recipe since we have already the pieces to assemble it. like the JDK model or PomResolutionVisitor)
Similar to but with adapted version (this can be a simple string format with placeholder) /*
See the documentation for more options:
https://github.com/jenkins-infra/pipeline-library/
*/
buildPlugin(
forkCount: '1C', // Run a JVM per core in tests
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
]) Pseudo-code @Language("groovy")
public static String JENKINSFILE_TEMPLATE = """
/*
See the documentation for more options:
https://github.com/jenkins-infra/pipeline-library/
*/
buildPlugin(
forkCount: '1C', // Run a JVM per core in tests
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
configurations: [
[platform: 'linux', jdk: %s],
[platform: 'windows', jdk: %s],
])
""".formatted(hightestCompatibleJdk, nextjdK); |
Hello sir, I'm interested in working on this.
|
JDK 17 is the current recommended version, but JDK 21 is just around the corner. So "two latest versions" means (to me at least) JDK 17 and JDK 21. We don't have to target both Windows and Linux if the Jenkinsfile already exists and targets only one platform. If there is no Jenkinsfile, it's reasonable to target JDK 21 for Linux and JDK 17 for Windows. Thanks. |
Understood sir, |
For this issue it would be for plugin not using Jenkinsfile. To allow creating a Jenkinsfile corresponding on to the current version The modification of an existing jenkinsfile will be done by other recipes (for example the UpgradeJenkinsVersion) which will be done by #628 and #531 (which are a bit more complex) |
Jenkinsfile need to be created for this right?
|
My bad, @jonesbusy, I mixed the two in my attempt to explain. 😊 So, a new |
|
Yes correct. On the archetype we use Linux platform on most recent JDK and Windows for the previous now. I don't think we need to change this behavior |
Hello sir, Did you mean 'io.jenkins.tools.pluginmodernizer.SetupJenkinsfile' since i couldn't find a file named 'AddJenkinsfile'
|
|
Makes sense now |
Hello sir, |
Try to determine which approach is better. How the recipe must be implemented? Is it Java ? Is is a standard Recipe or ScanningRecipe? Can we achieve it with declarative yaml only ? How are implemented other complex recipes? How this recipe can be tested? I gave some tips and idea here : #598 (comment) |
Hello sir, I'm extremely sorry for asking this but could you please help with this one issue i have |
With just a screenshot and no logs or code it's just impossible to help. I think the jenkins version bust be taken from the pom.xml from the scanner of the scanning recipe. Then the visitor creating the new file using correct values. Hope it helps |
What feature do you want to see added?
For the time being, we are using the same values for everyone: JDK 21 under Linux and JDK 17 under Windows.
For the plugins that do not yet have a Jenkinsfile, this transition might be quite abrupt, as they are most likely still using JDK 8 or older. Would it be possible to use a parameterized recipe to incorporate the values detected during the metadata gathering?
In this way, the Jenkinsfile would serve as a template, allowing us to dynamically insert the detected JDK instead of using fixed values like 17 or 21.
We do not need to modify the existing recipe; we could create a new one instead.
Upstream changes
No response
Are you interested in contributing this feature?
No response
The text was updated successfully, but these errors were encountered: