Skip to content

Commit e950931

Browse files
committed
qa setup
1 parent 6470ea5 commit e950931

File tree

6 files changed

+221
-111
lines changed

6 files changed

+221
-111
lines changed

.circleci/config.yml

Lines changed: 146 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,119 @@
11
version: 2
22
defaults: &defaults
3-
docker:
4-
- image: maven:3.6.1-jdk-8
3+
docker:
4+
- image: maven:3.6.1-jdk-8
55

66
deploy_defaults: &deploy_defaults
7-
docker:
8-
- image: cimg/python:3.10.2
7+
docker:
8+
- image: cimg/python:3.10.2
99

1010
install_deploy_dependency: &install_deploy_dependency
11-
name: Installation of build and deployment dependencies.
12-
command: |
13-
pip3 install awscli --upgrade
11+
name: Installation of build and deployment dependencies.
12+
command: |
13+
pip3 install awscli --upgrade
14+
sudo curl -Lo /usr/local/bin/ecs-cli https://amazon-ecs-cli.s3.amazonaws.com/ecs-cli-linux-amd64-latest
15+
sudo chmod +x /usr/local/bin/ecs-cli
1416
1517
install_dependency: &install_dependency
16-
name: Installation of build dependencies.
17-
command: |
18-
# sed -i '/jessie-updates/d' /etc/apt/sources.list
19-
apt update
20-
apt install -y openssl git zip jq
21-
mkdir ~/awscli
22-
cd ~/awscli
23-
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.18.212.zip" -o "awscli-bundle.zip"
24-
unzip awscli-bundle.zip
25-
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
26-
cd ~/project
18+
name: Installation of build dependencies.
19+
command: |
20+
# sed -i '/jessie-updates/d' /etc/apt/sources.list
21+
apt update
22+
apt install -y openssl git zip jq
23+
mkdir ~/awscli
24+
cd ~/awscli
25+
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.18.212.zip" -o "awscli-bundle.zip"
26+
unzip awscli-bundle.zip
27+
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
28+
cd ~/project
2729
2830
install_deploysuite: &install_deploysuite
29-
name: Installation of install_deploysuite.
30-
command: |
31-
git clone --branch v1.4.14 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
32-
cp ./../buildscript/master_deploy.sh .
33-
cp ./../buildscript/buildenv.sh .
34-
cp ./../buildscript/awsconfiguration.sh .
35-
cp ./../buildscript/buildproperties.sh .
31+
name: Installation of install_deploysuite.
32+
command: |
33+
git clone --branch v1.4.14 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
34+
cp ./../buildscript/master_deploy.sh .
35+
cp ./../buildscript/buildenv.sh .
36+
cp ./../buildscript/awsconfiguration.sh .
37+
cp ./../buildscript/buildproperties.sh .
3638
3739
fetch_component_src: &fetch_component_src
38-
name: Installation of fetch_component_src.
39-
command: |
40-
git clone --branch ${GRPC_BRANCH} https://github.com/topcoder-platform/online-review-interface-definition ../online-review-interface-definition
41-
git clone --branch ${COMPONENT_BRANCH} https://github.com/topcoder-platform/tc-online-review-backend ../tc-online-review-backend
42-
43-
build_components: &build_components
44-
name: Building of components
45-
command: |
46-
cd ../online-review-interface-definition
47-
mvn clean install
48-
cd ../tc-online-review-backend
49-
./install-third-dep.sh
50-
mvn -Dhttps.protocols=TLSv1.2 -DskipTests=true clean install
51-
cd ~/project
40+
name: Installation of fetch_component_src.
41+
command: |
42+
git clone --branch ${OR_INT_BRANCH} https://github.com/topcoder-platform/online-review-interface-definition ../online-review-interface-definition
43+
git clone --branch ${PLAT_INT_BRANCH} https://github.com/topcoder-platform/plat-interface-definition.git ../plat-interface-definition
44+
git clone --branch ${COMPONENT_BRANCH} https://github.com/topcoder-platform/tc-online-review-backend ../tc-online-review-backend
45+
46+
build_components: &build_components
47+
name: Building of components
48+
command: |
49+
cd ../online-review-interface-definition
50+
mvn clean install
51+
cd ../plat-interface-definition
52+
mvn clean install
53+
cd ../tc-online-review-backend
54+
./install-third-dep.sh
55+
mvn -Dhttps.protocols=TLSv1.2 -DskipTests=true clean install
56+
cd ~/project
5257
5358
workspace_persist: &workspace_persist
54-
root: ~/
55-
paths:
56-
- project
59+
root: ~/
60+
paths:
61+
- project
5762

5863
workspace_attach: &workspace_attach
59-
at: ./
64+
at: ./
6065

