From da4b94318442fd9674e8e606694a70ace819c434 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 7 Oct 2021 16:45:43 +0100 Subject: [PATCH] [cloud][docker] use the private docker namespace (#28286) --- .ci/packaging.groovy | 10 +++++++--- Jenkinsfile | 11 +++++++---- dev-tools/packaging/packages.yml | 5 +++-- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.ci/packaging.groovy b/.ci/packaging.groovy index a59ff4f2e40..4f960aaf3cd 100644 --- a/.ci/packaging.groovy +++ b/.ci/packaging.groovy @@ -328,14 +328,16 @@ def tagAndPush(Map args = [:]) { } variants.each { variant -> + // cloud docker images are stored in the private docker namespace. + def sourceNamespace = variant.equals('-cloud') ? 'beats-ci' : 'beats' tags.each { tag -> // TODO: // For backward compatibility let's ensure we tag only for amd64, then E2E can benefit from until // they support the versioning with the architecture if ("${arch}" == "amd64") { - doTagAndPush(beatName: beatName, variant: variant, sourceTag: libbetaVer, targetTag: "${tag}") + doTagAndPush(beatName: beatName, variant: variant, sourceTag: libbetaVer, targetTag: "${tag}", sourceNamespace: sourceNamespace) } - doTagAndPush(beatName: beatName, variant: variant, sourceTag: libbetaVer, targetTag: "${tag}-${arch}") + doTagAndPush(beatName: beatName, variant: variant, sourceTag: libbetaVer, targetTag: "${tag}-${arch}", sourceNamespace: sourceNamespace) } } } @@ -343,6 +345,7 @@ def tagAndPush(Map args = [:]) { /** * @param beatName name of the Beat * @param variant name of the variant used to build the docker image name +* @param sourceNamespace namespace to be used as source for the docker tag command * @param sourceTag tag to be used as source for the docker tag command, usually under the 'beats' namespace * @param targetTag tag to be used as target for the docker tag command, usually under the 'observability-ci' namespace */ @@ -351,7 +354,8 @@ def doTagAndPush(Map args = [:]) { def variant = args.variant def sourceTag = args.sourceTag def targetTag = args.targetTag - def sourceName = "${DOCKER_REGISTRY}/beats/${beatName}${variant}:${sourceTag}" + def sourceNamespace = args.sourceNamespace + def sourceName = "${DOCKER_REGISTRY}/${sourceNamespace}/${beatName}${variant}:${sourceTag}" def targetName = "${DOCKER_REGISTRY}/observability-ci/${beatName}${variant}:${targetTag}" def iterations = 0 retryWithSleep(retries: 3, seconds: 5, backoff: true) { diff --git a/Jenkinsfile b/Jenkinsfile index 75d4c17ad49..e14b0e86dd6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -460,13 +460,15 @@ def tagAndPush(Map args = [:]) { def variants = ["", "-oss", "-ubi8"] if(beatName == 'elastic-agent'){ - variants.add("-complete") - variants.add("-cloud") + variants.add("-complete") + variants.add("-cloud") } variants.each { variant -> + // cloud docker images are stored in the private docker namespace. + def sourceNamespace = variant.equals('-cloud') ? 'beats-ci' : 'beats' tags.each { tag -> - doTagAndPush(beatName: beatName, variant: variant, sourceTag: libbetaVer, targetTag: "${tag}-${arch}") + doTagAndPush(beatName: beatName, variant: variant, sourceTag: libbetaVer, targetTag: "${tag}-${arch}", sourceNamespace: sourceNamespace) } } } @@ -482,7 +484,8 @@ def doTagAndPush(Map args = [:]) { def variant = args.variant def sourceTag = args.sourceTag def targetTag = args.targetTag - def sourceName = "${DOCKER_REGISTRY}/beats/${beatName}${variant}:${sourceTag}" + def sourceNamespace = args.sourceNamespace + def sourceName = "${DOCKER_REGISTRY}/${sourceNamespace}/${beatName}${variant}:${sourceTag}" def targetName = "${DOCKER_REGISTRY}/observability-ci/${beatName}${variant}:${targetTag}" def iterations = 0 diff --git a/dev-tools/packaging/packages.yml b/dev-tools/packaging/packages.yml index 42bb9eba364..c0dc436f034 100644 --- a/dev-tools/packaging/packages.yml +++ b/dev-tools/packaging/packages.yml @@ -454,6 +454,7 @@ shared: <<: *agent_docker_spec extra_vars: image_name: '{{.BeatName}}-cloud' + repository: 'docker.elastic.co/beats-ci' # Deb/RPM spec for community beats. - &deb_rpm_spec @@ -1018,9 +1019,9 @@ specs: arch: amd64 types: [docker] spec: + <<: *elastic_docker_spec <<: *agent_docker_spec <<: *agent_docker_cloud_spec - <<: *elastic_docker_spec <<: *elastic_license_for_binaries files: '{{.BeatName}}{{.BinaryExt}}': @@ -1057,9 +1058,9 @@ specs: arch: arm64 types: [docker] spec: + <<: *elastic_docker_spec <<: *agent_docker_arm_spec <<: *agent_docker_cloud_spec - <<: *elastic_docker_spec <<: *elastic_license_for_binaries files: '{{.BeatName}}{{.BinaryExt}}':