-
Notifications
You must be signed in to change notification settings - Fork 3
/
shippable.jobs.yml
65 lines (60 loc) · 3.11 KB
/
shippable.jobs.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
53
54
55
56
57
58
59
60
61
62
63
64
jobs:
######################### NATIVE WAR CI/CD JOBS #########################
# runCI job that builds and pushes artifact to S3
- name: java-ecr-runcli-elasticbeanstalk_runCI
type: runCI
steps:
- OUT: demo_java_ecr_img
# runCLI job that deploys image in ECR to Elastic Beanstalk - TEST
- name: demo_java_ecr_test_deploy
type: runCLI
steps:
- IN: demo_java_ecr_img
- IN: demo_java_ecr_awscli
- IN: demo_java_ecr_gitrepo
switch: off
- IN: demo_java_ecr_params
- IN: demo_java_ecr_params_test
- TASK:
# assign Shippable-injected variables to variables used in templates
- script: export ENVIRONMENT=$DEMO_JAVA_ECR_PARAMS_TEST_PARAMS_ENVIRONMENT PORT=$DEMO_JAVA_ECR_PARAMS_PARAMS_PORT IMAGE_REPO=$DEMO_JAVA_ECR_IMG_SOURCENAME IMAGE_TAG=$DEMO_JAVA_ECR_IMG_VERSIONNAME
# update template files with values in env variables
- script: cd $DEMO_JAVA_ECR_GITREPO_STATE/deploy
- script: pwd
- script: echo "updating templates with environment variables"
- script: shippable_replace Dockerrun.aws.json .ebextensions/environmentvariables.config
# initialize eb cli for app demo_java_ecr
- script: echo "initializing EB"
- script: eb init demo_java_ecr --platform docker-1.12.6 --region us-east-1 --keyname kp-us-east-1
# deploy latest image to elastic beanstalk
- script: echo "Deploying new version to Elastic Beanstalk"
- script: eb deploy $DEMO_JAVA_ECR_PARAMS_TEST_PARAMS_AWS_EB_ENVIRONMENT
# save latest deployment to state
- script: echo -e "IMAGE_REPO=$IMAGE_REPO\nIMAGE_TAG=$IMAGE_TAG" >> $DEMO_JAVA_ECR_TEST_DEPLOY_STATE/latest_test_deploy.env
# runCLI job that deploys image in ECR to Elastic Beanstalk
# based on previous deployment to TEST environment
- name: demo_java_ecr_prod_deploy
type: runCLI
steps:
- IN: demo_java_ecr_test_deploy
switch: off
- IN: demo_java_ecr_gitrepo
switch: off
- IN: demo_java_ecr_awscli
- IN: demo_java_ecr_params
- IN: demo_java_ecr_params_prod
- TASK:
# load last build version deployed to test from incoming state file
- script: source $DEMO_JAVA_ECR_TEST_DEPLOY_STATE/latest_test_deploy.env
# assign Shippable-injected variables to variables used in templates
- script: export ENVIRONMENT=$DEMO_JAVA_ECR_PARAMS_PROD_PARAMS_ENVIRONMENT PORT=$DEMO_JAVA_ECR_PARAMS_PARAMS_PORT
# update template files with values in env variables
- script: cd $DEMO_JAVA_ECR_GITREPO_STATE/deploy
- script: echo "updating templates with environment variables"
- script: shippable_replace Dockerrun.aws.json .ebextensions/environmentvariables.config
# initialize eb cli for app demo_java_ecr
- script: echo "initializing EB"
- script: eb init demo_java_ecr --platform docker-1.12.6 --region us-east-1 --keyname kp-us-east-1
# deploy latest image to elastic beanstalk
- script: echo "Deploying new version to Elastic Beanstalk"
- script: eb deploy $DEMO_JAVA_ECR_PARAMS_PROD_PARAMS_AWS_EB_ENVIRONMENT