6166
restore_cache_settings_for_build: &restore_cache_settings_for_build
62-
key: tc-autopilot-{{ checksum "~/project/pom.xml" }}
67+
key: tc-autopilot-{{ checksum "~/project/pom.xml" }}
6368

6469
save_cache_settings: &save_cache_settings
65-
paths:
66-
- ~/.m2
67-
key: tc-autopilot-{{ checksum "~/project/pom.xml" }}
68-
69-
build_steps: &build_steps
70-
# Initialization.
71-
- run: *install_dependency
72-
- checkout
73-
- run: *install_deploysuite
74-
- run: *fetch_component_src
75-
- restore_cache: *restore_cache_settings_for_build
76-
- run: *build_components
77-
- run:
78-
name: "AWS Configuration"
79-
command: |
80-
./awsconfiguration.sh $BUILD_ENV
81-
source awsenvconf
82-
- run:
83-
name: "Buidling OR file"
84-
command: |
85-
source awsenvconf
86-
./buildproperties.sh -e $BUILD_ENV -k autopilotv1
87-
# mvn dependency:go-offline
88-
mvn clean package
89-
- save_cache: *save_cache_settings
90-
- persist_to_workspace: *workspace_persist
70+
paths:
71+
- ~/.m2
72+
key: tc-autopilot-{{ checksum "~/project/pom.xml" }}
73+
74+
build_steps: &build_steps # Initialization.
75+
- run: *install_dependency
76+
- checkout
77+
- run: *install_deploysuite
78+
- run: *fetch_component_src
79+
- restore_cache: *restore_cache_settings_for_build
80+
- run: *build_components
81+
- run:
82+
name: "AWS Configuration"
83+
command: |
84+
./awsconfiguration.sh $BUILD_ENV
85+
source awsenvconf
86+
- run:
87+
name: "Buidling OR file"
88+
command: |
89+
source awsenvconf
90+
./buildproperties.sh -e $BUILD_ENV -k autopilotv1
91+
# mvn dependency:go-offline
92+
mvn clean package
93+
- save_cache: *save_cache_settings
94+
- persist_to_workspace: *workspace_persist
9195

9296
deploy_steps: &deploy_steps
93-
- attach_workspace: *workspace_attach
94-
- setup_remote_docker
95-
- run: *install_deploy_dependency
96-
- run: *install_deploysuite
97-
- run:
98-
name: Build image
99-
command: |
100-
mv project/* .
101-
./buildimage.sh ${APPNAME}
102-
- deploy:
103-
name: Running MasterScript.
104-
command: |
105-
./awsconfiguration.sh $DEPLOY_ENV
106-
source awsenvconf
107-
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar
108-
source buildenvvar
109-
./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME}
110-
111-
97+
- attach_workspace: *workspace_attach
98+
- setup_remote_docker
99+
- run: *install_deploy_dependency
100+
- run: *install_deploysuite
101+
- run:
102+
name: Build image
103+
command: |
104+
mv project/* .
105+
./awsconfiguration.sh $DEPLOY_ENV
106+
source awsenvconf
107+
./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-buildvar,${LOGICAL_ENV}-${APPNAME}-deployvar
108+
source buildenvvar
109+
./buildimagev1.sh ${APPNAME}
110+
111+
- deploy:
112+
name: Running MasterScript.
113+
command: |
114+
source awsenvconf
115+
source buildenvvar
116+
./master_deploy.sh -d ECS -e $DEPLOY_ENV -m CLI -t latest -i ${APPNAME}
112117
113118
jobs:
114119
# Build & Deploy against development backend
@@ -117,21 +122,36 @@ jobs:
117122
environment:
118123
BUILD_ENV: "DEV"
119124
LOGICAL_ENV: "dev"
120-
COMPONENT_BRANCH: "grpc"
121-
GRPC_BRANCH: "develop"
122125
DEPLOY_ENV: "DEV"
126+
COMPONENT_BRANCH: "dev"
127+
OR_INT_BRANCH: "develop"
128+
PLAT_INT_BRANCH: "main"
123129
APPNAME: "tc-autopilot"
124130
steps: *build_steps
125131

132+
"build-qa":
133+
<<: *defaults
134+
environment:
135+
BUILD_ENV: "QA"
136+
LOGICAL_ENV: "qa"
137+
DEPLOY_ENV: "QA"
138+
COMPONENT_BRANCH: "qa"
139+
OR_INT_BRANCH: "qa"
140+
PLAT_INT_BRANCH: "main"
141+
APPNAME: "tc-online-review"
142+
steps: *build_steps
143+
126144
"build-prod":
127145
<<: *defaults
128146
environment:
129147
BUILD_ENV: "PROD"
130-
LOGICAL_ENV: "prod"
131-
DEPLOY_ENV: "PROD"
132-
COMPONENT_BRANCH: "master"
133-
APPNAME: "tc-autopilot"
134-
steps: *build_steps
148+
LOGICAL_ENV: "prod"
149+
DEPLOY_ENV: "PROD"
150+
COMPONENT_BRANCH: "master"
151+
OR_INT_BRANCH: "main"
152+
PLAT_INT_BRANCH: "main"
153+
APPNAME: "tc-autopilot"
154+
steps: *build_steps
135155

136156
deployDev:
137157
<<: *deploy_defaults
@@ -141,6 +161,14 @@ jobs:
141161
APPNAME: "tc-autopilot"
142162
steps: *deploy_steps
143163

164+
deployQa:
165+
<<: *deploy_defaults
166+
environment:
167+
DEPLOY_ENV: "QA"
168+
LOGICAL_ENV: "qa"
169+
APPNAME: "tc-autopilot"
170+
steps: *deploy_steps
171+
144172
deployProd:
145173
<<: *deploy_defaults
146174
environment:
@@ -154,31 +182,45 @@ workflows:
154182
build:
155183
jobs:
156184
- build-dev:
157-
context : org-global
185+
context: org-global
158186
filters:
159187
branches:
160188
only:
161189
- dev-maven
162-
- grpc
190+
191+
- build-qa:
192+
context: org-global
193+
filters:
194+
branches:
195+
only:
196+
- qa-maven
163197

164198
- build-prod:
165-
context : org-global
199+
context: org-global
166200
filters:
167201
branches:
168-
only: [ master-maven ]
202+
only: [master-maven]
169203

170204
- deployDev:
171-
context : org-global
205+
context: org-global
172206
requires:
173207
- build-dev
174-
filters:
208+
filters:
175209
branches:
176210
only:
177211
- dev-maven
178-
- grpc
212+
213+
- deployQa:
214+
context: org-global
215+
requires:
216+
- build-qa
217+
filters:
218+
branches:
219+
only:
220+
- qa-maven
179221

180222
- deployProd:
181-
context : org-global
223+
context: org-global
182224
requires:
183225
- build-prod
184226
filters: &filters-prod

ECSDockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Add ./target/auto-pilot-1.0-SNAPSHOT-spring-boot.jar /opt/autopilot/
1010
Add ./xml_phase_template.xsd /opt/autopilot/
1111
Add ./target/templates /opt/autopilot/templates/
1212

13-
CMD ["java", "-jar", "auto-pilot-1.0-SNAPSHOT-spring-boot.jar", "-poll", "1"]
13+
CMD ["java", "-jar", "auto-pilot-1.0-SNAPSHOT-spring-boot.jar", "-poll", "5"]

buildimagev1.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
APP_NAME=$1
4+
UPDATE_CACHE=""
5+
docker build -f ECSDockerfile -t $APP_NAME:latest .
6+
7+
echo "DB_SERVER=$DB_SERVER" >>api.env
8+
echo "DB_PORT=$DB_PORT" >>api.env
9+
echo "DB_INFORMIXSERVER=$DB_INFORMIXSERVER" >>api.env
10+
echo "DB_USERNAME=$DB_USERNAME" >>api.env
11+
echo "DB_PASSWORD=$DB_PASSWORD" >>api.env
12+
echo "DW_SERVER=$DW_SERVER" >>api.env
13+
echo "DW_PORT=$DW_PORT" >>api.env
14+
echo "DW_INFORMIXSERVER=$DW_INFORMIXSERVER" >>api.env
15+
echo "DW_USERNAME=$DW_USERNAME" >>api.env
16+
echo "DW_PASSWORD=$DW_PASSWORD" >>api.env
17+
echo "DB_DS1=$DB_DS1" >>api.env
18+
echo "DB_DS2=$DB_DS2" >>api.env
19+
echo "DB_DS3=$DB_DS3" >>api.env
20+
echo "DB_DS4=$DB_DS4" >>api.env
21+
echo "GRPC_PORT=$GRPC_PORT" >>api.env
22+
echo "GRPC_IMAGE=$GRPC_IMAGE" >>api.env
23+
24+
TAG=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_REPOSITORY:$CIRCLE_BUILD_NUM
25+
26+
sed -i='' "s|tc-autopilot:latest|$TAG|" docker-compose.yml
27+
sed -i='' "s|tc-or-grpc-server:latest|$GRPC_IMAGE|" docker-compose.yml

docker-compose-local.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3'
2+
services:
3+
tc-autopilot:
4+
image: tc-autopilot:latest
5+
build:
6+
context: .
7+
networks:
8+
default:
9+
name: tc-online-review_default
10+
external: true

0 commit comments

Comments
 (0)