-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathshippable.yml
140 lines (124 loc) · 4.29 KB
/
shippable.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Language setting http://docs.shippable.com/ci/languages/node/
language: node_js
# use this to control what branches get built.
# http://docs.shippable.com/ci/advancedOptions/branches/
branches:
only:
- master
# using pre-defined build variables
# full list http://docs.shippable.com/ci/advancedOptions/environmentVariables/
env:
global:
- TEST_RESULTS_DIR=$SHIPPABLE_REPO_DIR/shippable/testresults
- CODE_COVERAGE_DIR=$SHIPPABLE_REPO_DIR/shippable/codecoverage
- TESTS_LOC_DIR=$SHIPPABLE_REPO_DIR/tests
- MOD_LOC=$SHIPPABLE_REPO_DIR/node_modules/.bin/
- ECR_REPO=679404489841.dkr.ecr.us-east-1.amazonaws.com/nodeapp
build:
# http://docs.shippable.com/ci/shippableyml/#ci
ci:
# npm mirrors can sometimes be flacky, better to use shippable_retry
# http://docs.shippable.com/ci/advancedOptions/retry/
- shippable_retry npm install
- mkdir -p $TEST_RESULTS_DIR && mkdir -p $CODE_COVERAGE_DIR
- pushd $TESTS_LOC_DIR
- $MOD_LOC/mocha --recursive "$TESTS_LOC_DIR/**/*.spec.js" -R mocha-junit-reporter --reporter-options mochaFile=$TEST_RESULTS_DIR/testresults.xml
- $MOD_LOC/istanbul --include-all-sources cover -root "$SHIPPABLE_REPO_DIR/routes" $SHIPPABLE_REPO_DIR/node_modules/mocha/bin/_mocha -- -R spec-xunit-file --recursive "$TESTS_LOC_DIR/**/*.spec.js"
- $MOD_LOC/istanbul report cobertura --dir $CODE_COVERAGE_DIR
- popd
# http://docs.shippable.com/ci/shippableyml/#post_ci
post_ci:
- 'if [ $IS_PULL_REQUEST == "false" ] ; then docker build -t $ECR_REPO:$BRANCH.$BUILD_NUMBER .; fi'
- 'if [ $IS_PULL_REQUEST == "false" ] ; then docker push $ECR_REPO:$BRANCH.$BUILD_NUMBER ; fi'
- 'if [ $IS_PULL_REQUEST == "false" ] ; then echo "versionName=$BRANCH.$BUILD_NUMBER" > $JOB_STATE/deploy-eb-basic-image.env ; fi'
# Integrations are used to connect external resources to CI
# http://docs.shippable.com/integrations/overview/
integrations:
# adding ECR integration so that credentials are available to CI Job
# http://docs.shippable.com/integrations/imageRegistries/ecr/
hub:
- integrationName: dr-ecr
type: ecr
resources:
- name: deploy-eb-basic-image
type: image
flags:
- deploy-eb-basic
pointer:
sourceName: "679404489841.dkr.ecr.us-east-1.amazonaws.com/nodeapp"
seed:
versionName: "latest"
- name: deploy-eb-nginx-image
type: image
pointer:
sourceName: "679404489841.dkr.ecr.us-east-1.amazonaws.com/nginx"
seed:
versionName: "1.12.0"
- name: deploy-eb-env-params
type: params
flags:
- deploy-eb-basic
version:
params:
ENVIRONMENT: "dev"
PORT: 80
AWS_EB_ENVIRONMENT_SINGLE: "Sample-env"
AWS_EB_ENVIRONMENT_MULTI: "Sample-env-1"
AWS_EB_APPLICATION: "deploy-eb-basic"
- name: deploy-eb-basic-config
type: cliConfig
flags:
- deploy-eb-basic
integration: dr-aws
pointer:
region: us-east-1
- name: deploy-eb-basic-repo
type: gitRepo
flags:
- deploy-eb-basic
integration: dr-github
pointer:
sourceName: devops-recipes/deploy-beanstalk-basic
branch: master
jobs:
- name: deploy-beanstalk-basic_runCI
type: runCI
flags:
- deploy-eb-basic
steps:
- OUT: deploy-eb-basic-image
- name: deploy-eb-basic-deploy
type: runSh
flags:
- deploy-eb-basic
steps:
- IN: deploy-eb-basic-image
- IN: deploy-eb-basic-config
switch: off
- IN: deploy-eb-env-params
switch: off
- IN: deploy-eb-basic-repo
switch: off
- TASK:
- script: eb --version
- script: pushd $DEPLOYEBBASICREPO_STATE/single_container && ls -al
- script: shippable_replace Dockerrun.aws.json .elasticbeanstalk/config.yml
- script: eb deploy -v
- name: deploy-eb-multi-deploy
type: runSh
flags:
- deploy-eb-basic
steps:
- IN: deploy-eb-basic-image
- IN: deploy-eb-nginx-image
- IN: deploy-eb-basic-config
switch: off
- IN: deploy-eb-env-params
switch: off
- IN: deploy-eb-basic-repo
switch: off
- TASK:
- script: eb --version
- script: pushd $DEPLOYEBBASICREPO_STATE/multi_container && ls -al
- script: shippable_replace Dockerrun.aws.json .elasticbeanstalk/config.yml
- script: eb deploy -v