Adding milestone and lock steps to the demo

This commit is contained in:
Antonio Muñiz 2016-04-19 11:46:13 +02:00
parent a83d86638e
commit de9dfeb0c1
6 changed files with 31 additions and 19 deletions

3
.gitignore vendored
View File

@ -1,2 +1,5 @@
target
work
.project
.classpath
.settings

View File

@ -29,7 +29,7 @@ USER jenkins
RUN echo '<settings><mirrors><mirror><id>central</id><url>http://repo.jenkins-ci.org/simple/repo1-cache/</url><mirrorOf>central</mirrorOf></mirror></mirrors><localRepository>/usr/share/jenkins/ref/.m2/repository</localRepository></settings>' > 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).

View File

@ -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

View File

@ -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

39
demo/repo/Jenkinsfile vendored
View File

@ -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}"
}

View File

@ -0,0 +1 @@
pipeline-milestone-step