Merge branch 'master' into Jenkinsfile

This commit is contained in:
Jesse Glick 2017-05-01 10:23:59 -04:00
commit 0f9b5b60fd
9 changed files with 120 additions and 31 deletions

View File

@ -1,4 +1,4 @@
FROM jenkins:2.32.2
FROM jenkins:2.46.1
USER root
@ -17,6 +17,9 @@ RUN wget -q -O - "http://archive.eclipse.org/jetty/$JETTY_VERSION/dist/jetty-dis
chown -R jenkins /opt/jetty/logs && \
chown -R jenkins /opt/jetty/webapps
RUN apt-get update && \
apt-get install -y patch
WORKDIR /tmp/files
# Prepare local Maven repo. Note that $JENKINS_HOME is a volume so we cannot populate it now.
@ -37,12 +40,26 @@ USER jenkins
# Now copy the complete repo including Pipeline script (not only the files needed to warm up the Maven cache).
RUN rm -rf repo
ADD repo repo
ADD repo-branches repo-branches
ADD lib lib
ADD globallib globallib
USER root
RUN chown -R jenkins.jenkins repo lib globallib
USER jenkins
RUN for r in repo lib globallib; do (cd $r && git init && git add . && git -c user.email=demo@jenkins-ci.org -c user.name="Pipeline Demo" commit -m 'demo' && (echo '[receive]'; echo ' denyCurrentBranch = ignore') >> .git/config); done
RUN for r in repo lib globallib; do \
(cd $r && \
git init && \
git add . && \
git -c user.email=demo@jenkins-ci.org -c user.name="Pipeline Demo" commit -m 'demo' && \
(echo '[receive]'; echo ' denyCurrentBranch = ignore') >> .git/config); \
done; \
for patch in `pwd`/repo-branches/*.diff; do \
branch=`basename -s .diff $patch` && \
(cd repo && \
git checkout -b $branch master && \
patch -p0 < $patch && \
git -c user.email=demo@jenkins-ci.org -c user.name="Pipeline Demo" commit -a -m $branch); \
done
ADD JENKINS_HOME /usr/share/jenkins/ref

View File

@ -12,8 +12,20 @@
<excludes></excludes>
<ignoreOnPushNotifications>false</ignoreOnPushNotifications>
</source>
<strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
<properties class="empty-list"/>
<strategy class="jenkins.branch.NamedExceptionsBranchPropertyStrategy">
<defaultProperties class="empty-list"/>
<namedExceptions class="java.util.Arrays$ArrayList">
<a class="jenkins.branch.NamedExceptionsBranchPropertyStrategy$Named-array">
<jenkins.branch.NamedExceptionsBranchPropertyStrategy_-Named>
<props class="java.util.Arrays$ArrayList">
<a class="jenkins.branch.BranchProperty-array">
<jenkins.branch.NoTriggerBranchProperty/>
</a>
</props>
<name>!master</name>
</jenkins.branch.NamedExceptionsBranchPropertyStrategy_-Named>
</a>
</namedExceptions>
</strategy>
</jenkins.branch.BranchSource>
</sources>
@ -29,7 +41,7 @@
<org.jenkinsci.plugins.workflow.libs.FolderLibraries>
<libraries>
<org.jenkinsci.plugins.workflow.libs.LibraryConfiguration>
<name>servers</name>
<name>tools</name>
<retriever class="org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever">
<scm class="jenkins.plugins.git.GitSCMSource">
<id>whatever</id>

View File

@ -19,7 +19,7 @@ The continuous delivery pipeline consists of the following sequence.
You may clone from, edit, and push to `git://localhost/repo`.
Each branch automatically creates a matching subproject that builds that branch.
* Checks out source code from the same repository and commit as `Jenkinsfile`.
* Loads a set of utility functions from a separate file `servers.groovy`.
* Loads a set of utility functions from a library in a separate repository.
* Builds sources via Maven with unit testing.
* Run two parallel integration tests that involve deploying the app to a PaaS-like ephemeral server instances, which get
thrown away when tests are done (this is done by using auto-deployment of Jetty)

3
demo/lib/vars/mvn.groovy Normal file
View File

@ -0,0 +1,3 @@
def call(args) {
sh "${tool 'Maven 3.x'}/bin/mvn ${args}"
}

1
demo/lib/vars/mvn.txt Normal file
View File

@ -0,0 +1 @@
Run a Maven command with some arguments and the right tool location.

View File

@ -1,37 +1,74 @@
org.jenkins-ci.ui:ace-editor:1.1
org.jenkins-ci.plugins:branch-api:2.0.4
org.jenkins-ci.plugins:cloudbees-folder:5.17
org.jenkins-ci.plugins:credentials:2.1.11
org.jenkins-ci.plugins:authentication-tokens:1.3
io.jenkins.blueocean:blueocean:1.0.0
org.jenkins-ci.plugins:blueocean-autofavorite:0.7
io.jenkins.blueocean:blueocean-commons:1.0.0
io.jenkins.blueocean:blueocean-config:1.0.0
io.jenkins.blueocean:blueocean-dashboard:1.0.0
org.jenkins-ci.plugins:blueocean-display-url:1.5.1
io.jenkins.blueocean:blueocean-events:1.0.0
io.jenkins.blueocean:blueocean-git-pipeline:1.0.0
io.jenkins.blueocean:blueocean-github-pipeline:1.0.0
io.jenkins.blueocean:blueocean-i18n:1.0.0
io.jenkins.blueocean:blueocean-jwt:1.0.0
io.jenkins.blueocean:blueocean-personalization:1.0.0
io.jenkins.blueocean:blueocean-pipeline-api-impl:1.0.0
io.jenkins.blueocean:blueocean-pipeline-editor:0.2.0
io.jenkins.blueocean:blueocean-rest:1.0.0
io.jenkins.blueocean:blueocean-rest-impl:1.0.0
io.jenkins.blueocean:blueocean-web:1.0.0
org.jenkins-ci.plugins:branch-api:2.0.8
org.jenkins-ci.plugins:cloudbees-folder:6.0.3
org.jenkins-ci.plugins:credentials:2.1.13
org.jenkins-ci.plugins:credentials-binding:1.11
org.jenkins-ci.plugins:display-url-api:1.1.1
org.jenkins-ci.plugins:docker-commons:1.6
org.jenkins-ci.plugins:docker-workflow:1.10
org.jenkins-ci.plugins:durable-task:1.13
org.jenkins-ci.plugins:git:3.0.5
org.jenkins-ci.plugins:git-client:2.2.1
org.jvnet.hudson.plugins:favorite:2.0.4
org.jenkins-ci.plugins:git:3.2.0
org.jenkins-ci.plugins:git-client:2.4.1
org.jenkins-ci.plugins:git-server:1.7
com.coravy.hudson.plugins.github:github:1.26.2
org.jenkins-ci.plugins:github-api:1.85
org.jenkins-ci.plugins:github-branch-source:2.0.4
org.jenkins-ci.ui:handlebars:1.1.1
org.jenkins-ci.plugins.icon-shim:icon-shim:2.0.3
org.jenkins-ci.plugins:jackson2-api:2.7.3
org.jenkins-ci.ui:jquery-detached:1.2.1
org.jenkins-ci.plugins:junit:1.20
org.6wind.jenkins:lockable-resources:1.11
org.jenkins-ci.plugins:mailer:1.19
org.jenkins-ci.plugins:matrix-project:1.8
org.6wind.jenkins:lockable-resources:1.11.2
org.jenkins-ci.plugins:mailer:1.20
org.jenkins-ci.plugins:matrix-project:1.9
org.jenkins-ci.plugins:metrics:3.1.2.9
org.jenkins-ci.plugins:mock-slave:1.10
org.jenkins-ci.ui:momentjs:1.1.1
org.jenkins-ci.plugins:pipeline-graph-analysis:1.3
org.jenkins-ci.plugins:pipeline-input-step:2.5
org.jenkins-ci.plugins:pipeline-milestone-step:1.3
org.jenkins-ci.plugins.pipeline-stage-view:pipeline-rest-api:2.4
org.jenkins-ci.plugins:pipeline-milestone-step:1.3.1
org.jenkinsci.plugins:pipeline-model-api:1.1.1
org.jenkinsci.plugins:pipeline-model-definition:1.1.1
org.jenkinsci.plugins:pipeline-model-extensions:1.1.1
org.jenkins-ci.plugins.pipeline-stage-view:pipeline-rest-api:2.6
org.jenkins-ci.plugins:pipeline-stage-step:2.2
org.jenkins-ci.plugins.pipeline-stage-view:pipeline-stage-view:2.4
org.jenkins-ci.plugins:scm-api:2.0.3
org.jenkins-ci.plugins:script-security:1.25
org.jenkinsci.plugins:pipeline-stage-tags-metadata:1.1.1
org.jenkins-ci.plugins.pipeline-stage-view:pipeline-stage-view:2.6
org.jenkins-ci.plugins:plain-credentials:1.4
org.jenkins-ci.plugins:pubsub-light:1.7
org.jenkins-ci.plugins:scm-api:2.1.1
org.jenkins-ci.plugins:script-security:1.27
org.jenkins-ci.plugins:sse-gateway:1.15
org.jenkins-ci.plugins:ssh-credentials:1.13
org.jenkins-ci.plugins:structs:1.5
org.jenkins-ci.plugins.workflow:workflow-api:2.10
org.jenkins-ci.plugins:structs:1.6
org.jenkins-ci.plugins:token-macro:2.1
org.jenkins-ci.plugins:variant:1.1
org.jenkins-ci.plugins.workflow:workflow-api:2.12
org.jenkins-ci.plugins.workflow:workflow-basic-steps:2.4
org.jenkins-ci.plugins.workflow:workflow-cps:2.26
org.jenkins-ci.plugins.workflow:workflow-cps-global-lib:2.6
org.jenkins-ci.plugins.workflow:workflow-durable-task-step:2.8
org.jenkins-ci.plugins.workflow:workflow-cps:2.29
org.jenkins-ci.plugins.workflow:workflow-cps-global-lib:2.7
org.jenkins-ci.plugins.workflow:workflow-durable-task-step:2.10
org.jenkins-ci.plugins.workflow:workflow-job:2.10
org.jenkins-ci.plugins.workflow:workflow-multibranch:2.12
org.jenkins-ci.plugins.workflow:workflow-scm-step:2.3
org.jenkins-ci.plugins.workflow:workflow-multibranch:2.14
org.jenkins-ci.plugins.workflow:workflow-scm-step:2.4
org.jenkins-ci.plugins.workflow:workflow-step-api:2.9
org.jenkins-ci.plugins.workflow:workflow-support:2.13
org.jenkins-ci.plugins.workflow:workflow-support:2.14

View File

@ -0,0 +1,11 @@
--- Jenkinsfile
+++ Jenkinsfile
@@ -1,7 +1,5 @@
-@Library('tools') import demo.Servers
-
jettyUrl = 'http://localhost:8081/'
-servers = new Servers(this)
+servers = library(identifier: 'tools2@master', retriever: modernSCM([$class: 'GitSCMSource', remote: 'git://localhost/lib'])).demo.Servers.new(this)
stage('Dev') {
node {

View File

@ -0,0 +1,11 @@
--- Jenkinsfile
+++ Jenkinsfile
@@ -1,7 +1,5 @@
-@Library('tools') import demo.Servers
-
jettyUrl = 'http://localhost:8081/'
-servers = new Servers(this)
+servers = library('tools').demo.Servers.new(this)
stage('Dev') {
node {

View File

@ -1,4 +1,4 @@
@Library('servers') import demo.Servers
@Library('tools') import demo.Servers
jettyUrl = 'http://localhost:8081/'
servers = new Servers(this)
@ -47,9 +47,6 @@ stage ('Production') {
}
}
}
def mvn(args) {
sh "${tool 'Maven 3.x'}/bin/mvn ${args}"
}
def runTests(duration) {
node {