Skip to content

Commit

Permalink
cherry pick from #894
Browse files Browse the repository at this point in the history
  • Loading branch information
franck committed Feb 8, 2020
1 parent 34cf37b commit a4fe8e8
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 53 deletions.
27 changes: 20 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ env:
- IMAGE_TAG=${COMMIT}

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

matrix:
include:
- env: DEPLOY=none
- env: DEPLOY=dev
if: branch = master
deploy:
provider: script
script: TRAVIS_DOCKER_REPO_NAME=$DOCKER_CI_REPO_NAME
TRAVIS_PROFILE=$AWS_PROFILE_DEV
TRAVIS_AWS_ACCESS_KEY_ID=$AWS_ACCOUNT_USER_ID_DEV
TRAVIS_AWS_SECRET_ACCESS_KEY=$AWS_ACCOUNT_SECRET_DEV
TRAVIS_AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
./deploy.sh
on:
branch: master
# For DEV, we are using AWS Codebuild for the deployment (NOT TRAVIS)
# We comment out the DEV option
# This will need to be evaluated going forward (shall we revert back to TRAVIS for deployment?)
Expand All @@ -94,15 +103,19 @@ matrix:
if: tag IS present
deploy:
provider: script
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
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
on:
branch: master
tags: true
- env: DEPLOY=prod
if: tag IS present
deploy:
provider: script
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 '/*'
# TODO - Distribution-id uses a hardcoded value
# This will ONLY work for the main Unee-T installation but no other Unee-T Installation
# This is a problem we need to fix
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 '/*'
# END - TODO - Distribution-id uses a hardcoded value
on:
branch: master
tags: true
46 changes: 0 additions & 46 deletions buildspec.yml

This file was deleted.

46 changes: 46 additions & 0 deletions buildspec.yml.deprecated
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# #This file is used by AWS codebuild.
# ---
# version: 0.2

# env:
# variables:
# IMAGE_REPO_NAME: uneet/frontend
# parameter-store:
# DOCKER_USERNAME: DOCKER_USERNAME
# DOCKER_PASSWORD: DOCKER_PASSWORD

# phases:
# pre_build:
# commands:
# - echo Logging into Docker Hub...
# - docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
# - IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
# - echo image that we are using is $IMAGE_TAG

# install:
# runtime-versions:
# docker: 18

# build:
# commands:
# - echo Build starting on `date`
# - echo Build the Docker image...
# - echo We are using the docker image available at $IMAGE_REPO_NAME
# - echo image that we are using is $IMAGE_TAG
# - echo we are using the latest build for that image for deployment
# - 'sed -i "s,<\!-- COMMIT: -->,<\!-- COMMIT: $CODEBUILD_RESOLVED_SOURCE_VERSION -->,g" client/main.html'
# - docker build -t $IMAGE_REPO_NAME:latest .
# - docker tag $IMAGE_REPO_NAME:latest $IMAGE_REPO_NAME:$IMAGE_TAG

# post_build:
# commands:
# - test "$CODEBUILD_BUILD_SUCCEEDING" == "1" || exit 1
# # START - Why do we need to push the Docker image to Docker Hub again??
# #- echo Pushing build to Docker Hub...
# #- docker push $IMAGE_REPO_NAME:latest
# #- docker push $IMAGE_REPO_NAME:$IMAGE_TAG
# #- printf '[{"name":"%s","imageUri":"%s"}]' meteor $IMAGE_REPO_NAME:$IMAGE_TAG > $CODEBUILD_SRC_DIR/imagedefinitions.json
# # END - Why do we need to push the Docker image to Docker Hub again??

# artifacts:
# files: imagedefinitions.json

0 comments on commit a4fe8e8

Please sign in to comment.