From de9dfeb0c167948e1f7a76a81a147f6e81325039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Mu=C3=B1iz?= Date: Tue, 19 Apr 2016 11:46:13 +0200 Subject: [PATCH] Adding milestone and lock steps to the demo --- .gitignore | 3 +++ demo/Dockerfile | 2 +- demo/Makefile | 2 +- demo/plugins.txt | 3 +++ demo/repo/Jenkinsfile | 39 +++++++++++++++++++--------------- demo/snapshot-only-plugins.txt | 1 + 6 files changed, 31 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 37cf854..2ed513b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ target work +.project +.classpath +.settings diff --git a/demo/Dockerfile b/demo/Dockerfile index 72df16f..11971f8 100644 --- a/demo/Dockerfile +++ b/demo/Dockerfile @@ -29,7 +29,7 @@ USER jenkins RUN echo 'centralhttp://repo.jenkins-ci.org/simple/repo1-cache/central/usr/share/jenkins/ref/.m2/repository' > settings.xml RUN /usr/local/maven/bin/mvn -s settings.xml -f repo-wc install && /usr/local/maven/bin/mvn -s settings.xml -f repo-wc/sometests -Dmaven.test.failure.ignore clean install -COPY plugins.txt . +COPY plugins.txt ./ RUN /usr/local/bin/plugins.sh plugins.txt # Now copy the complete repo including Pipeline script (not only the files needed to warm up the Maven cache). diff --git a/demo/Makefile b/demo/Makefile index 328eac4..beeab9f 100644 --- a/demo/Makefile +++ b/demo/Makefile @@ -11,7 +11,7 @@ run: build build-snapshot: docker build -t $(IMAGE):RELEASE . mkdir -p snapshot-plugins - for p in $$(cat plugins.txt|perl -pe s/:.+//g; cat snapshot-only-plugins.txt); do echo looking for snapshot builds of $$p; for g in org/jenkins-ci/plugins org/jenkins-ci/plugins/workflow org/jenkins-ci/plugins/pipeline-stage-view; do if [ -f ~/.m2/repository/$$g/$$p/maven-metadata-local.xml ]; then cp -v $$(ls -1 ~/.m2/repository/$$g/$$p/*-SNAPSHOT/*.hpi | tail -1) snapshot-plugins/$$p.jpi; fi; done; done + for p in $$(cat snapshot-only-plugins.txt); do echo looking for snapshot builds of $$p; for g in org/jenkins-ci/plugins org/jenkins-ci/plugins/workflow org/jenkins-ci/plugins/pipeline-stage-view; do if [ -f ~/.m2/repository/$$g/$$p/maven-metadata-local.xml ]; then cp -v $$(ls -1 ~/.m2/repository/$$g/$$p/*-SNAPSHOT/*.hpi | tail -1) snapshot-plugins/$$p.jpi; fi; done; done docker build -f Dockerfile-snapshot -t $(IMAGE):SNAPSHOT . run-snapshot: build-snapshot diff --git a/demo/plugins.txt b/demo/plugins.txt index 9a4d199..53184be 100644 --- a/demo/plugins.txt +++ b/demo/plugins.txt @@ -9,7 +9,10 @@ git-server:1.6 handlebars:1.1.1 icon-shim:2.0.3 jquery-detached:1.2.1 +lockable-resources:1.8 +mailer:1.5 mapdb-api:1.0.6.0 +matrix-project:1.4 mock-slave:1.8 momentjs:1.1.1 pipeline-build-step:2.0 diff --git a/demo/repo/Jenkinsfile b/demo/repo/Jenkinsfile index 3f98e40..7579162 100644 --- a/demo/repo/Jenkinsfile +++ b/demo/repo/Jenkinsfile @@ -17,26 +17,31 @@ parallel(longerTests: { runTests(servers, 20) }) -stage name: 'Staging', concurrency: 1 -node { - servers.deploy 'staging' +milestone ordinal: 1 +lock (resource: 'staging-server', inversePrecedence: true) { + stage name: 'Staging' + node { + servers.deploy 'staging' + } + + input message: "Does ${jettyUrl}staging/ look good?" + try { + checkpoint('Before production') + } catch (NoSuchMethodError _) { + echo 'Checkpoint feature available in CloudBees Jenkins Enterprise.' + } } -input message: "Does ${jettyUrl}staging/ look good?" -try { - checkpoint('Before production') -} catch (NoSuchMethodError _) { - echo 'Checkpoint feature available in CloudBees Jenkins Enterprise.' +milestone() +lock ('production-server') { + stage name: 'Production' + node { + sh "wget -O - -S ${jettyUrl}staging/" + echo 'Production server looks to be alive' + servers.deploy 'production' + echo "Deployed to ${jettyUrl}production/" + } } - -stage name: 'Production', concurrency: 1 -node { - sh "wget -O - -S ${jettyUrl}staging/" - echo 'Production server looks to be alive' - servers.deploy 'production' - echo "Deployed to ${jettyUrl}production/" -} - def mvn(args) { sh "${tool 'Maven 3.x'}/bin/mvn ${args}" } diff --git a/demo/snapshot-only-plugins.txt b/demo/snapshot-only-plugins.txt index e69de29..1363520 100644 --- a/demo/snapshot-only-plugins.txt +++ b/demo/snapshot-only-plugins.txt @@ -0,0 +1 @@ +pipeline-milestone-step \ No newline at end of file