-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yml
52 lines (46 loc) · 1.88 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
49
50
51
52
version: 0.2
# Pre-requisites
# - Create CodeBuild project
# - Provide minimal github credentials to access public repo
phases:
pre_build:
on-failure: ABORT
commands:
- COMMIT=`git rev-parse --short HEAD`
- # Get semantic tags for commit otherwise get all tags for commit, sort and choose the last value
- TAG=`(git tag --contains $COMMIT | egrep "^[0-9]+\.[0-9]+\.[0-9]+$" || git tag --contains $COMMIT || echo '') | sort | tail -1`
- |
if [[ "$MODE" == "OnPush" ]]
then
# Get Tag || Get Branch || Alternate Branch Lookup || Get Committ
BRANCHTAG=`echo $TAG | grep . || git symbolic-ref -q --short HEAD || git name-rev $(git rev-parse --short HEAD) | cut -d' ' -f2 || git rev-parse --short HEAD`
else
BRANCHTAG=$BRANCHNAME
fi
- echo "Branchtag ${BRANCHTAG}; COMMITDATE=${COMMITDATE}; REPONAME=${REPONAME}; BRANCHNAME=${BRANCHNAME}"
- aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin ${ECR_REGISTRY}
- SSM_ROOT_PATH=/uc3/mrt/dev/
- DATAURL=`aws ssm get-parameter --name /uc3/mrt/dev/integ-tests/data-path --query "Parameter.Value" --output text`
build:
on-failure: ABORT
commands:
- |
docker build --push --quiet \
-t ${ECR_REGISTRY}/${REPONAME} \
.
- |
docker build --push --quiet \
-t ${ECR_REGISTRY}/mrt-it-chrome \
chrome-driver || echo "dockerhub rate limiting may occur"
- docker-compose up -d chrome
- |
if [ "$INTEG_TEST_ENV" != "none" ]
then
docker-compose run --rm \
-e DATAURL=$DATAURL \
-e INTEG_TEST_ENV=$INTEG_TEST_ENV \
-e INGEST_FILES=$INGEST_FILES \
-e AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI \
-e SSM_ROOT_PATH=$SSM_ROOT_PATH mrt-integ-tests
fi
- docker-compose down