Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cloud][docker] use the private docker namespace #28286

Merged
merged 3 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .ci/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -328,21 +328,24 @@ 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)
}
}
}

/**
* @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
*/
Expand All @@ -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) {
Expand Down
11 changes: 7 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions dev-tools/packaging/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}}':
Expand Down Expand Up @@ -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}}':
Expand Down