|
| 1 | +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 | + #Git Clone -change back to v1.3 or latest once counter var is generalized. |
| 16 | + command: | |
| 17 | + git clone --branch master https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript |
| 18 | + cp ./../buildscript/master_deploy.sh . |
| 19 | + cp ./../buildscript/buildenv.sh . |
| 20 | + cp ./../buildscript/awsconfiguration.sh . |
| 21 | + |
| 22 | +restore_cache_settings_for_build: &restore_cache_settings_for_build |
| 23 | + key: docker-pg-ifx-notify-{{ checksum "package-lock.json" }} |
| 24 | + |
| 25 | +save_cache_settings: &save_cache_settings |
| 26 | + key: docker-pg-ifx-notifyy-{{ checksum "package-lock.json" }} |
| 27 | + paths: |
| 28 | + - node_modules |
| 29 | + |
| 30 | +run_build: &run_build |
| 31 | + name: Build of Docker image |
| 32 | + command: ./build.sh |
| 33 | + |
| 34 | +build_steps: &build_steps |
| 35 | + - checkout |
| 36 | + - setup_remote_docker |
| 37 | + - run: *install_dependency |
| 38 | + - run: *install_deploysuite |
| 39 | + - restore_cache: *restore_cache_settings_for_build |
| 40 | + - run: docker build -t postgres-ifx-processor:${DEPLOY_ENV}.${CIRCLE_BUILD_NUM} . |
| 41 | + - save_cache: *save_cache_settings |
| 42 | + - deploy: |
| 43 | + name: Running MasterScript. |
| 44 | + command: | |
| 45 | + ./awsconfiguration.sh ${DEPLOY_ENV} |
| 46 | + source awsenvconf |
| 47 | + ./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar |
| 48 | + source buildenvvar |
| 49 | + ./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer |
| 50 | +
|
| 51 | + echo "Running Masterscript - deploy postgres-ifx-processer producer" |
| 52 | + if [ -e ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json ]; then sudo rm -vf ${LOGICAL_ENV}-${APP_NAME}-consumer-deployvar.json; fi |
| 53 | + ./buildenv.sh -e ${DEPLOY_ENV} -b ${LOGICAL_ENV}-${APP_NAME}-producer-deployvar |
| 54 | + source buildenvvar |
| 55 | + ./master_deploy.sh -d ECS -e ${DEPLOY_ENV} -t latest -s ${GLOBAL_ENV}-global-appvar,${LOGICAL_ENV}-${APP_NAME}-appvar -i postgres-ifx-processer |
| 56 | +
|
| 57 | +jobs: |
| 58 | + # Build & Deploy against development backend |
| 59 | + "build-dev": |
| 60 | + <<: *defaults |
| 61 | + environment: |
| 62 | + DEPLOY_ENV: "DEV" |
| 63 | + LOGICAL_ENV: "DEV" |
| 64 | + GLOBAL_ENV: "dev" |
| 65 | + APP_NAME: "postgres-ifx-processer" |
| 66 | + steps: *build_steps |
| 67 | + # Build & Deploy against production backend |
| 68 | + "build-prod": |
| 69 | + <<: *defaults |
| 70 | + environment: |
| 71 | + DEPLOY_ENV: "PROD" |
| 72 | + LOGICAL_ENV: "PROD" |
| 73 | + GLOBAL_ENV: "prod" |
| 74 | + APP_NAME: "postgres-ifx-processer" |
| 75 | + steps: *build_steps |
| 76 | +workflows: |
| 77 | + version: 2 |
| 78 | + build: |
| 79 | + jobs: |
| 80 | + # Development builds are executed on "develop" branch only. |
| 81 | + - "build-dev": |
| 82 | + context : org-global |
| 83 | + filters: |
| 84 | + branches: |
| 85 | + only: |
| 86 | + - dev |
| 87 | + - "build-prod": |
| 88 | + context : org-global |
| 89 | + filters: |
| 90 | + branches: |
| 91 | + only: |
| 92 | + - master |
| 93 | + |
0 commit comments