Created
August 27, 2020 01:22
-
-
Save lavk7/fbf632d6d9e4ba03f6588035e0814e54 to your computer and use it in GitHub Desktop.
jenkins_match_regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def matchers = ["develop", "master", "0.0.1", "release-0.0.1", "hotfix-0.0.1", "test"] | |
pipeline { | |
stages { | |
stage("test"){ | |
allOf{ | |
expression { | |
matchers.each{ | |
match -> | |
if (! match ==~ /^(develop)$|^(master)$|^(\d+\.\d+\.\d+)$|^(release-\d+\.\d+\.\d+)$|^(hotfix-\d+\.\d+\.\d+)$/){ | |
print("Did not match" + match) | |
return false | |
} | |
} | |
} | |
return true | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment