You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2023/04/22 11:51:44 UTC
[comdev-site] 02/02: Exclude only -staging branches; simplify
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch exclude-staging
in repository https://gitbox.apache.org/repos/asf/comdev-site.git
commit d8c8a69c8b6ea068b5d3ffc2faf0c25e484fb711
Author: Sebb <se...@apache.org>
AuthorDate: Sat Apr 22 12:51:34 2023 +0100
Exclude only -staging branches; simplify
The current pattern for preventing loops works because it does
not allow '-' in the branch name. This is a bit restrictived.
It would be better to exclude all branches ending in '-staging',
as that agrees with the definition of STAGING_BRANCH
---
Jenkinsfile | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 582128d..b534c1c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -111,11 +111,14 @@ pipeline {
}
stage('Staging') {
// Mostly duplicated from the Deploy branch, there must be a better way...
+ // https://www.jenkins.io/doc/book/pipeline/syntax/#built-in-conditions
+ // branch uses Ant-style patterns by default:
+ // https://ant.apache.org/manual/dirtasks.html#patterns
+ // Exclude branches ending in '-staging'
+ // This agrees with the definition of STAGING_BRANCH
when {
- allOf {
- // ignore branches named preview/*-staging to avoid infinite loop..
- // WARNING: do not allow '-' in preview source branch names or the loop will return...
- expression { env.BRANCH_NAME ==~ /preview\/[a-zA-Z0-9_]+$/ }
+ not {
+ branch '**/*-staging'
}
}
steps {