Skip to content

Commit

Permalink
Fix drone publishing for teleport operator (#15065)
Browse files Browse the repository at this point in the history
Fix teleport-operator
  • Loading branch information
logand22 authored Jul 30, 2022
1 parent 39c3575 commit c6a9fa0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
16 changes: 15 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5028,6 +5028,10 @@ steps:
GOPATH: /go
OS: linux
ARCH: amd64
QUAY_USERNAME:
from_secret: QUAYIO_DOCKER_USERNAME
QUAY_PASSWORD:
from_secret: QUAYIO_DOCKER_PASSWORD
AWS_ACCESS_KEY_ID:
from_secret: STAGING_TELEPORT_DRONE_USER_ECR_KEY
AWS_SECRET_ACCESS_KEY:
Expand All @@ -5038,6 +5042,7 @@ steps:
commands:
- apk add --no-cache make bash aws-cli
- chown -R $UID:$GID /go
- docker login -u="$QUAY_USERNAME" -p="$QUAY_PASSWORD" quay.io
- aws ecr get-login-password --region us-west-2 | docker login -u="AWS" --password-stdin 146628656107.dkr.ecr.us-west-2.amazonaws.com
- cd /go/src/github.com/gravitational/teleport
- make image-ci publish-ci
Expand Down Expand Up @@ -5561,25 +5566,30 @@ steps:
commands:
- apk add --no-cache aws-cli
- export VERSION=${DRONE_TAG##v}
- docker login -u="$STAGING_QUAY_USERNAME" -p="$STAGING_QUAY_PASSWORD" quay.io
- aws ecr get-login-password --region=us-west-2 | docker login -u="AWS" --password-stdin
146628656107.dkr.ecr.us-west-2.amazonaws.com
- echo "---> Pulling images for $${VERSION}"
- docker pull 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport:$${VERSION}
- docker pull 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-ent:$${VERSION}
- docker pull 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-ent:$${VERSION}-fips
- docker pull quay.io/gravitational/teleport-operator-ci:$${VERSION}
- echo "---> Tagging images for $${VERSION}"
- docker tag 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport:$${VERSION}
quay.io/gravitational/teleport:$${VERSION}
- docker tag 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-ent:$${VERSION}
quay.io/gravitational/teleport-ent:$${VERSION}
- docker tag 146628656107.dkr.ecr.us-west-2.amazonaws.com/gravitational/teleport-ent:$${VERSION}-fips
quay.io/gravitational/teleport-ent:$${VERSION}-fips
- docker tag quay.io/gravitational/teleport-operator-ci:$${VERSION} quay.io/gravitational/teleport-operator:$${VERSION}
- docker logout quay.io
- docker logout 146628656107.dkr.ecr.us-west-2.amazonaws.com
- docker login -u="$QUAY_USERNAME" -p="$QUAY_PASSWORD" quay.io
- echo "---> Pushing images for $${VERSION}"
- docker push quay.io/gravitational/teleport:$${VERSION}
- docker push quay.io/gravitational/teleport-ent:$${VERSION}
- docker push quay.io/gravitational/teleport-ent:$${VERSION}-fips
- docker push quay.io/gravitational/teleport-operator:$${VERSION}
environment:
AWS_ACCESS_KEY_ID:
from_secret: STAGING_TELEPORT_DRONE_USER_ECR_KEY
Expand All @@ -5589,6 +5599,10 @@ steps:
from_secret: PRODUCTION_QUAYIO_DOCKER_PASSWORD
QUAY_USERNAME:
from_secret: PRODUCTION_QUAYIO_DOCKER_USERNAME
STAGING_QUAY_PASSWORD:
from_secret: QUAYIO_DOCKER_PASSWORD
STAGING_QUAY_USERNAME:
from_secret: QUAYIO_DOCKER_USERNAME
volumes:
- name: dockersock
path: /var/run
Expand Down Expand Up @@ -6077,6 +6091,6 @@ volumes:
name: drone-s3-debrepo-pvc
---
kind: signature
hmac: e3a5814199a0d80fff258945dc968a32fa0d6380fe235ea4f0cfcc506b0e881c
hmac: cfe9263c545d10b26f27dc10b8b5e5b833d0fca4333860550dae28113cef681a

...
11 changes: 9 additions & 2 deletions dronegen/promote.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,35 +97,42 @@ func buildDockerPromotionPipelineQuay() pipeline {
Name: "Pull/retag Docker images",
Image: "docker",
Environment: map[string]value{
"AWS_ACCESS_KEY_ID": {fromSecret: "STAGING_TELEPORT_DRONE_USER_ECR_KEY"},
"AWS_SECRET_ACCESS_KEY": {fromSecret: "STAGING_TELEPORT_DRONE_USER_ECR_SECRET"},
"STAGING_QUAY_USERNAME": {fromSecret: "QUAYIO_DOCKER_USERNAME"},
"STAGING_QUAY_PASSWORD": {fromSecret: "QUAYIO_DOCKER_PASSWORD"},
"QUAY_USERNAME": {fromSecret: "PRODUCTION_QUAYIO_DOCKER_USERNAME"},
"QUAY_PASSWORD": {fromSecret: "PRODUCTION_QUAYIO_DOCKER_PASSWORD"},
"AWS_ACCESS_KEY_ID": {fromSecret: "STAGING_TELEPORT_DRONE_USER_ECR_KEY"},
"AWS_SECRET_ACCESS_KEY": {fromSecret: "STAGING_TELEPORT_DRONE_USER_ECR_SECRET"},
},
Volumes: dockerVolumeRefs(),
Commands: []string{
"apk add --no-cache aws-cli",
"export VERSION=${DRONE_TAG##v}",
// authenticate with staging credentials
`docker login -u="$STAGING_QUAY_USERNAME" -p="$STAGING_QUAY_PASSWORD" ` + ProductionRegistryQuay,
"aws ecr get-login-password --region=us-west-2 | docker login -u=\"AWS\" --password-stdin " + StagingRegistry,
// pull staging images
"echo \"---> Pulling images for $${VERSION}\"",
fmt.Sprintf("docker pull %s/gravitational/teleport:$${VERSION}", StagingRegistry),
fmt.Sprintf("docker pull %s/gravitational/teleport-ent:$${VERSION}", StagingRegistry),
fmt.Sprintf("docker pull %s/gravitational/teleport-ent:$${VERSION}-fips", StagingRegistry),
fmt.Sprintf("docker pull %s/gravitational/teleport-operator-ci:$${VERSION}", ProductionRegistryQuay),
// retag images to production naming
"echo \"---> Tagging images for $${VERSION}\"",
fmt.Sprintf("docker tag %s/gravitational/teleport:$${VERSION} %s/gravitational/teleport:$${VERSION}", StagingRegistry, ProductionRegistryQuay),
fmt.Sprintf("docker tag %s/gravitational/teleport-ent:$${VERSION} %s/gravitational/teleport-ent:$${VERSION}", StagingRegistry, ProductionRegistryQuay),
fmt.Sprintf("docker tag %s/gravitational/teleport-ent:$${VERSION}-fips %s/gravitational/teleport-ent:$${VERSION}-fips", StagingRegistry, ProductionRegistryQuay),
fmt.Sprintf("docker tag %s/gravitational/teleport-operator-ci:$${VERSION} %s/gravitational/teleport-operator:$${VERSION}", ProductionRegistryQuay, ProductionRegistryQuay),
// authenticate with production credentials
"docker logout " + ProductionRegistryQuay,
"docker logout " + StagingRegistry,
"docker login -u=\"$QUAY_USERNAME\" -p=\"$QUAY_PASSWORD\" " + ProductionRegistryQuay,
// push production images
"echo \"---> Pushing images for $${VERSION}\"",
fmt.Sprintf("docker push %s/gravitational/teleport:$${VERSION}", ProductionRegistryQuay),
fmt.Sprintf("docker push %s/gravitational/teleport-ent:$${VERSION}", ProductionRegistryQuay),
fmt.Sprintf("docker push %s/gravitational/teleport-ent:$${VERSION}-fips", ProductionRegistryQuay),
fmt.Sprintf("docker push %s/gravitational/teleport-operator:$${VERSION}", ProductionRegistryQuay),
},
})

Expand Down

0 comments on commit c6a9fa0

Please sign in to comment.