-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.github
88 lines (77 loc) · 3.34 KB
/
Jenkinsfile.github
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
@Library('csm-shared-library') _
pipeline {
agent {
label "metal-gcp-builder"
}
triggers {
cron '@weekly'
}
options {
buildDiscarder(logRotator(numToKeepStr: "10"))
timestamps()
}
environment {
IS_STABLE = getBuildIsStable()
// Istio build uses these settings.
TAG = getDockerBuildVersion(isStable: env.IS_STABLE)
VERSION = "1.19.10"
BUILD_WITH_CONTAINER = "1"
DOCKER_BUILD_VARIANTS = "default distroless"
}
stages {
stage('Make gen-charts') {
steps {
sh "make --debug=all gen-charts"
}
}
stage('Make Build') {
steps {
sh "make --debug=all build"
}
}
stage('Make Docker') {
steps {
sh "make --debug=all docker"
}
}
stage('Retag') {
// Environment is set here because otherwise the values weren't consistent.
environment {
DISTROLESS_TAG = "${env.TAG}-distroless"
VARIANT = "cray1"
VARIANT_DISTRO_TAG = "${env.TAG}-${env.VARIANT}"
VARIANT_DISTROLESS_TAG = "${env.TAG}-${env.VARIANT}-distroless"
}
steps {
script {
sh "echo TAG=${env.TAG} DISTROLESS_TAG=${env.DISTROLESS_TAG} VARIANT_DISTRO_TAG=${env.VARIANT_DISTRO_TAG} VARIANT_DISTROLESS_TAG=${env.VARIANT_DISTROLESS_TAG}"
["istio/pilot", "istio/operator", "istio/proxyv2"].each { name ->
// Rebuild images to add LABEL layers on top
sh "echo 'FROM ${name}:${env.TAG}' | docker build ${getDockerBuildArgs(name: name, version: env.TAG, mountNetRC: false)} -t '${name}:${env.VARIANT_DISTRO_TAG}' -"
sh "echo 'FROM ${name}:${env.DISTROLESS_TAG}' | docker build ${getDockerBuildArgs(name: name, version: env.DISTROLESS_TAG, mountNetRC: false)} -t '${name}:${env.VARIANT_DISTROLESS_TAG}' -"
}
}
}
}
stage("Publish") {
// Environment is set here because otherwise the values weren't consistent.
environment {
DISTROLESS_TAG = "${env.TAG}-distroless"
VARIANT = "cray1"
VARIANT_DISTRO_TAG = "${env.TAG}-${env.VARIANT}"
VARIANT_DISTROLESS_TAG = "${env.TAG}-${env.VARIANT}-distroless"
}
steps {
script {
sh "echo TAG=${env.TAG} DISTROLESS_TAG=${env.DISTROLESS_TAG} VARIANT_DISTRO_TAG=${env.VARIANT_DISTRO_TAG} VARIANT_DISTROLESS_TAG=${env.VARIANT_DISTROLESS_TAG}"
publishCsmDockerImage(image: "istio/pilot", tag: env.VARIANT_DISTRO_TAG, isStable: env.IS_STABLE, snykTargetFile: "pilot/docker/Dockerfile.pilot")
publishCsmDockerImage(image: "istio/operator", tag: env.VARIANT_DISTRO_TAG, isStable: env.IS_STABLE, snykTargetFile: "operator/docker/Dockerfile.operator")
publishCsmDockerImage(image: "istio/proxyv2", tag: env.VARIANT_DISTRO_TAG, isStable: env.IS_STABLE, snykTargetFile: "pilot/docker/Dockerfile.proxyv2")
publishCsmDockerImage(image: "istio/pilot", tag: env.VARIANT_DISTROLESS_TAG, isStable: env.IS_STABLE, snykTargetFile: "pilot/docker/Dockerfile.pilot")
publishCsmDockerImage(image: "istio/operator", tag: env.VARIANT_DISTROLESS_TAG, isStable: env.IS_STABLE, snykTargetFile: "operator/docker/Dockerfile.operator")
publishCsmDockerImage(image: "istio/proxyv2", tag: env.VARIANT_DISTROLESS_TAG, isStable: env.IS_STABLE, snykTargetFile: "pilot/docker/Dockerfile.proxyv2")
}
}
}
}
}