From fe5efd41c9721c74f27ef31adc6f426f3ac4a3e1 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 6 Oct 2021 16:15:59 +0100 Subject: [PATCH 1/3] [cloud][docker] use the private docker namespace --- dev-tools/packaging/packages.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev-tools/packaging/packages.yml b/dev-tools/packaging/packages.yml index 42bb9eba364..1ffda482285 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 @@ -1020,7 +1021,6 @@ specs: spec: <<: *agent_docker_spec <<: *agent_docker_cloud_spec - <<: *elastic_docker_spec <<: *elastic_license_for_binaries files: '{{.BeatName}}{{.BinaryExt}}': @@ -1059,7 +1059,6 @@ specs: spec: <<: *agent_docker_arm_spec <<: *agent_docker_cloud_spec - <<: *elastic_docker_spec <<: *elastic_license_for_binaries files: '{{.BeatName}}{{.BinaryExt}}': From e0166907b65be131a9ff13126203b667f5e71152 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 6 Oct 2021 16:18:44 +0100 Subject: [PATCH 2/3] Add earlier --- dev-tools/packaging/packages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dev-tools/packaging/packages.yml b/dev-tools/packaging/packages.yml index 1ffda482285..c0dc436f034 100644 --- a/dev-tools/packaging/packages.yml +++ b/dev-tools/packaging/packages.yml @@ -1019,6 +1019,7 @@ specs: arch: amd64 types: [docker] spec: + <<: *elastic_docker_spec <<: *agent_docker_spec <<: *agent_docker_cloud_spec <<: *elastic_license_for_binaries @@ -1057,6 +1058,7 @@ specs: arch: arm64 types: [docker] spec: + <<: *elastic_docker_spec <<: *agent_docker_arm_spec <<: *agent_docker_cloud_spec <<: *elastic_license_for_binaries From 07d582e54e30f01ff783bf4607b6b948de86c01d Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 6 Oct 2021 17:14:44 +0100 Subject: [PATCH 3/3] Customise docker namespace for Cloud --- .ci/packaging.groovy | 10 +++++++--- Jenkinsfile | 11 +++++++---- 2 files changed, 14 insertions(+), 7 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