[Solved] How to add regular expression to jenkins pipeline? [closed]


Please read documents carefully before asking!

There is no syntax format like “when + environment”. Try “when + expression”, for example:

stage("example") {
        when { expression { return egText.contains("abcd") } }

Beside that, about environment:

The environment directive specifies a sequence of key-value pairs which will be defined as environment variables for all steps, or stage-specific steps, depending on where the environment directive is located within the Pipeline.
This directive supports a special helper method credentials() which can be used to access pre-defined Credentials by their identifier in the Jenkins environment.

We can use environment variables by using “env. “. Assume VERSION is a environment variable, we can ‘touch’ this variable, for example – assign value, like: “env.VERSION = “1.1a””

0

solved How to add regular expression to jenkins pipeline? [closed]