diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 0000000..90787cb --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,7 @@ + + + io.jenkins.tools.incrementals + git-changelist-maven-extension + 1.6 + + diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 0000000..2a0299c --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1,2 @@ +-Pconsume-incrementals +-Pmight-produce-incrementals diff --git a/README.md b/README.md index faffc34..f661173 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,21 @@ Either buildable builds can stop another build from running (for instance all planned builds can stop another build from running (blocked builds, pending builds waiting builds and buildable builds) +## Declarative Pipeline + +Inside a declarative pipeline, this can be used as is: + +``` +pipeline { + agent any + + options { + buildBlocker (useBuildBlocker: true, blockLevel: 'NODE', scanQueueFor: 'ALL', blockingJobs: 'foo-.*') + } + .... +} +``` + ## JobDSL Usage inside jobdsl scripts is simple as well. For example in order to create a pipeline job which blocks on global level diff --git a/pom.xml b/pom.xml index 5bda56f..116b111 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ build-blocker-plugin Build Blocker Plugin - 1.7.9-SNAPSHOT + ${revision}${changelist} hpi https://github.com/jenkinsci/build-blocker-plugin @@ -61,10 +61,10 @@ - scm:git:https://github.com/jenkinsci/build-blocker-plugin.git - scm:git:git@github.com:jenkinsci/build-blocker-plugin.git - https://github.com/jenkinsci/build-blocker-plugin.git - HEAD + scm:git:https://github.com/${gitHubRepo}.git + scm:git:git@github.com:${gitHubRepo}.git + https://github.com/${gitHubRepo}.git + ${scmTag} @@ -94,6 +94,9 @@ + 1.7.9 + -SNAPSHOT + jenkinsci/build-blocker-plugin UTF-8 2.222.x 2.222.4 @@ -124,6 +127,11 @@ org.jenkins-ci.plugins matrix-project + + org.jenkins-ci + symbol-annotation + 1.23 + org.mockito mockito-core diff --git a/src/main/java/hudson/plugins/buildblocker/BuildBlockerProperty.java b/src/main/java/hudson/plugins/buildblocker/BuildBlockerProperty.java index d6f088c..4e2003f 100644 --- a/src/main/java/hudson/plugins/buildblocker/BuildBlockerProperty.java +++ b/src/main/java/hudson/plugins/buildblocker/BuildBlockerProperty.java @@ -30,6 +30,7 @@ import hudson.model.JobPropertyDescriptor; import hudson.util.FormValidation; import org.apache.commons.lang.StringUtils; +import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.QueryParameter; @@ -84,6 +85,7 @@ public BuildBlockerProperty(boolean useBuildBlocker, String blockLevel, String s * Descriptor */ @Extension + @Symbol("buildBlocker") public static final class BuildBlockerDescriptor extends JobPropertyDescriptor { /**