Skip to content

Commit

Permalink
Authenticated pulls to build artifacts pipeline (gravitational#15781)
Browse files Browse the repository at this point in the history
  • Loading branch information
logand22 authored Aug 23, 2022
1 parent ced7d63 commit 711ccb2
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 4 deletions.
72 changes: 71 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2094,15 +2094,22 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar go
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- mkdir -m0700 $GNUPG_DIR
- echo "$GPG_RPM_SIGNING_ARCHIVE" | base64 -d | tar -xzf - -C $GNUPG_DIR
- chown -R root:root $GNUPG_DIR
- make rpm
- rm -rf $GNUPG_DIR
environment:
ARCH: amd64
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
GNUPG_DIR: /tmpfs/gnupg
GPG_RPM_SIGNING_ARCHIVE:
Expand Down Expand Up @@ -2276,15 +2283,22 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar go
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- mkdir -m0700 $GNUPG_DIR
- echo "$GPG_RPM_SIGNING_ARCHIVE" | base64 -d | tar -xzf - -C $GNUPG_DIR
- chown -R root:root $GNUPG_DIR
- make -C e rpm
- rm -rf $GNUPG_DIR
environment:
ARCH: amd64
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
FIPS: "yes"
GNUPG_DIR: /tmpfs/gnupg
Expand Down Expand Up @@ -2465,11 +2479,18 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- make deb
environment:
ARCH: amd64
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
OSS_TARBALL_PATH: /go/artifacts
TMPDIR: /go
Expand Down Expand Up @@ -2633,11 +2654,18 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- make -C e deb
environment:
ARCH: amd64
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
FIPS: "yes"
RUNTIME: fips
Expand Down Expand Up @@ -2959,15 +2987,22 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar go
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- mkdir -m0700 $GNUPG_DIR
- echo "$GPG_RPM_SIGNING_ARCHIVE" | base64 -d | tar -xzf - -C $GNUPG_DIR
- chown -R root:root $GNUPG_DIR
- make rpm
- rm -rf $GNUPG_DIR
environment:
ARCH: "386"
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
GNUPG_DIR: /tmpfs/gnupg
GPG_RPM_SIGNING_ARCHIVE:
Expand Down Expand Up @@ -3143,11 +3178,18 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- make deb
environment:
ARCH: "386"
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
OSS_TARBALL_PATH: /go/artifacts
TMPDIR: /go
Expand Down Expand Up @@ -4253,11 +4295,18 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- make deb
environment:
ARCH: arm64
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
OSS_TARBALL_PATH: /go/artifacts
TMPDIR: /go
Expand Down Expand Up @@ -4423,11 +4472,18 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- make deb
environment:
ARCH: arm
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
OSS_TARBALL_PATH: /go/artifacts
TMPDIR: /go
Expand Down Expand Up @@ -4593,15 +4649,22 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar go
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- mkdir -m0700 $GNUPG_DIR
- echo "$GPG_RPM_SIGNING_ARCHIVE" | base64 -d | tar -xzf - -C $GNUPG_DIR
- chown -R root:root $GNUPG_DIR
- make rpm
- rm -rf $GNUPG_DIR
environment:
ARCH: arm64
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
GNUPG_DIR: /tmpfs/gnupg
GPG_RPM_SIGNING_ARCHIVE:
Expand Down Expand Up @@ -4777,15 +4840,22 @@ steps:
image: docker
commands:
- apk add --no-cache bash curl gzip make tar go
- apk add --no-cache aws-cli
- cd /go/src/github.com/gravitational/teleport
- export VERSION=$(cat /go/.version.txt)
- aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin
public.ecr.aws
- mkdir -m0700 $GNUPG_DIR
- echo "$GPG_RPM_SIGNING_ARCHIVE" | base64 -d | tar -xzf - -C $GNUPG_DIR
- chown -R root:root $GNUPG_DIR
- make rpm
- rm -rf $GNUPG_DIR
environment:
ARCH: arm
AWS_ACCESS_KEY_ID:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_KEY
AWS_SECRET_ACCESS_KEY:
from_secret: TELEPORT_BUILD_USER_READ_ONLY_SECRET
ENT_TARBALL_PATH: /go/artifacts
GNUPG_DIR: /tmpfs/gnupg
GPG_RPM_SIGNING_ARCHIVE:
Expand Down Expand Up @@ -6496,6 +6566,6 @@ volumes:
medium: memory
---
kind: signature
hmac: c1662657f9cc4bd916ace21962d53852e8cfcb66b6af8b89e95602c882e0779c
hmac: 84dfa8fbc87b22389078ffeb706fa44d4bab9fbd6c6db7c42cc7e5c2a6f69cce

...
11 changes: 8 additions & 3 deletions dronegen/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,11 @@ func tagPackagePipeline(packageType string, b buildType) pipeline {
}

environment := map[string]value{
"ARCH": {raw: b.arch},
"TMPDIR": {raw: "/go"},
"ENT_TARBALL_PATH": {raw: "/go/artifacts"},
"ARCH": {raw: b.arch},
"TMPDIR": {raw: "/go"},
"ENT_TARBALL_PATH": {raw: "/go/artifacts"},
"AWS_ACCESS_KEY_ID": {fromSecret: "TELEPORT_BUILD_USER_READ_ONLY_KEY"},
"AWS_SECRET_ACCESS_KEY": {fromSecret: "TELEPORT_BUILD_USER_READ_ONLY_SECRET"},
}

dependentPipeline := fmt.Sprintf("build-%s-%s", b.os, b.arch)
Expand All @@ -451,8 +453,11 @@ func tagPackagePipeline(packageType string, b buildType) pipeline {

packageBuildCommands := []string{
fmt.Sprintf("apk add --no-cache %s", strings.Join(apkPackages, " ")),
`apk add --no-cache aws-cli`,
`cd /go/src/github.com/gravitational/teleport`,
`export VERSION=$(cat /go/.version.txt)`,
// Login to Amazon ECR Public
`aws ecr-public get-login-password --region us-east-1 | docker login -u="AWS" --password-stdin public.ecr.aws`,
}

makeCommand := fmt.Sprintf("make %s", packageType)
Expand Down

0 comments on commit 711ccb2

Please sign in to comment.