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

ci: add CodeBuild image build CI #177

Merged
merged 5 commits into from
Jun 18, 2024
Merged
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
35 changes: 35 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 0.2

env:
variables:
SERVICE_NAME: regtech-user-fi-management
CONTACTS_SECRET: cfpb/team/regtech/contact-info
IMAGE_SCANNER_SECRET: cfpb/team/regtech/image-scanner-creds
SMTP_CREDS_SECRET: cfpb/team/regtech/smtp-ses-creds
secrets-manager:
EMAIL_TO: "${CONTACTS_SECRET}:developers_all"
IMAGE_SCANNER_URL: "${IMAGE_SCANNER_SECRET}:url"
IMAGE_SCANNER_USERNAME: "${IMAGE_SCANNER_SECRET}:username"
IMAGE_SCANNER_PASSWORD: "${IMAGE_SCANNER_SECRET}:password"
SMTP_HOST: "${SMTP_CREDS_SECRET}:mail_server"
SMTP_PORT: "${SMTP_CREDS_SECRET}:smtp_port"
SMTP_USERNAME: "${SMTP_CREDS_SECRET}:username"
SMTP_PASSWORD: "${SMTP_CREDS_SECRET}:password"

phases:
install:
commands:
- codebuild-init && source ./env.sh
pre_build:
commands:
# Set envvars dependent on CodeBuild project's own envvars
- export IMAGE_NAME="cfpb/${NAMESPACE}/${SERVICE_NAME}"
- export IMAGE_TAG=$GIT_REF
- export REGISTRY_IMAGE_NAME="${ECR_ACCOUNT_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}"
- env | sort
build:
commands:
- docker build -t $REGISTRY_IMAGE_NAME .
- scan-image $REGISTRY_IMAGE_NAME $EMAIL_TO
- docker push $REGISTRY_IMAGE_NAME
- echo "Image ${REGISTRY_IMAGE_NAME} now available for use. Enjoy!"
Loading