Skip to content

Commit 031768d

Browse files
authored
Merge pull request #24 from topcoder-platform/dev-msv13
STS integration
2 parents 67a1f70 + ae71157 commit 031768d

File tree

2 files changed

+66
-70
lines changed

2 files changed

+66
-70
lines changed

.circleci/config.yml

Lines changed: 56 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,85 @@
11
version: 2
2+
defaults: &defaults
3+
docker:
4+
- image: docker:17.06.1-ce-git
5+
install_dependency: &install_dependency
6+
name: Installation of build and deployment dependencies.
7+
command: |
8+
apk update
9+
apk add --no-cache bash curl
10+
apk upgrade
11+
apk add --no-cache jq py-pip sudo
12+
sudo pip install awscli --upgrade
13+
install_deploysuite: &install_deploysuite
14+
name: Installation of install_deploysuite.
15+
command: |
16+
git clone --branch v1.3 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
17+
cp ./../buildscript/master_deploy.sh .
18+
cp ./../buildscript/buildenv.sh .
19+
cp ./../buildscript/awsconfiguration.sh .
20+
restore_cache_settings_for_build: &restore_cache_settings_for_build
21+
key: docker-tc-bus-api-{{ checksum "package-lock.json" }}
222

23+
save_cache_settings: &save_cache_settings
24+
key: docker-tc-bus-api-{{ checksum "package-lock.json" }}
25+
paths:
26+
- node_modules
27+
28+
run_build: &run_build
29+
name: Build of Docker image
30+
command: ./build.sh
331
jobs:
432
# Build & Deploy against development backend rer
533
"build-dev":
6-
docker:
7-
- image: docker:17.06.1-ce-git
34+
<<: *defaults
835
steps:
9-
# Initialization.
1036
- checkout
1137
- setup_remote_docker
12-
- run:
13-
name: Installation of build dependencies.
14-
command: apk add --no-cache bash
15-
16-
# Restoration of node_modules from cache.
17-
- restore_cache:
18-
key: docker-tc-bus-api-{{ checksum "package-lock.json" }}
19-
20-
# Build of Docker image.
21-
- run:
22-
name: Build of Docker image
23-
command: ./build.sh DEV
24-
25-
# Caching node modules.
26-
- save_cache:
27-
key: docker-tc-bus-api-{{ checksum "package-lock.json" }}
28-
paths:
29-
- node_modules
30-
31-
# Deployment.
32-
- run:
33-
name: Installing AWS client
34-
command: |
35-
apk add --no-cache jq py-pip sudo
36-
sudo pip install awscli --upgrade
37-
38+
- run: *install_dependency
39+
- run: *install_deploysuite
40+
- restore_cache: *restore_cache_settings_for_build
41+
- run: *run_build
42+
- save_cache: *save_cache_settings
3843
- deploy:
39-
command: ./deploy.sh DEV $CIRCLE_SHA1
44+
command: |
45+
./awsconfiguration.sh DEV
46+
source awsenvconf
47+
./buildenv.sh -e DEV -b dev-tc-bus-api-deployvar
48+
source buildenvvar
49+
./master_deploy.sh -d ECS -e DEV -t latest -s dev-global-appvar,dev-tc-bus-api-appvar -i tc-bus-api
50+
#./deploy.sh DEV $CIRCLE_SHA1
4051
4152
"build-prod":
42-
docker:
43-
- image: docker:17.06.1-ce-git
53+
<<: *defaults
4454
steps:
45-
# Initialization.
4655
- checkout
4756
- setup_remote_docker
48-
- run:
49-
name: Installation of build dependencies.
50-
command: apk add --no-cache bash
51-
52-
# Restoration of node_modules from cache.
53-
- restore_cache:
54-
key: docker-tc-bus-api-{{ checksum "package-lock.json" }}
55-
56-
# Build of Docker image.
57-
- run:
58-
name: Build of Docker image
59-
command: ./build.sh PROD
60-
61-
# Caching node modules.
62-
- save_cache:
63-
key: docker-tc-bus-api-{{ checksum "package-lock.json" }}
64-
paths:
65-
- node_modules
66-
67-
# Deployment.
68-
- run:
69-
name: Installing AWS client
70-
command: |
71-
apk add --no-cache jq py-pip sudo
72-
sudo pip install awscli --upgrade
73-
57+
- run: *install_dependency
58+
- run: *install_deploysuite
59+
- restore_cache: *restore_cache_settings_for_build
60+
- run: *run_build
61+
- save_cache: *save_cache_settings
7462
- deploy:
75-
command: ./deploy.sh PROD $CIRCLE_SHA1
63+
command: |
64+
./awsconfiguration.sh PROD
65+
source awsenvconf
66+
./buildenv.sh -e PROD -b prod-tc-bus-api-deployvar
67+
source buildenvvar
68+
./master_deploy.sh -d ECS -e PROD -t latest -s prod-global-appvar,prod-tc-bus-api-appvar -i tc-bus-api
69+
#./deploy.sh PROD $CIRCLE_SHA1
7670
7771
workflows:
7872
version: 2
7973
build:
8074
jobs:
8175
# Development builds are executed on "develop" branch only.
8276
- "build-dev":
77+
context : org-global
8378
filters:
8479
branches:
8580
only: ['dev']
8681
- "build-prod":
82+
context : org-global
8783
filters:
8884
branches:
8985
only: master

build.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ set -eo pipefail
66
# This script expects a single argument: NODE_ENV, which must be either
77
# "development" or "production".
88

9-
NODE_ENV=$1
9+
# NODE_ENV=$1
1010

11-
ENV=$1
12-
AWS_REGION=$(eval "echo \$${ENV}_AWS_REGION")
13-
AWS_ACCESS_KEY_ID=$(eval "echo \$${ENV}_AWS_ACCESS_KEY_ID")
14-
AWS_SECRET_ACCESS_KEY=$(eval "echo \$${ENV}_AWS_SECRET_ACCESS_KEY")
15-
AWS_ACCOUNT_ID=$(eval "echo \$${ENV}_AWS_ACCOUNT_ID")
16-
AWS_REPOSITORY=$(eval "echo \$${ENV}_AWS_REPOSITORY")
11+
# ENV=$1
12+
# AWS_REGION=$(eval "echo \$${ENV}_AWS_REGION")
13+
# AWS_ACCESS_KEY_ID=$(eval "echo \$${ENV}_AWS_ACCESS_KEY_ID")
14+
# AWS_SECRET_ACCESS_KEY=$(eval "echo \$${ENV}_AWS_SECRET_ACCESS_KEY")
15+
# AWS_ACCOUNT_ID=$(eval "echo \$${ENV}_AWS_ACCOUNT_ID")
16+
# AWS_REPOSITORY=$(eval "echo \$${ENV}_AWS_REPOSITORY")
1717

1818

19-
# Builds Docker image of the app.
20-
TAG=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/tc-bus-api:$CIRCLE_SHA1
21-
19+
# # Builds Docker image of the app.
20+
# TAG=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/tc-bus-api:$CIRCLE_SHA1
21+
TAG="tc-bus-api:latest"
2222
docker build -t $TAG .
2323

2424
# Copies "node_modules" from the created image, if necessary for caching.

0 commit comments

Comments
 (0)