forked from edgexfoundry/edgex-compose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
59 lines (56 loc) · 1.88 KB
/
Jenkinsfile
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
pipeline {
agent {
label 'centos7-docker-4c-2g'
}
options {
timestamps()
quietPeriod(5) // wait a few seconds before starting to aggregate builds...??
durabilityHint 'PERFORMANCE_OPTIMIZED'
timeout(360)
}
parameters {
booleanParam defaultValue: false, description: 'Archive 3rd Party Images', name: 'ARCHIVE'
}
triggers {
issueCommentTrigger('.*^recheck$.*')
}
stages {
stage('Smoke Tests') {
when {
expression { !edgex.isReleaseStream() && !params.ARCHIVE }
}
steps {
build job: '/edgexfoundry/edgex-taf-pipelines/smoke-test', parameters: [string(name: 'SHA1', value: env.GIT_COMMIT), string(name: 'TEST_ARCH', value: 'All'), string(name: 'WITH_SECURITY', value: 'All')]
}
}
stage('Archive 3rd Party Images') {
when {
expression { params.ARCHIVE }
}
steps {
edgeXDockerLogin(settingsFile: 'ci-build-images-settings')
bootstrapBuildX()
script {
def images = sh(script: "grep image docker-compose.yml | grep -v edgexfoundry | awk '{print \$2}'", returnStdout: true).trim()
images.split('\n').each { image ->
sh "echo -e 'FROM ${image}' | docker buildx build --platform 'linux/amd64,linux/arm64' -t nexus3.edgexfoundry.org:10002/archive/${image} --push -"
}
}
}
}
}
post {
always {
edgeXInfraPublish()
}
cleanup {
cleanWs()
}
}
}
def bootstrapBuildX() {
sh 'docker buildx ls'
sh 'docker buildx create --name edgex-builder --platform linux/amd64,linux/arm64 --use'
sh 'docker buildx inspect --bootstrap'
sh 'docker buildx ls'
}