-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
53 lines (46 loc) · 1.77 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
#!groovy
String[] architectures = ['amd64', 'armhf', 'aarch64']
String[] distributions = ['debian:buster', 'debian:bullseye', 'debian:bookworm', 'ubuntu:focal', 'ubuntu:hirsute', 'ubuntu:impish', 'ubuntu:jammy', 'ubuntu:kinetic']
String vendor = 'vitexsoftware'
String distribution = ''
String architecture = ''
String dockerfile = ''
String buildArgs = ''
String distroFamily = ''
String distroCodename = ''
architectures.each {
architecture = it
distributions.each {
distribution = it
dockerfile = distribution + '/Dockerfile'
buildArgs = ' --platform linux/' + architecture +
/* ' -t ' + vendor + '/' + distribution + */
' -f ' + dockerfile + ' ' + distribution
def dist = distribution.split(':')
distroFamily = dist[0]
distroCodename = dist[1]
def buildImage = ''
node( architecture ) {
ansiColor('xterm') {
stage('Build ' + architecture + '/' + distribution) {
checkout scm
buildImage = docker.build(vendor + '/' + distribution, buildArgs)
}
stage('Test ' + architecture + '/' + distribution) {
buildImage.inside {
sh 'whoami'
sh 'sudo apt install -y linuxlogo'
sh 'linuxlogo'
}
}
stage('Docker push ' + architecture + '/' + distroCodename + "-${env.BUILD_NUMBER}-SNAPSHOT" ) {
docker.withRegistry('https://registry.hub.docker.com', 'vitex_dockerhub') {
if(env.PUSH == 'true'){
buildImage.push( distroCodename + "-${env.BUILD_NUMBER}-SNAPSHOT")
}
}
}
}
}
}
}