-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuildspec.yaml
59 lines (57 loc) · 2.08 KB
/
buildspec.yaml
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
53
54
55
56
57
58
59
version: 0.2
env:
variables:
ARTIFACTS_BUCKET: galudy-visual-search-artifacts
S3_WORKFLOW_PREFIX: sagemaker-autopilot-step-functions-workflow
S3_API_PREFIX: sagemaker-autopilot-api-gateway
WORKFLOW_STACK_NAME: sagemaker-autopilot-ml-workflow
API_STACK_NAME: sagemaker-autopilot-api-gateway
phases:
install:
runtime-versions:
python: 3.7
commands:
- apt-get update
- apt-get install libblas-dev liblapack-dev -y
- pip install --upgrade pip boto3
- pip install stepfunctions aws-sam-cli
pre_build:
commands:
- echo "Run AWS SAM Build on workflow stack and API stack"
- export AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text)
- export SERVICE_BUILD_ROLE="arn:aws:iam::${AWS_ACCOUNT_ID}:role/service-role/codebuild-Attires24-App-service-role"
- echo "SAM package workflow template"
- |
sh -c """
cd autopilot-job-lambda
sam build -b deploy/
sam package --template-file deploy/template.yaml \
--output-template-file packaged.template.yaml \
--s3-bucket ${ARTIFACTS_BUCKET} \
--s3-prefix ${S3_WORKFLOW_PREFIX}
"""
- echo "SAM package REST API template"
build:
commands:
- echo Build started on `date`
- |
sh -c """
cd autopilot-job-lambda
sam deploy --stack-name ${WORKFLOW_STACK_NAME} \
--template-file packaged.template.yaml \
--parameter-overrides S3ApiCodePath="${ARTIFACTS_BUCKET}/${S3_API_PREFIX}" ServiceBuildRoleArn=${SERVICE_BUILD_ROLE} \
--capabilities CAPABILITY_NAMED_IAM \
--no-fail-on-empty-changeset
"""
- echo Done Deploying Stack
- echo "Deploying Step Functions State Machine"
- |
sh -c """
cd workflow/
python main.py
"""
- echo "Upload REST API Code to AWS S3"
- aws s3 cp api-gateway "s3://${ARTIFACTS_BUCKET}/${S3_API_PREFIX}" --recursive
post_build:
commands:
- echo "Build Completed"