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

Build with empty ParametersAction & copying of all build actions #40

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

goganchic
Copy link

@goganchic goganchic commented Jun 12, 2016

Hello everyone. I have such problem with jenkins: I've set up jenkins not-paramererized project to build stash repository. For every new commit stash sends notification to jenkins (url git/notifyCommit which belongs to git plugin). Sometimes build fails and I want to rebuild it with rebuild-plugin. I want to rebuild particular commit, not the last one, but when I click "Rebuild" button jenkins rebuilds last commit. I looked through the code of rebuild-plugin and git-plugin and found that rebuild-plugin copies only ParametersAction-s properties of build and git-plugin stores information about git commit in RevisionParameterAction which is not successor of ParametersAction. That is why jenkins rebuilds wrong commit. I've created fix for rebuild-plugin but I'm not sure that it is right solution. Should I fix git-plugin instead? I mean make RevisionParameterAction a successor of ParametersAction or make a checkbox "add revistion as a build parameter"? Or may be I need new plugin? What do you think which solution will be correct?

Second part of PR is about build with empty parameters attributes. Sometimes I have builds in non-parameterized project in which ParametersAction field exists but it contains no fields, so rebuild-plugin tries to rebuild it and throws an exception.

private void fillOtherBuildActions(Run build, List<Action> actions) {
for (Action a: build.getActions()) {
if (!(a instanceof CauseAction) && !(a instanceof ParametersAction)) {
actions.add(a);
Copy link
Member

Choose a reason for hiding this comment

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

It's really unsafe, because there are many plugins contributing actions as metadata.
Such copying may potentially cause a duplication of data with errorneous results in plugins

@oleg-nenashev
Copy link
Member

@goganchic
The current approach causes much regression risks. I'm almost sure that Docker and Docker Traceability Plugin won't operate correctly on Rebuild, for example.

So I would recommend creating an extension point, which would allow managing such action propagation. Then you will be able to implement it in plugins like Git plugin

@goganchic
Copy link
Author

thanks, I'll try. Can you give me a bit more information information what do you mean? Should I do new extension point in Jenkins? Or may be I need to implement plugin which will depend on git plugin and rebuild plugin and which will add some parameters before rebuild?

@oleg-nenashev
Copy link
Member

Extension in the Jenkins core may be usable, but it requires much more design. It also may require bumping of the plugins to newest core versions, which does not seem to be a good idea till 2.0 LTS gets stabilized.

I would rather implement a RebuildDispatcher with a boolean shouldPropagateAction(Run r, Action a). Then you would be able to implement this extension point in other plugins

@bjacklyn
Copy link

@oleg-nenashev I have implemented your suggestion in this PR

@GLundh GLundh force-pushed the master branch 2 times, most recently from 370af40 to 316c049 Compare March 3, 2021 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants