70
70
cf restage analytics-reporter-api-develop
71
71
cf logout
72
72
73
+ staging_deploy_deploy :
74
+ docker :
75
+ - image : cimg/node:16.19.1-browsers
76
+ environment :
77
+ POSTGRES_USER : postgres
78
+ NODE_ENV : test
79
+ - image : circleci/postgres:9.5-alpine
80
+ environment :
81
+ POSTGRES_DB : analytics-api-test
82
+ steps :
83
+ - checkout
84
+
85
+ - restore_cache :
86
+ keys :
87
+ - v1-dependencies-{{ checksum "package.json" }}
88
+ - v1-dependencies-
89
+
90
+ - run :
91
+ name : install dependencies
92
+ command : npm install
93
+
94
+ - save_cache :
95
+ paths :
96
+ - ./node_modules
97
+ key : v1-dependencies-{{ checksum "package.json" }}
98
+
99
+ - run :
100
+ name : run tests
101
+ command : npm test
102
+
103
+ - run :
104
+ name : Replace Data URL in manifest.yml file when deploying to staging
105
+ command : |
106
+ sudo apt-get update
107
+ sudo apt-get install gettext
108
+ sed -i 's@name: analytics-reporter-api@name: analytics-reporter-api-staging@g' manifest.yml
109
+ sed -i 's@- analytics-reporter-database@- analytics-reporter-database-staging
110
+ mv manifest.yml manifest.yml.src
111
+ envsubst < manifest.yml.src > manifest.yml
112
+
113
+ - run :
114
+ name : Run sed on entrypoint.sh when deploying to staging
115
+ command : |
116
+ sed -i 's@NEW_RELIC_APP_NAME="analytics-reporter-api"@NEW_RELIC_APP_NAME="analytics-reporter-api-staging"@g' entrypoint.sh
117
+
118
+ - run :
119
+ name : Delete Knexfile.js and drop sufffix on Knexfile.js.cloudgov
120
+ command : |
121
+ rm knexfile.js
122
+ mv knexfile.js.cloudgov knexfile.js
123
+
124
+ - run :
125
+ name : Install CF CLI
126
+ command : |
127
+ sudo curl -v -L -o cf8-cli-installer_8.7.4_x86-64.deb 'https://packages.cloudfoundry.org/stable?release=debian64&version=8.7.4'
128
+ sudo dpkg -i cf8-cli-installer_8.7.4_x86-64.deb
129
+
130
+ - run :
131
+ name : deploy
132
+ command : |
133
+ set -e
134
+ # Log into cloud.gov
135
+ cf api api.fr.cloud.gov
136
+ cf login -u $CF_STAGING_SPACE_DEPLOYER_USERNAME -p $CF_STAGING_SPACE_DEPLOYER_PASSWORD -o gsa-opp-analytics -s analytics-staging
137
+ cat manifest.yml
138
+ cf push -f "./manifest.yml"
139
+ cf set-env analytics-reporter-api-staging API_DATA_GOV_SECRET "$API_SECRET"
140
+ cf restage analytics-reporter-api-staging
141
+ cf logout
73
142
workflows :
74
143
develop_workflow :
75
144
jobs :
@@ -79,13 +148,13 @@ workflows:
79
148
only :
80
149
- develop
81
150
82
- # staging:
83
- # jobs:
84
- # # - staging_deploy:
85
- # filters:
86
- # branches:
87
- # only:
88
- # - staging
151
+ staging :
152
+ jobs :
153
+ - staging_deploy :
154
+ filters :
155
+ branches :
156
+ only :
157
+ - staging
89
158
90
159
# main_workflow:
91
160
# jobs:
0 commit comments