Skip to content

Commit 7408f5b

Browse files
v1vmergify-bot
authored andcommitted
refactor pushDockerImages (#30414)
(cherry picked from commit 942b0e2) # Conflicts: # .ci/packaging.groovy
1 parent 32d9574 commit 7408f5b

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

.ci/packaging.groovy

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,29 +268,35 @@ pipeline {
268268
def pushCIDockerImages(Map args = [:]) {
269269
def arch = args.get('arch', 'amd64')
270270
catchError(buildResult: 'UNSTABLE', message: 'Unable to push Docker images', stageResult: 'FAILURE') {
271+
def defaultVariants = [ '' : 'beats', '-oss' : 'beats', '-ubi8' : 'beats' ]
272+
def completeVariant = ['-complete' : 'beats']
273+
// Cloud is not public available, therefore it should use the beats-ci namespace.
274+
def cloudVariant = ['-cloud' : 'beats-ci']
271275
if (env?.BEATS_FOLDER?.endsWith('auditbeat')) {
272-
tagAndPush(beatName: 'auditbeat', arch: arch)
276+
tagAndPush(beatName: 'auditbeat', arch: arch, variants: defaultVariants)
273277
} else if (env?.BEATS_FOLDER?.endsWith('filebeat')) {
274-
tagAndPush(beatName: 'filebeat', arch: arch)
278+
tagAndPush(beatName: 'filebeat', arch: arch, variants: defaultVariants)
275279
} else if (env?.BEATS_FOLDER?.endsWith('heartbeat')) {
276-
tagAndPush(beatName: 'heartbeat', arch: arch)
280+
tagAndPush(beatName: 'heartbeat', arch: arch, variants: defaultVariants)
277281
} else if (env?.BEATS_FOLDER?.endsWith('metricbeat')) {
278-
tagAndPush(beatName: 'metricbeat', arch: arch)
282+
tagAndPush(beatName: 'metricbeat', arch: arch, variants: defaultVariants)
279283
} else if (env?.BEATS_FOLDER?.endsWith('osquerybeat')) {
280-
tagAndPush(beatName: 'osquerybeat', arch: arch)
284+
tagAndPush(beatName: 'osquerybeat', arch: arch, variants: defaultVariants)
281285
} else if ("${env.BEATS_FOLDER}" == "packetbeat"){
282-
tagAndPush(beatName: 'packetbeat', arch: arch)
286+
tagAndPush(beatName: 'packetbeat', arch: arch, variants: defaultVariants)
283287
} else if ("${env.BEATS_FOLDER}" == "x-pack/elastic-agent") {
284-
tagAndPush(beatName: 'elastic-agent', arch: arch)
288+
tagAndPush(beatName: 'elastic-agent', arch: arch, variants: defaultVariants + completeVariant + cloudVariant)
285289
}
286290
}
287291
}
288292

289293
/**
290294
* @param beatName name of the Beat
291295
* @param arch what architecture
296+
* @param variants list of docker variants
292297
*/
293298
def tagAndPush(Map args = [:]) {
299+
<<<<<<< HEAD
294300
def beatName = args.beatName
295301
def arch = args.get('arch', 'amd64')
296302
def libbetaVer = env.BEAT_VERSION
@@ -355,7 +361,21 @@ def doTagAndPush(Map args = [:]) {
355361
} else if ( status > 0 ) {
356362
log(level: 'WARN', text: "${beatName} doesn't have ${variant} docker images. See https://github.com/elastic/beats/pull/21621")
357363
}
364+
=======
365+
def images = [ ]
366+
args.variants.each { variant, sourceNamespace ->
367+
images += [ source: "${sourceNamespace}/${args.beatName}${variant}",
368+
target: "observability-ci/${args.beatName}",
369+
arch: args.arch ]
370+
>>>>>>> 942b0e29a1 (refactor pushDockerImages (#30414))
358371
}
372+
pushDockerImages(
373+
registry: env.DOCKER_REGISTRY,
374+
secret: env.DOCKERELASTIC_SECRET,
375+
snapshot: env.SNAPSHOT,
376+
version: env.BEAT_VERSION,
377+
images: images
378+
)
359379
}
360380

361381
def prepareE2ETestForPackage(String beat){

.ci/scripts/docker-tag-push.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)