-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildspec.yml
48 lines (45 loc) · 2.18 KB
/
buildspec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
version: 0.2
env:
shell: bash
git-credential-helper: yes
parameter-store:
DOCKER_HUB_USER: '/devops/shared/DOCKER_HUB_USER'
DOCKER_HUB_PASSWORD: '/devops/shared/DOCKER_HUB_PASSWORD'
phases:
install:
commands:
- n 18
- npm update -g npm
- curl -sL https://sentry.io/get-cli/ | bash
- aws --version
- node -v
- sentry-cli --version
pre_build:
commands:
- eval $(./aws-env --recursive)
- export APP_BUILD_VERSION=${CODEBUILD_RESOLVED_SOURCE_VERSION}__$(date -u '+%Y-%m-%dT%T+00:00')
- export PKG_VERSION=$(node -p "require('./package.json').version")
- export SENTRY_VERSION=${ENV}-${PKG_VERSION}_BUILD_${CODEBUILD_RESOLVED_SOURCE_VERSION}
- echo $APP_BUILD_VERSION > ./src/.version
- cat ./src/.version
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $DOCKER_REPOSITORY_URI
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
build:
commands:
- aws s3 cp s3://gameshq-build-pipeline-artifact-bucket/gameshq/google_credentials_games_api_staging.json ./google_credentials_games_api_staging.json
- aws s3 cp s3://gameshq-build-pipeline-artifact-bucket/gameshq/google_credentials_games_api_prod.json ./google_credentials_games_api_prod.json
- echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USER --password-stdin
- docker build -t $DOCKER_REPOSITORY_URI:latest .
- docker tag $DOCKER_REPOSITORY_URI:latest $DOCKER_REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- docker push $DOCKER_REPOSITORY_URI:latest
- docker push $DOCKER_REPOSITORY_URI:$IMAGE_TAG
- printf '[{"name":"%s","imageUri":"%s"}]' $CONTAINER_NAME $DOCKER_REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
- sentry-cli releases --org=x-team --project=gameshq-api new $SENTRY_VERSION
#- sentry-cli releases --org=x-team --project=gameshq-api set-commits --auto $SENTRY_VERSION
- sentry-cli releases --org=x-team --project=gameshq-api finalize $SENTRY_VERSION
- sentry-cli releases --org=x-team --project=gameshq-api deploys $SENTRY_VERSION new -e $ENV
artifacts:
files:
- imagedefinitions.json