forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild_OpenSearch_Dashboards_Jenkinsfile
165 lines (159 loc) · 6.29 KB
/
Build_OpenSearch_Dashboards_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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
lib = library(identifier: 'jenkins@20211123', retriever: legacySCM(scm))
pipeline {
agent none
options {
copyArtifactPermission('bundle-build-*')
buildDiscarder(logRotator(artifactNumToKeepStr: '1'))
}
parameters {
string(
name: 'INPUT_MANIFEST',
defaultValue: '1.3.0/opensearch-dashboards-1.3.0.yml',
description: 'Input manifest under the manifests folder, e.g. 2.0.0/opensearch-dashboards-2.0.0.yml.',
trim: true
)
}
stages {
stage('detect docker image + args') {
agent {
docker {
label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host'
image 'opensearchstaging/ci-runner:centos7-x64-arm64-jdkmulti-node10.24.1-cypress6.9.1-20211028'
alwaysPull true
}
}
steps {
script {
currentBuild.description = "$INPUT_MANIFEST"
dockerAgent = detectDockerAgent()
}
}
}
stage('build') {
parallel {
stage('build-linux-x64') {
agent {
docker {
label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host'
image dockerAgent.image
args dockerAgent.args
alwaysPull true
}
}
steps {
script {
def buildManifestObj = archiveAssembleUpload(
inputManifest: "manifests/${INPUT_MANIFEST}",
platform: 'linux',
architecture: 'x64',
stashName: 'test-stash-tar-x64'
)
String artifactUrl = buildManifestObj.getArtifactUrl('bundle-build', '1')
env.ARTIFACT_URL_X64 = artifactUrl
echo "artifactUrl (x64): ${artifactUrl}"
}
}
post {
always {
postCleanup()
}
}
}
stage('build-linux-arm64') {
agent none
stages {
stage('build-archive-linux-arm64') {
agent {
docker {
label 'Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host'
image dockerAgent.image
args dockerAgent.args
alwaysPull true
}
}
steps {
script {
buildArchive(
inputManifest: "manifests/${INPUT_MANIFEST}",
platform: 'linux',
architecture: 'arm64',
stashName: 'test-stash-tar-arm64'
)
}
}
post {
always {
postCleanup()
}
}
}
stage('assemble-archive-linux-arm64') {
agent {
docker {
label 'Jenkins-Agent-AL2-Arm64-C6g4xlarge-Docker-Host'
image dockerAgent.image
args dockerAgent.args
alwaysPull true
}
}
steps {
script {
def buildManifestObj = archiveAssembleUpload(
inputManifest: "manifests/${INPUT_MANIFEST}",
platform: 'linux',
architecture: 'arm64'
stashName: 'test-stash-tar-arm64'
)
String artifactUrl = buildManifestObj.getArtifactUrl('bundle-build', '1')
env.ARTIFACT_URL_ARM64 = artifactUrl
echo "artifactUrl (arm64): ${artifactUrl}"
}
}
post {
always {
postCleanup()
}
}
}
}
}
}
}
stage('docker build') {
steps {
node('Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host') {
script {
buildDockerImage(
inputManifest: "manifests/${INPUT_MANIFEST}",
artifactUrlX64: env.ARTIFACT_URL_X64,
artifactUrlArm64: env.ARTIFACT_URL_ARM64
)
}
}
}
}
}
post {
success {
node('Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host') {
script {
def stashed = lib.jenkins.Messages.new(this).get([
'build-linux-x64',
'build-archive-linux-arm64',
'assemble-archive-linux-arm64'
])
echo "SUCCESS: ${stashed}"
postCleanup()
}
}
}
failure {
node('Jenkins-Agent-AL2-X64-C54xlarge-Docker-Host') {
script {
echo 'FAILURE'
postCleanup()
}
}
}
}
}