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

job triggered anyway when don't trigger condition is met #199

Open
badcorporatelogo opened this issue Apr 3, 2020 · 0 comments
Open

job triggered anyway when don't trigger condition is met #199

badcorporatelogo opened this issue Apr 3, 2020 · 0 comments

Comments

@badcorporatelogo
Copy link

When configuring a phase job with "Parameters from properties file", there is a checkbox to say, "Don't trigger if any files are missing".

The condition gets evaluated correctly, but the job is always triggered. In cases where the properties file doesn't exist, the job is triggered with no arguments.

The console log looks like this:

    >> Job status: [downstream-job-part1] the 'build only if scm changes' feature is disabled.
Starting build job downstream-job-part1.
[parameterized-trigger] Properties file part1.props did not exist.
Not triggering due to missing file - did you archive it as a build artifact ?
[multiJob] DontTriggerException: hudson.plugins.parameterizedtrigger.AbstractBuildParameters$DontTriggerException

Despite saying it won't trigger the job, it does anyway.

The reason why appears to be here:
https://github.com/jenkinsci/tikal-multijob-plugin/blob/master/src/main/java/com/tikal/jenkins/plugins/multijob/PhaseJobsConfig.java#L496

At this line, we need to add params = null; to fix the bug.

The implementation assigns a default value to params (as described in the comments on lines 447-449). Then at the end of the function, on line 501, it conditionally adds the params to the actions list. The catch block for DontTriggerException needs to discard the default params value and set it back to null, in order to "override" it as described in the function comments.

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

No branches or pull requests

1 participant