WIP: [JENKINS-63284] Add initial Pipeline job support for Groovy properties#47
WIP: [JENKINS-63284] Add initial Pipeline job support for Groovy properties#47M-r-A wants to merge 4 commits into
Conversation
| private static boolean isParameterDefinitionOf(@Nonnull String parameterUUID, @Nonnull Job<?, ?> project) { | ||
| List<ParameterDefinition> parameterDefinitions = new ArrayList<>(getProjectParameterDefinitions(project)); | ||
| for (List<ParameterDefinition> params : getBuildWrapperParameterDefinitions(project).values()) { | ||
| // TODO: Update or get rid of getBuildWrapperParameterDefinitions |
There was a problem hiding this comment.
@kinow Dear maintainers, please help me with this part of the plugin. I'm unsure how we use getBuildWrapperParameterDefinition and how we test that it works.
Do we still need it with all these introspections with BuildWrapper and all?
There was a problem hiding this comment.
This isParameterDefinitionOf method is called as a fallback when we cannot find the project of the parameter.
We navigate all the projects in Jenkins, trying to find one that contains the parameter UUID. It is highly inefficient, but was the last resort after getting so many bugs from users with custom plug-ins that were modifying the structure of project <-> parameters (i.e. inserting extra nodes in-between these two).
It should work with pipeline jobs, no?
| String projectName = null; | ||
| String projectFullName = null; | ||
| if (currentRequest != null) { | ||
| // TODO: Check if we really need AbstractItem instead of Job class |
There was a problem hiding this comment.
@kinow Same for this commentary: why do we use AbstractItem here but then filter with Project class in getHelperParameters()?
There was a problem hiding this comment.
From memory, the name or full name may have the project name. Or one of them may contain a folder name. Or a special object name (e.g. another plug-in that provides an AbstractItem.).
In case where the projectName is the name of an AbstractItem that is not a Project, we ignore that as we don't want to put another object instance in the jenkinsProject bound variable.
|
Is there a reason why this was never finished ? |
Sorry, a bit strapped for time (life, work, being sponsored to work on other OSS projects, etc.) Maybe someone could test the current PR with pipelines, and report whether it's working or not? That could help myself or another dev when re-starting the work on this code. Cheers |
|
Hi @kinow, Maybe additional development is required in other plugins to support this feature. Thanks, |
|
Thanks a lot for testing and reporting @dimmel82! |
|
Is there an update? I have been looking for this feature for a long time |
|
Pinging for updates |
This PR is only for having access to Jenkins API for pipeline job types from groovy code used in the parameter's script. |
3 years later. |
|
Hi @wrbst I merged changes contributed via PRs to adjust the code to changes in Jenkins upstream. The tests passed, and quick manual tests were OK too, and the code changes looked fine. The plug-in releases got blocked due to regressions in the last release. It's been going for a few months already (you can check the commits & JIRA). Regressions and security bugs normally take most of my volunteer time to work on the plug-in. You can see in the comments (above) that there were some errors with this PR on user's environments, so I planned to work on this when I had more time as I expect some hiccups and need to do more tests. If OP can rebase and fix conflicts, and others can test & send PRs to update it fixing the code, it would be easier to review. Otherwise, I'll work on this when I have time to volunteer on this PR. I'm highlighting this as you can see in this recent example that some users expect open source volunteers to prioritize the bugs/PRs regardless of their lives/jobs/family/personal issues/etc.. |
I want to add support for Pipeline job for Groovy script properties.
Currently, the plugin does not fully work with the Pipeline job: it uses classes that are specific only for the Freestyle job for getting extra data to inject to Groovy binding.
I changed plugin code to deal with Job/Run classes and added a test that demonstrates the result.
With these changes, users will be able to use
jenkinsProjectGroovy property with the Pipeline job.Related issues: JENKINS-63284, JENKINS-65235, JENKINS-53554.
Related guide: Writing Pipeline-Compatible Plugins