Skip to content

Commit

Permalink
Merge pull request #72 from mozilla-iam/#-and-build
Browse files Browse the repository at this point in the history
chore(codebuild): Login to dockerhub
  • Loading branch information
bkochendorfer authored Jun 9, 2022
2 parents db6aebe + 9f3fa6e commit 5e677d5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ phases:
- echo "running for ${COMMIT_SHA} in ${DEPLOY_ENV}"
- aws eks update-kubeconfig --name $CLUSTER
- aws ecr get-login --region us-west-2 --no-include-email | bash
- echo $DOCKERHUB_PASSWORD | docker login -u $DOCKERHUB_USERNAME --pasword-stdin
build:
commands:
- if [ "$PR" = 1 ]; then myke docker; fi
Expand Down
22 changes: 22 additions & 0 deletions terraform/codebuild/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ resource "aws_codebuild_project" "build" {
name = "DOCKER_REPO"
value = aws_ecr_repository.registry.repository_url
}

environment_variable {
name = "DOCKERHUB_USERNAME"
type = "SECRETS_MANAGER"
value = "/CodeBuild/dockerhub:username"
}

environment_variable {
name = "DOCKERHUB_PASSWORD"
type = "SECRETS_MANAGER"
value = "/CodeBuild/dockerhub:password"
}

}

source {
Expand Down Expand Up @@ -115,6 +128,15 @@ resource "aws_iam_role_policy" "codebuild" {
"eks:DescribeCluster"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Resource": [
"arn:aws:secretsmanager:*:*:secret:/CodeBuild/dockerhub*"
],
"Action": [
"secretsmanager:GetSecretValue"
]
}
]
}
Expand Down

0 comments on commit 5e677d5

Please # to comment.