Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 27cfe8b

Browse files
author
Vincent Demeester
authored
Merge pull request #227 from vdemeester/oss-jenkinsfile
Prepare the Jenkinsfile for open-source
2 parents d93bc06 + 43a8c42 commit 27cfe8b

2 files changed

Lines changed: 175 additions & 78 deletions

File tree

Jenkinsfile

Lines changed: 7 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ properties([buildDiscarder(logRotator(numToKeepStr: '20'))])
22

33
pipeline {
44
agent {
5-
label 'pipeline'
5+
label 'linux && x86_64'
66
}
77

88
options {
@@ -14,7 +14,7 @@ pipeline {
1414
parallel {
1515
stage("Validate") {
1616
agent {
17-
label 'linux'
17+
label 'ubuntu-1604-aufs-edge'
1818
}
1919
steps {
2020
dir('src/github.com/docker/app') {
@@ -26,7 +26,7 @@ pipeline {
2626
}
2727
stage("Binaries"){
2828
agent {
29-
label 'linux'
29+
label 'ubuntu-1604-aufs-edge'
3030
}
3131
steps {
3232
dir('src/github.com/docker/app') {
@@ -62,25 +62,19 @@ pipeline {
6262
stage('Test') {
6363
parallel {
6464
stage("Coverage") {
65-
environment {
66-
CODECOV_TOKEN = credentials('jenkins-codecov-token')
67-
}
6865
agent {
69-
label 'linux'
66+
label 'ubuntu-1604-aufs-edge'
7067
}
7168
steps {
7269
dir('src/github.com/docker/app') {
7370
checkout scm
7471
sh 'make -f docker.Makefile coverage'
75-
archiveArtifacts '_build/ci-cov/all.out'
76-
archiveArtifacts '_build/ci-cov/coverage.html'
77-
sh 'curl -s https://codecov.io/bash | bash -s - -f _build/ci-cov/all.out -K'
7872
}
7973
}
8074
}
8175
stage("Gradle test") {
8276
agent {
83-
label 'linux'
77+
label 'ubuntu-1604-aufs-edge'
8478
}
8579
steps {
8680
dir('src/github.com/docker/app') {
@@ -99,7 +93,7 @@ pipeline {
9993
}
10094
stage("Test Linux") {
10195
agent {
102-
label 'linux'
96+
label 'ubuntu-1604-aufs-edge'
10397
}
10498
steps {
10599
dir('src/github.com/docker/app') {
@@ -114,74 +108,9 @@ pipeline {
114108
}
115109
}
116110
}
117-
stage("Test Mac") {
118-
agent {
119-
label "mac"
120-
}
121-
steps {
122-
dir('src/github.com/docker/app') {
123-
unstash 'binaries'
124-
unstash 'e2e'
125-
sh './docker-app-e2e-darwin'
126-
}
127-
}
128-
post {
129-
always {
130-
deleteDir()
131-
}
132-
}
133-
}
134-
stage("Test Win") {
135-
agent {
136-
label "windows"
137-
}
138-
steps {
139-
dir('src/github.com/docker/app') {
140-
unstash "binaries"
141-
unstash 'e2e'
142-
bat 'docker-app-e2e-windows.exe'
143-
}
144-
}
145-
post {
146-
always {
147-
deleteDir()
148-
}
149-
}
150-
}
151-
}
152-
}
153-
stage('Release') {
154-
agent {
155-
label "linux"
156-
}
157-
when {
158-
buildingTag()
159-
}
160-
steps {
161-
dir('src/github.com/docker/app') {
162-
unstash 'artifacts'
163-
echo "Releasing $TAG_NAME"
164-
dir('bin') {
165-
release('docker/app')
166-
}
167-
}
168-
}
169-
post {
170-
always {
171-
deleteDir()
172-
}
173111
}
174112
}
175113
}
176114
}
177115

178-
def release(repo) {
179-
withCredentials([[$class: 'StringBinding', credentialsId: 'github-release-token', variable: 'GITHUB_TOKEN']]) {
180-
def data = "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$TAG_NAME\", \"draft\": true, \"prerelease\": true}"
181-
def url = "https://api.github.com/repos/$repo/releases"
182-
def reply = sh(returnStdout: true, script: "curl -sSf -H \"Authorization: token $GITHUB_TOKEN\" -H \"Accept: application/json\" -H \"Content-type: application/json\" -X POST -d '$data' $url")
183-
def release = readJSON text: reply
184-
url = release.upload_url.replace('{?name,label}', '')
185-
sh("for f in * ; do curl -sf -H \"Authorization: token $GITHUB_TOKEN\" -H \"Accept: application/json\" -H \"Content-type: application/octet-stream\" -X POST --data-binary \"@\${f}\" $url?name=\${f}; done")
186-
}
187-
}
116+

Jenkinsfile.baguette

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
properties([buildDiscarder(logRotator(numToKeepStr: '20'))])
2+
3+
pipeline {
4+
agent {
5+
label 'pipeline'
6+
}
7+
8+
options {
9+
skipDefaultCheckout(true)
10+
}
11+
12+
stages {
13+
stage('Build') {
14+
agent {
15+
label 'linux'
16+
}
17+
steps {
18+
dir('src/github.com/docker/app') {
19+
script {
20+
try {
21+
checkout scm
22+
sh 'docker image prune -f'
23+
sh 'make -f docker.Makefile lint'
24+
sh 'make -f docker.Makefile cross e2e-cross tars'
25+
dir('bin') {
26+
stash name: 'binaries'
27+
}
28+
dir('e2e') {
29+
stash name: 'e2e'
30+
}
31+
if(!(env.BRANCH_NAME ==~ "PR-\\d+")) {
32+
stash name: 'artifacts', includes: 'bin/*.tar.gz', excludes: 'bin/*-e2e-*'
33+
archiveArtifacts 'bin/*.tar.gz'
34+
}
35+
} finally {
36+
def clean_images = /docker image ls --format "{{.ID}}\t{{.Tag}}" | grep $(git describe --always --dirty) | awk '{print $1}' | xargs docker image rm -f/
37+
sh clean_images
38+
}
39+
}
40+
}
41+
}
42+
post {
43+
always {
44+
deleteDir()
45+
}
46+
}
47+
}
48+
stage('Test') {
49+
parallel {
50+
stage("Coverage") {
51+
environment {
52+
CODECOV_TOKEN = credentials('jenkins-codecov-token')
53+
}
54+
agent {
55+
label 'linux'
56+
}
57+
steps {
58+
dir('src/github.com/docker/app') {
59+
checkout scm
60+
sh 'make -f docker.Makefile coverage'
61+
archiveArtifacts '_build/ci-cov/all.out'
62+
archiveArtifacts '_build/ci-cov/coverage.html'
63+
sh 'curl -s https://codecov.io/bash | bash -s - -f _build/ci-cov/all.out -K'
64+
}
65+
}
66+
}
67+
stage("Gradle test") {
68+
agent {
69+
label 'linux'
70+
}
71+
steps {
72+
dir('src/github.com/docker/app') {
73+
checkout scm
74+
dir("bin") {
75+
unstash "binaries"
76+
}
77+
sh 'make -f docker.Makefile gradle-test'
78+
}
79+
}
80+
}
81+
stage("Test Linux") {
82+
agent {
83+
label 'linux'
84+
}
85+
steps {
86+
dir('src/github.com/docker/app') {
87+
unstash 'binaries'
88+
unstash 'e2e'
89+
sh './docker-app-e2e-linux'
90+
}
91+
}
92+
post {
93+
always {
94+
deleteDir()
95+
}
96+
}
97+
}
98+
stage("Test Mac") {
99+
agent {
100+
label "mac"
101+
}
102+
steps {
103+
dir('src/github.com/docker/app') {
104+
unstash 'binaries'
105+
unstash 'e2e'
106+
sh './docker-app-e2e-darwin'
107+
}
108+
}
109+
post {
110+
always {
111+
deleteDir()
112+
}
113+
}
114+
}
115+
stage("Test Win") {
116+
agent {
117+
label "windows"
118+
}
119+
steps {
120+
dir('src/github.com/docker/app') {
121+
unstash "binaries"
122+
unstash 'e2e'
123+
bat 'docker-app-e2e-windows.exe'
124+
}
125+
}
126+
post {
127+
always {
128+
deleteDir()
129+
}
130+
}
131+
}
132+
}
133+
}
134+
stage('Release') {
135+
agent {
136+
label "linux"
137+
}
138+
when {
139+
buildingTag()
140+
}
141+
steps {
142+
dir('src/github.com/docker/app') {
143+
unstash 'artifacts'
144+
echo "Releasing $TAG_NAME"
145+
dir('bin') {
146+
release('docker/app')
147+
}
148+
}
149+
}
150+
post {
151+
always {
152+
deleteDir()
153+
}
154+
}
155+
}
156+
}
157+
}
158+
159+
def release(repo) {
160+
withCredentials([[$class: 'StringBinding', credentialsId: 'github-release-token', variable: 'GITHUB_TOKEN']]) {
161+
def data = "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$TAG_NAME\", \"draft\": true, \"prerelease\": true}"
162+
def url = "https://api.github.com/repos/$repo/releases"
163+
def reply = sh(returnStdout: true, script: "curl -sSf -H \"Authorization: token $GITHUB_TOKEN\" -H \"Accept: application/json\" -H \"Content-type: application/json\" -X POST -d '$data' $url")
164+
def release = readJSON text: reply
165+
url = release.upload_url.replace('{?name,label}', '')
166+
sh("for f in * ; do curl -sf -H \"Authorization: token $GITHUB_TOKEN\" -H \"Accept: application/json\" -H \"Content-type: application/octet-stream\" -X POST --data-binary \"@\${f}\" $url?name=\${f}; done")
167+
}
168+
}

0 commit comments

Comments
 (0)