Skip to content

Commit a4fe8e8

Browse files
author
franck
committed
cherry pick from #894
1 parent 34cf37b commit a4fe8e8

File tree

3 files changed

+66
-53
lines changed

3 files changed

+66
-53
lines changed

.travis.yml

+20-7
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ env:
3939
- IMAGE_TAG=${COMMIT}
4040

4141
before_install:
42-
# Removed command as pyenv is no longer found during deploy
43-
#- pyenv global 2.7.14 # For removing SNIMissingWarning warnings
4442
- curl https://install.meteor.com | /bin/sh
4543
- export PATH="$HOME/.meteor:$PATH"
4644
- pip install --user awscli
@@ -67,9 +65,9 @@ after_success:
6765
# If we have passed the Travis CI Test, we need to build the latest version of the Docker image
6866
# This latest version is the version that will be used when we will deploy in our environments (DEV, DEMO, PROD)
6967
# TODO: See https://github.com/unee-t/frontend/issues/893
70-
- echo START - We are building the latest version of the Docker image we need for deployment
71-
- docker build -t $DOCKER_CI_REPO_NAME
7268
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
69+
- echo START - We are building the latest version of the Docker image we need for deployment
70+
- docker build -t $DOCKER_CI_REPO_NAME:latest .
7371
- docker tag $DOCKER_CI_REPO_NAME:latest $DOCKER_CI_REPO_NAME:$IMAGE_TAG
7472
- echo We are pushing the latest Docker image as latest version in Dockerhub
7573
- docker push $DOCKER_CI_REPO_NAME:latest
@@ -79,7 +77,18 @@ after_success:
7977

8078
matrix:
8179
include:
82-
- env: DEPLOY=none
80+
- env: DEPLOY=dev
81+
if: branch = master
82+
deploy:
83+
provider: script
84+
script: TRAVIS_DOCKER_REPO_NAME=$DOCKER_CI_REPO_NAME
85+
TRAVIS_PROFILE=$AWS_PROFILE_DEV
86+
TRAVIS_AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_DEV
87+
TRAVIS_AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_DEV
88+
TRAVIS_AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
89+
./deploy.sh
90+
on:
91+
branch: master
8392
# For DEV, we are using AWS Codebuild for the deployment (NOT TRAVIS)
8493
# We comment out the DEV option
8594
# This will need to be evaluated going forward (shall we revert back to TRAVIS for deployment?)
@@ -94,15 +103,19 @@ matrix:
94103
if: tag IS present
95104
deploy:
96105
provider: script
97-
script: PROFILE=$AWS_PROFILE_DEMO AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_DEMO AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_DEMO AWS_REGION=$AWS_DEFAULT_REGION ./deploy.sh -d
106+
script: TRAVIS_PROFILE=$AWS_PROFILE_DEMO AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_DEMO AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_DEMO AWS_REGION=$AWS_DEFAULT_REGION ./deploy.sh -d
98107
on:
99108
branch: master
100109
tags: true
101110
- env: DEPLOY=prod
102111
if: tag IS present
103112
deploy:
104113
provider: script
105-
script: PROFILE=$AWS_PROFILE_PROD AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_PROD AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_PROD AWS_REGION=$AWS_DEFAULT_REGION ./deploy.sh -p && AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_PROD AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_PROD aws cloudfront create-invalidation --distribution-id E173XT6X8V4A18 --paths '/*'
114+
# TODO - Distribution-id uses a hardcoded value
115+
# This will ONLY work for the main Unee-T installation but no other Unee-T Installation
116+
# This is a problem we need to fix
117+
script: TRAVIS_PROFILE=$AWS_PROFILE_PROD AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_PROD AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_PROD AWS_REGION=$AWS_DEFAULT_REGION ./deploy.sh -p && AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_PROD AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_PROD aws cloudfront create-invalidation --distribution-id E173XT6X8V4A18 --paths '/*'
118+
# END - TODO - Distribution-id uses a hardcoded value
106119
on:
107120
branch: master
108121
tags: true

buildspec.yml

-46
This file was deleted.

buildspec.yml.deprecated

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# #This file is used by AWS codebuild.
2+
# ---
3+
# version: 0.2
4+
5+
# env:
6+
# variables:
7+
# IMAGE_REPO_NAME: uneet/frontend
8+
# parameter-store:
9+
# DOCKER_USERNAME: DOCKER_USERNAME
10+
# DOCKER_PASSWORD: DOCKER_PASSWORD
11+
12+
# phases:
13+
# pre_build:
14+
# commands:
15+
# - echo Logging into Docker Hub...
16+
# - docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
17+
# - IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
18+
# - echo image that we are using is $IMAGE_TAG
19+
20+
# install:
21+
# runtime-versions:
22+
# docker: 18
23+
24+
# build:
25+
# commands:
26+
# - echo Build starting on `date`
27+
# - echo Build the Docker image...
28+
# - echo We are using the docker image available at $IMAGE_REPO_NAME
29+
# - echo image that we are using is $IMAGE_TAG
30+
# - echo we are using the latest build for that image for deployment
31+
# - 'sed -i "s,<\!-- COMMIT: -->,<\!-- COMMIT: $CODEBUILD_RESOLVED_SOURCE_VERSION -->,g" client/main.html'
32+
# - docker build -t $IMAGE_REPO_NAME:latest .
33+
# - docker tag $IMAGE_REPO_NAME:latest $IMAGE_REPO_NAME:$IMAGE_TAG
34+
35+
# post_build:
36+
# commands:
37+
# - test "$CODEBUILD_BUILD_SUCCEEDING" == "1" || exit 1
38+
# # START - Why do we need to push the Docker image to Docker Hub again??
39+
# #- echo Pushing build to Docker Hub...
40+
# #- docker push $IMAGE_REPO_NAME:latest
41+
# #- docker push $IMAGE_REPO_NAME:$IMAGE_TAG
42+
# #- printf '[{"name":"%s","imageUri":"%s"}]' meteor $IMAGE_REPO_NAME:$IMAGE_TAG > $CODEBUILD_SRC_DIR/imagedefinitions.json
43+
# # END - Why do we need to push the Docker image to Docker Hub again??
44+
45+
# artifacts:
46+
# files: imagedefinitions.json

0 commit comments

Comments
 (0)