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

Add post build task for multiply conditions #1239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Amerousful
Copy link

@Amerousful Amerousful commented Jul 5, 2021

https://issues.jenkins.io/browse/JENKINS-66055

Problem statement:
Currently, using the postBuildTask method is possible to create only separated check conditions.

Solution:
Create a method to support the creation of multiply chain conditions.

@sergeyklay
Copy link

@daspilker Could you please take a look?

@jamietanna jamietanna self-requested a review October 27, 2021 13:04
@Amerousful
Copy link
Author

@jamietanna Hey! Can you please check this PR and merge?

Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

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

The use case makes sense but the design of the solution could use some improvement. The use of postBuildTaskChainConditions and a list goes against the DSL conventions used elsewhere. Something more in line with existing conventions (both in the regular DSL and the Dynamic DSL) would be:

job('example') {
    publishers {
        postBuildTask {
            logTexts {
                logText {
                    logText 'Build was aborted'
                    operator 'AND'
                }
                logText {
                    logText 'Simulation.*started'
                    operator 'AND'
                }
            }
            script 'git clean -fdx'
        }
    }
}

Implementing this in the regular DSL seems like it would be a lot of effort, and the result seems like it would be hard to maintain. While the Dynamic DSL doesn't seem to work out of the box here, in #1258 we discovered that the regular DSL can be made to delegate to the Dynamic DSL in some cases (albeit without the ability to test those cases in job-dsl-core). Implementing something similar here seems desirable, as we could get all the syntax for tasks "for free" from the Dynamic DSL and not have to maintain custom code in this plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants