Skip to content

JENKINS-25223: Allow executing scripts in JobProperty.prebuild phase - #36

Open
arcivanov wants to merge 1 commit into
jenkinsci:masterfrom
arcivanov:JENKINS-25223
Open

JENKINS-25223: Allow executing scripts in JobProperty.prebuild phase#36
arcivanov wants to merge 1 commit into
jenkinsci:masterfrom
arcivanov:JENKINS-25223

Conversation

@arcivanov

Copy link
Copy Markdown

Creates the "prebuild" phase JobProperty section, allowing scripts to be executed after SCM is completed but before AbstractBuildExecution.doRun kicks in.
Also fixes NPE in EnvInjectJobProperty where disabling a section and saving before applying causes NPE on save

@jenkinsadmin

Copy link
Copy Markdown
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@oleg-nenashev

Copy link
Copy Markdown
Member

IMHO, it's preferable to merge the functionality into https://github.com/jenkinsci/envinject-plugin/blob/master/src/main/java/org/jenkinsci/plugins/envinject/EnvInjectJobProperty.java (just to avoid user confusion and extra checkboxes)

@arcivanov

Copy link
Copy Markdown
Author

Well, the point was actually not to. If there is only one box it'll be either "before SCM" or "after SCM before doRun". There is no reason to not allow both but I agree it makes sense to work on the naming for the boxes.

Scenario could be:

  1. Prep environment, install SCM
  2. Run SCM
  3. Use SCM'ed data to setup the rest of the environment before doRun kicks in.

@daniel-beck

Copy link
Copy Markdown
Member

Isn't it time the UI was changed to something more like Git Plugin's Additional Behaviors, or how Email-ext changed the per-trigger recipients? It's getting ridiculous with the boxes.

@arcivanov

Copy link
Copy Markdown
Author

I'm not opposed to the change in the UI. Let me see how additional behaviors work in Git and how long it'll take to get it done.

@arcivanov

Copy link
Copy Markdown
Author

Just out of curiousity, what section of the job would you like the configuration to reside? I would vote for top-most Job Property section for all, i.e. for "before SCM", "after SCM, before doRun", "shortly after doRun" (not real labels).

@oleg-nenashev

Copy link
Copy Markdown
Member

I'd like to get this feature merged. BTW, a combination of EnvInject build step and https://wiki.jenkins-ci.org/display/JENKINS/pre-scm-buildstep seems to provide this feature.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be great if you follow the plugin's codestyle. Brackets are being placed at the same line as the declaration in the plugin

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks, I'll work on the style, standby.

@arcivanov

Copy link
Copy Markdown
Author

@oleg-nenashev

BTW, a combination of EnvInject build step and https://wiki.jenkins-ci.org/display/JENKINS/pre-scm-buildstep

Actually I don't think it does, as specific stated purpose is (emphasis added):

Creates the "prebuild" phase JobProperty section, allowing scripts to be executed after SCM is completed but before AbstractBuildExecution.doRun kicks in.

This allows to get a code tree sucked in and then configure things like JDK, Maven or any other build environment component based on information retrieved from the SCM.

@oleg-nenashev

Copy link
Copy Markdown
Member

It would be great to have a 1 or 2 unit tests for the feature (just to be sure it works correctly when we apply new changes). It should not be a big deal, because it's possible to copy some bits from #58. Could you add such tests?

@arcivanov

Copy link
Copy Markdown
Author

I'll add the tests

@arcivanov

Copy link
Copy Markdown
Author

@oleg-nenashev Tests added, latest functionality synced up. Happy? 😄

@oleg-nenashev

Copy link
Copy Markdown
Member

@arcivanov
Thanks a lot for your efforts. The PR looks good to me. Somebody may be concerned by another checkbox in the job property, but IMO it's OK in the current case (and can be a refactoring subject for envinject-2.0).

Adding the PR to the next major release milestone. It would be great if you squash commits

@oleg-nenashev oleg-nenashev added this to the 1.93 milestone Aug 24, 2015
…d phase

Creates the "prebuild" phase JobProperty section, allowing scripts to be executed after SCM is completed but before AbstractBuildExecution.doRun kicks in.
Also fixes NPE in EnvInjectJobProperty where disabling a section and saving before applying causes NPE on save
@arcivanov

Copy link
Copy Markdown
Author

@oleg-nenashev squashed, commit message updated to reflect fixed status

@arcivanov

Copy link
Copy Markdown
Author

@oleg-nenashev bump

@oleg-nenashev

Copy link
Copy Markdown
Member

@daniel-beck

Isn't it time the UI was changed to something more like Git Plugin's Additional Behaviors, or how Email-ext changed the per-trigger recipients? It's getting ridiculous with the boxes.

It definitely makes sense (as well as the rework of the internal layout). BTW it should be done as a general envinject-2.0 effort.

I'm pretty OK to merge the PR now, but I would plan to rework it during the 2.0 rework and probably make the incompatible change.

@arcivanov

Copy link
Copy Markdown
Author

I agree that UI rework is out of scope for this PR - it was my intention to only introduce additional functionality.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

MINOR Method 'StaplerRequest.bindParameters(...)' is deprecated. rule
MAJOR Rename "info" which hides the field declared at line 50. rule
MINOR Split this 136 characters long line (which is greater than 120 authorized). rule

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants