Skip to content

Commit

Permalink
dronegen: Add -amd64 suffix to image tag to match what ghcr.io uses (
Browse files Browse the repository at this point in the history
…#36111)

Add an architecture-specific suffix to the image tag used by ghcr.io.

This will fix:
https://drone.platform.teleport.sh/gravitational/teleport/32161/9/8
  • Loading branch information
reedloden authored Dec 30, 2023
1 parent fbfcdf5 commit d8eac03
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
12 changes: 7 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1904,12 +1904,14 @@ steps:
- aws ecr get-login-password --profile staging --region=us-west-2 | docker login
-u="AWS" --password-stdin 146628656107.dkr.ecr.us-west-2.amazonaws.com
- make -C build.assets buildbox-centos7
- docker tag ghcr.io/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION-$DRONE_COMMIT_SHA
- docker tag ghcr.io/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION-amd64
146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION-$DRONE_COMMIT_SHA
- docker push 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION-$DRONE_COMMIT_SHA
- docker logout 146628656107.dkr.ecr.us-west-2.amazonaws.com
- aws ecr-public get-login-password --profile production --region=us-east-1 | docker
login -u="AWS" --password-stdin public.ecr.aws
- docker tag ghcr.io/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION public.ecr.aws/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION
- docker tag ghcr.io/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION-amd64
public.ecr.aws/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION
- docker push public.ecr.aws/gravitational/teleport-buildbox-centos7:$BUILDBOX_VERSION
volumes:
- name: awsconfig
Expand All @@ -1927,13 +1929,13 @@ steps:
- aws ecr get-login-password --profile staging --region=us-west-2 | docker login
-u="AWS" --password-stdin 146628656107.dkr.ecr.us-west-2.amazonaws.com
- make -C build.assets buildbox-centos7-fips
- docker tag ghcr.io/gravitational/teleport-buildbox-centos7-fips:$BUILDBOX_VERSION
- docker tag ghcr.io/gravitational/teleport-buildbox-centos7-fips:$BUILDBOX_VERSION-amd64
146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-buildbox-centos7-fips:$BUILDBOX_VERSION-$DRONE_COMMIT_SHA
- docker push 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-buildbox-centos7-fips:$BUILDBOX_VERSION-$DRONE_COMMIT_SHA
- docker logout 146628656107.dkr.ecr.us-west-2.amazonaws.com
- aws ecr-public get-login-password --profile production --region=us-east-1 | docker
login -u="AWS" --password-stdin public.ecr.aws
- docker tag ghcr.io/gravitational/teleport-buildbox-centos7-fips:$BUILDBOX_VERSION
- docker tag ghcr.io/gravitational/teleport-buildbox-centos7-fips:$BUILDBOX_VERSION-amd64
public.ecr.aws/gravitational/teleport-buildbox-centos7-fips:$BUILDBOX_VERSION
- docker push public.ecr.aws/gravitational/teleport-buildbox-centos7-fips:$BUILDBOX_VERSION
volumes:
Expand Down Expand Up @@ -12044,6 +12046,6 @@ image_pull_secrets:
- DOCKERHUB_CREDENTIALS
---
kind: signature
hmac: 362bdca89f7ae5fe897f6984533ff4d26993da5ed8084bbd64f3cf4991d2189b
hmac: 4ebdea923dc76d4f2565d5462d5ee04db6dd9e9e273620fac44fcc34d3259808

...
9 changes: 7 additions & 2 deletions dronegen/buildbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ func buildboxPipelineSteps() []step {
}

func buildboxPipelineStep(buildboxName string, fips bool) step {
var buildboxTagSuffix string
if buildboxName == "buildbox-centos7" {
// Drone-managed buildboxes are only amd64
buildboxTagSuffix = "-amd64"
}
if fips {
buildboxName += "-fips"
}
Expand All @@ -83,14 +88,14 @@ func buildboxPipelineStep(buildboxName string, fips bool) step {
// Build buildbox image
fmt.Sprintf(`make -C build.assets %s`, buildboxName),
// Retag for staging registry
fmt.Sprintf(`docker tag %s/gravitational/teleport-%s:$BUILDBOX_VERSION %s/gravitational/teleport-%s:$BUILDBOX_VERSION-$DRONE_COMMIT_SHA`, GitHubRegistry, buildboxName, StagingRegistry, buildboxName),
fmt.Sprintf(`docker tag %s/gravitational/teleport-%s:$BUILDBOX_VERSION%s %s/gravitational/teleport-%s:$BUILDBOX_VERSION-$DRONE_COMMIT_SHA`, GitHubRegistry, buildboxName, buildboxTagSuffix, StagingRegistry, buildboxName),
// Push to staging registry
fmt.Sprintf(`docker push %s/gravitational/teleport-%s:$BUILDBOX_VERSION-$DRONE_COMMIT_SHA`, StagingRegistry, buildboxName),
// Authenticate to production registry
`docker logout ` + StagingRegistry,
`aws ecr-public get-login-password --profile production --region=us-east-1 | docker login -u="AWS" --password-stdin ` + ProductionRegistry,
// Retag for production registry
fmt.Sprintf(`docker tag %s/gravitational/teleport-%s:$BUILDBOX_VERSION %s/gravitational/teleport-%s:$BUILDBOX_VERSION`, GitHubRegistry, buildboxName, ProductionRegistry, buildboxName),
fmt.Sprintf(`docker tag %s/gravitational/teleport-%s:$BUILDBOX_VERSION%s %s/gravitational/teleport-%s:$BUILDBOX_VERSION`, GitHubRegistry, buildboxName, buildboxTagSuffix, ProductionRegistry, buildboxName),
// Push to production registry
fmt.Sprintf(`docker push %s/gravitational/teleport-%s:$BUILDBOX_VERSION`, ProductionRegistry, buildboxName),
},
Expand Down

0 comments on commit d8eac03

Please sign in to comment.