Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WIP: [JENKINS-63284] Add initial Pipeline job support for Groovy properties#47

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
M-r-A wants to merge4 commits intojenkinsci:master
base:master
Choose a base branch
Loading
fromM-r-A:feature-pipeline-job-support

Conversation

@M-r-A
Copy link

@M-r-AM-r-A commentedApr 12, 2021
edited
Loading

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 usejenkinsProject Groovy property with the Pipeline job.

Related issues:JENKINS-63284,JENKINS-65235,JENKINS-53554.
Related guide:Writing Pipeline-Compatible Plugins

  • Make sure you are opening from atopic/feature/bugfix branch (right side) and not your master 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

felipemlemos, krushik, and sonjek reacted with thumbs up emoji
privatestaticbooleanisParameterDefinitionOf(@NonnullStringparameterUUID,@NonnullJob<?, ?>project) {
List<ParameterDefinition>parameterDefinitions =newArrayList<>(getProjectParameterDefinitions(project));
for (List<ParameterDefinition>params :getBuildWrapperParameterDefinitions(project).values()) {
// TODO: Update or get rid of getBuildWrapperParameterDefinitions
Copy link
Author

Choose a reason for hiding this comment

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

@kinow Dear maintainers, please help me with this part of the plugin. I'm unsure how we usegetBuildWrapperParameterDefinition and how we test that it works.
Do we still need it with all these introspections with BuildWrapper and all?

Copy link
Member

Choose a reason for hiding this comment

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

ThisisParameterDefinitionOf 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?

StringprojectName =null;
StringprojectFullName =null;
if (currentRequest !=null) {
// TODO: Check if we really need AbstractItem instead of Job class
Copy link
Author

Choose a reason for hiding this comment

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

@kinow Same for this commentary: why do we useAbstractItem here but then filter withProject class ingetHelperParameters()?

Copy link
Member

Choose a reason for hiding this comment

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

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 anAbstractItem.).

In case where the projectName is the name of anAbstractItem that is not aProject, we ignore that as we don't want to put another object instance in thejenkinsProject bound variable.

@c4sh
Copy link

c4sh commentedFeb 1, 2022

Is there a reason why this was never finished ?

Mantene, plawniczuk, caichao1103, Janfy, adrian-taut-idnow, jan-stoltman-bolt, and krushik reacted with thumbs up emojithst-nordic, Janfy, adrian-taut-idnow, jan-stoltman-bolt, BongoEADGC6, and felipemlemos reacted with eyes emoji

@jan-stoltman-bolt
Copy link

Hey@M-r-A@kinow would it be possible to finalize this PR? 🙏 This feature would be amazing to have

drewwaranissonos, pniederlag, and felipemlemos reacted with thumbs up emoji

@kinow
Copy link
Member

Hey@M-r-A@kinow would it be possible to finalize this PR? pray This feature would be amazing to have

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
Bruno

@dimmel82
Copy link

Hi@kinow,
I merged the PR to the master branch in a local clone and built the plugin. After installing the plugin on Jenkins, I tried to define a ChoiceParameter (also tried with lower-case and camel-case) in a declarative pipeline's "parameters" block but got the following error which shows that only specific types of parameters are allowed:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:WorkflowScript: 286: Invalid parameter type "ChoiceParameter". Valid parameter types: [booleanParam, choice, credentials, extendedChoice, file, text, password, run, string] @ line 286, column 5.       ChoiceParameter name: 'ENVIRONMENT'       ^

Maybe additional development is required in other plugins to support this feature.
Please let me know if my approach with the "parameters" block was the indented one or if should test in a different way.

Thanks,
Dimitris

kinow reacted with heart emoji

@kinow
Copy link
Member

Thanks a lot for testing and reporting@dimmel82!

@JinPengGeng
Copy link

Is there an update? I have been looking for this feature for a long time

regazzoj, JinPengGeng, tthornton3-chwy, asetty, and pd-mikha reacted with thumbs up emoji

@asetty
Copy link

Pinging for updates

regazzoj, tomasgri, and pd-mikha reacted with thumbs up emoji

@mvanini
Copy link

Hi@kinow, I merged the PR to the master branch in a local clone and built the plugin. After installing the plugin on Jenkins, I tried to define a ChoiceParameter (also tried with lower-case and camel-case) in a declarative pipeline's "parameters" block but got the following error which shows that only specific types of parameters are allowed:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:WorkflowScript: 286: Invalid parameter type "ChoiceParameter". Valid parameter types: [booleanParam, choice, credentials, extendedChoice, file, text, password, run, string] @ line 286, column 5.       ChoiceParameter name: 'ENVIRONMENT'       ^

Maybe additional development is required in other plugins to support this feature. Please let me know if my approach with the "parameters" block was the indented one or if should test in a different way.

Thanks, Dimitris

This PR is only for having access to Jenkins API for pipeline job types from groovy code used in the parameter's script.
Definition of the active-choices parameters in declarative way are not implemented but sure it would be an amazing feature to have.
We used mixed scripted/declarative pipeline to define this type of parameters. Is not so cool but it works.

@wrbst
Copy link

Hey@M-r-A@kinow would it be possible to finalize this PR? pray This feature would be amazing to have

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 Bruno

3 years later.
What is going on with this PR ?

@kinow
Copy link
Member

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 myvolunteer 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 tovolunteer on this PR.

I'm highlighting this as you can see in thisrecent example that some users expect open source volunteers to prioritize the bugs/PRs regardless of their lives/jobs/family/personal issues/etc..

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@kinowkinowkinow left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

9 participants

@M-r-A@c4sh@jan-stoltman-bolt@kinow@dimmel82@JinPengGeng@asetty@mvanini@wrbst

[8]ページ先頭

©2009-2025 Movatter.jp