This repository has been archived by the owner on Apr 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml
145 lines (132 loc) · 5.66 KB
/
org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?xml version='1.0' encoding='UTF-8'?>
<org.jenkinsci.plugins.configfiles.GlobalConfigFiles plugin="config-file-provider@2.16.3">
<configs class="sorted-set">
<comparator class="org.jenkinsci.plugins.configfiles.GlobalConfigFiles$1"/>
<org.jenkinsci.plugins.configfiles.groovy.GroovyScript>
<id>Jenkinsfile</id>
<name>Jenkinsfile</name>
<comment>Jenkinsfile</comment>
<content>#!groovy
node {
checkout scm
def pipelineToRun = ""
try {
def pip = sh(returnStdout: true, script: "cat ci/jenkins").trim()
pipelineToRun = pip
} catch (err) {
// assume javascript if we don't find ci/jenkins
// TODO should try to understand which project to build instead
pipelineToRun = "javascript"
}
configFileProvider([configFile(fileId: pipelineToRun, variable: 'foundPipeline')]) {
load "$foundPipeline"
}
}()</content>
<providerId>org.jenkinsci.plugins.configfiles.groovy.GroovyScript</providerId>
</org.jenkinsci.plugins.configfiles.groovy.GroovyScript>
<org.jenkinsci.plugins.configfiles.groovy.GroovyScript>
<id>go-ipfs-jenkinsfile</id>
<name>go-ipfs-jenkinsfile</name>
<comment>Pipeline for go-ipfs task</comment>
<content>#!groovy
{ ->
def VERSION = "latest"
def IMAGE = "quay.io/ipfs/go-ipfs:$VERSION"
def image = docker.image(IMAGE)
ansiColor('xterm') {withEnv(["TERM=xterm-color"]){ timeout(time: 15, unit: 'MINUTES'){
stage("Build Container") {
node {
checkout scm
VERSION = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
IMAGE = "quay.io/ipfs/go-ipfs:$VERSION"
image = docker.image(IMAGE)
docker.build(IMAGE, "-f ci/Dockerfile.buildenv .")
}
}
def dexec = "docker exec"
stage("Checks") {
parallel(
'go fmt': { node {
image.withRun runArgs(), { c ->
sh "$dexec ${c.id} make test_go_fmt"
}
}},
'go build': { node {
// due to bug in Jenkins (JENKINS-38268) names of closure params have to be different
image.withRun runArgs(), { c1 ->
sh "$dexec ${c1.id} make cmd/ipfs/ipfs"
sh "$dexec ${c1.id} sh -xc 'cp cmd/ipfs/ipfs cmd/ipfs/dist; cd cmd/ipfs/dist; tar -czvf ../go-ipfs_linux-amd64.tar.gz .'"
sh "docker cp ${c1.id}:/go/src/github.com/ipfs/go-ipfs/cmd/ipfs/go-ipfs_linux-amd64.tar.gz go-ipfs_linux-amd64-${env.BUILD_NUMBER}.tar.gz"
archiveArtifacts artifacts: "go-ipfs_linux-amd64-${env.BUILD_NUMBER}.tar.gz", fingerprint: true
}
}}
)
}
stage("Tests & Coverage") {
parallel(
'sharness': { node {
image.withRun runArgs(), { c ->
sh "$dexec ${c.id} make -j3 -Otarget test_go_expensive"
}
}},
'go test': { node {
image.withRun runArgs(), { c1 ->
sh "$dexec ${c1.id} make -j3 -Otarget test_sharness_expensive"
}
}}
)
}}}}
}
@NonCPS
def runArgs() {
def pass = ["JENKINS_URL", "ghprbSourceBranch", "GIT_BRANCH", "ghprbActualCommit",
"TERM", "GIT_COMMIT", "BUILD_NUMBER", "ghprbPullId", "BUILD_URL"]
def override = [color: "t", TEST_NO_FUSE: "1", TEST_VERBOSE: "1"]
def newEnv = [:]
pass.each {c -> newEnv[c] = env[c] ?: ""}
newEnv.putAll(override)
return newEnv.collect { k, v -> "-e \"$k=$v\"" }.join(" ")
}</content>
<providerId>org.jenkinsci.plugins.configfiles.groovy.GroovyScript</providerId>
</org.jenkinsci.plugins.configfiles.groovy.GroovyScript>
<org.jenkinsci.plugins.configfiles.groovy.GroovyScript>
<id>javascript</id>
<name>javascript</name>
<comment>Pipeline for JavaScript projects</comment>
<content>#!groovy
{ ->
ansiColor('xterm') {
def VERSION = "latest"
def IMAGE_NAME = env.JOB_NAME.split(/\//)[0]
stage("Build Container") {
node {
checkout scm
VERSION = sh(returnStdout: true, script: "git rev-parse HEAD").trim()
writeFile encoding: 'utf-8', file: 'Dockerfile', text: 'FROM quay.io/ipfs/js-base:6.9.4'
sh "docker build -t quay.io/ipfs/$IMAGE_NAME:$VERSION ."
}
}
stage("Tests") {
parallel(
'nodejs':{ node {
sh "docker run quay.io/ipfs/$IMAGE_NAME:$VERSION 'npm run test:node'"
}},
'browser': { node {
sh "docker run --privileged quay.io/ipfs/$IMAGE_NAME:$VERSION 'npm run test:browser'"
}},
'coverage': { node {
sh "rm container-id || true"
sh "docker run --cidfile container-id quay.io/ipfs/$IMAGE_NAME:$VERSION 'npm run coverage'"
def CONTAINER_ID = readFile 'container-id'
sh "docker cp $CONTAINER_ID:/usr/src/app/coverage $WORKSPACE"
archiveArtifacts 'coverage/'
}}
)
}
}
}
</content>
<providerId>org.jenkinsci.plugins.configfiles.groovy.GroovyScript</providerId>
</org.jenkinsci.plugins.configfiles.groovy.GroovyScript>
</configs>
</org.jenkinsci.plugins.configfiles.GlobalConfigFiles>