@@ -63,7 +63,7 @@ pipeline {
63
63
}
64
64
}
65
65
steps {
66
- withCredentials([[$class : ' UsernamePasswordMultiBinding' , credentialsId : ' sonarqube-official' , passwordVariable : ' SONAR_SERVER_TOKEN' , usernameVariable : ' SONAR_SERVER_URL' ]]) {
66
+ withCredentials([[$class : ' UsernamePasswordMultiBinding' , credentialsId : ' sf- sonarqube-official' , passwordVariable : ' SONAR_SERVER_TOKEN' , usernameVariable : ' SONAR_SERVER_URL' ]]) {
67
67
sh ''' #!/bin/bash
68
68
cp /usr/src/coverage.out ./
69
69
echo sonar.host.url=${SONAR_SERVER_URL} >> sonar-project.properties
@@ -173,6 +173,64 @@ pipeline {
173
173
'''
174
174
}
175
175
}
176
+ stage(' Publish binaries' ) {
177
+ when {
178
+ branch ' master'
179
+ }
180
+ agent {
181
+ dockerfile {
182
+ filename ' Dockerfile'
183
+ additionalBuildArgs ' --target ci-go'
184
+ registryCredentialsId ' dockerhub-pro-credentials'
185
+ }
186
+ }
187
+ steps {
188
+ withCredentials([[$class : ' UsernamePasswordMultiBinding' , credentialsId : ' nexus' , usernameVariable : ' NEXUS_USR' , passwordVariable : ' NEXUS_PSW' ]]) {
189
+ script {
190
+ def platforms = [ " windows/amd64" , " linux/amd64" , " darwin/amd64" , " darwin/arm64" ]
191
+ def packageVersion = sh (
192
+ script : ' grep version ./wrappers/js/package.json | sed \' s/.*"version": "\\ (.*\\ )".*/\\ 1/\' ' ,
193
+ returnStdout : true
194
+ ). trim()
195
+ sh (script : ' mkdir -p /tmp/.cache' )
196
+ platforms. each {item ->
197
+ def nexusRepository = " nexus.build.msap.io/nexus"
198
+ def repositoryName = " releases"
199
+ def groupId = " aml-org.amf-custom-validator"
200
+ def packageName = " acv"
201
+
202
+ def i = item. indexOf(" /" )
203
+ def goOs = item. substring(0 , i)
204
+ def goArch = item. substring(i + 1 , item. length())
205
+ def artifactId = " acv" + ' -' + goOs + ' -' + goArch
206
+ def fileName = packageName + ' -' + goOs + ' -' + goArch
207
+ sh (script : " env GOOS=${ goOs} GOARCH=${ goArch} GOCACHE=/tmp/.cache go build -o ${ fileName} ./cmd/main.go" , returnStdout : true )
208
+
209
+ println ' nexusRepository=' + nexusRepository
210
+ println ' repositoryName=' + repositoryName
211
+ println ' groupId=' + groupId
212
+ println ' packageVersion=' + packageVersion
213
+ println ' artifactId=' + artifactId
214
+ println ' fileName=' + fileName
215
+ nexusArtifactUploader(
216
+ nexusUrl : " ${ nexusRepository} " ,
217
+ protocol : ' https' ,
218
+ credentialsId : ' nexus' ,
219
+ nexusVersion : ' nexus2' ,
220
+ repository : " ${ repositoryName} " ,
221
+ groupId : " ${ groupId} " ,
222
+ version : " ${ packageVersion} " ,
223
+ artifacts : [[
224
+ artifactId : " ${ artifactId} " ,
225
+ file : " ${ fileName} " ,
226
+ classifier : ' '
227
+ ]]
228
+ )
229
+ }
230
+ }
231
+ }
232
+ }
233
+ }
176
234
}
177
235
}
178
236
0 commit comments