Commit 8013a3d5 authored by BryceLTaylor's avatar BryceLTaylor

circleci config move environment variables to contexts

parent aa8bc7a8
...@@ -8,46 +8,44 @@ aliases: ...@@ -8,46 +8,44 @@ aliases:
username: $DOCKERHUB_USERNAME username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD password: $DOCKERHUB_PASSWORD
working_directory: ~/repo working_directory: ~/repo
- &environment # - &environment
CXX: g++-4.8 # CXX: g++-4.8
FASTLY_ACTIVATE_CHANGES: true # FASTLY_ACTIVATE_CHANGES: true
NODE_ENV: production # NODE_ENV: production
S3_LOCAL_DIR: build # S3_LOCAL_DIR: build
SENTRY_ORG: scratch-foundation # SENTRY_ORG: scratch-foundation
SKIP_CLEANUP: true # SKIP_CLEANUP: true
# WWW_VERSION: ${CIRCLE_SHA1:0:5} # WWW_VERSION: ${CIRCLE_SHA1:0:5}
- &env_production # - &env_production
API_HOST: https://api.scratch.mit.edu # API_HOST: https://api.scratch.mit.edu
ASSET_HOST: https://assets.scratch.mit.edu # ASSET_HOST: https://assets.scratch.mit.edu
BACKPACK_HOST: https://backpack.scratch.mit.edu # BACKPACK_HOST: https://backpack.scratch.mit.edu
CLOUDDATA_HOST: clouddata.scratch.mit.edu # CLOUDDATA_HOST: clouddata.scratch.mit.edu
FASTLY_API_KEY: ${FASTLY_API_KEY_PRODUCTION} # GA_TRACKER: UA-30688952-1
FASTLY_SERVICE_ID: ${FASTLY_SERVICE_ID_PRODUCTION} # PROJECT_HOST: https://projects.scratch.mit.edu
GA_TRACKER: UA-30688952-1 # RECAPTCHA_SITE_KEY: 6LeRbUwUAAAAAFYhKgk3G9OKWqE_OJ7Z-7VTUCbl
PROJECT_HOST: https://projects.scratch.mit.edu # ROOT_URL: https://scratch.mit.edu
RECAPTCHA_SITE_KEY: 6LeRbUwUAAAAAFYhKgk3G9OKWqE_OJ7Z-7VTUCbl # S3_BUCKET_NAME: scratch-www-production
ROOT_URL: https://scratch.mit.edu # SCRATCH_ENV: production
S3_BUCKET_NAME: scratch-www-production # SENTRY_DSN: https://ebc2f8a6bc7b44ca8fd902fd4f16b3d7@sentry.io/1357122
SCRATCH_ENV: production # SENTRY_PROJECT: scratch-30-production
SENTRY_DSN: https://ebc2f8a6bc7b44ca8fd902fd4f16b3d7@sentry.io/1357122 # STATIC_HOST: https://cdn2.scratch.mit.edu
SENTRY_PROJECT: scratch-30-production # TEST_PROJECT_ID: "414835599"
STATIC_HOST: https://cdn2.scratch.mit.edu # - &env_staging
TEST_PROJECT_ID: "414835599" # API_HOST: https://api.scratch.ly
- &env_staging # ASSET_HOST: https://assets.scratch.ly
API_HOST: https://api.scratch.ly # BACKPACK_HOST: https://backpack.scratch.ly
ASSET_HOST: https://assets.scratch.ly # CLOUDDATA_HOST: varserver2.scratch.ly
BACKPACK_HOST: https://backpack.scratch.ly # GA_TRACKER: UA-30688952-7
CLOUDDATA_HOST: varserver2.scratch.ly # PROJECT_HOST: https://projects.scratch.ly
GA_TRACKER: UA-30688952-7 # RECAPTCHA_SITE_KEY: 6LfukK4UAAAAAFR44yoZMhv8fj6xh-PMiIxwryG3
PROJECT_HOST: https://projects.scratch.ly # ROOT_URL: https://scratch.ly
RECAPTCHA_SITE_KEY: 6LfukK4UAAAAAFR44yoZMhv8fj6xh-PMiIxwryG3 # S3_BUCKET_NAME: scratch-www-staging
ROOT_URL: https://scratch.ly # SCRATCH_ENV: staging
S3_BUCKET_NAME: scratch-www-staging # SENTRY_DSN: https://c01014988b0a4f44bbefdf235623c456@sentry.io/1357982
SCRATCH_ENV: staging # SENTRY_PROJECT: scratch-30-staging
SENTRY_DSN: https://c01014988b0a4f44bbefdf235623c456@sentry.io/1357982 # STATIC_HOST: https://cdn.scratch.ly
SENTRY_PROJECT: scratch-30-staging # TEST_PROJECT_ID: "1300006196"
STATIC_HOST: https://cdn.scratch.ly
TEST_PROJECT_ID: "1300006196"
- &save_git_cache - &save_git_cache
save_cache: save_cache:
paths: paths:
...@@ -79,13 +77,8 @@ aliases: ...@@ -79,13 +77,8 @@ aliases:
keys: keys:
- v1-build-{{ .Revision }} - v1-build-{{ .Revision }}
- v1-build- - v1-build-
- &build
jobs:
build-staging:
<<: *defaults <<: *defaults
environment:
<<: *environment
<<: *env_staging
steps: steps:
- *restore_git_cache - *restore_git_cache
- checkout - checkout
...@@ -98,28 +91,8 @@ jobs: ...@@ -98,28 +91,8 @@ jobs:
- *save_npm_cache - *save_npm_cache
- *save_git_cache - *save_git_cache
- *save_build_cache - *save_build_cache
build-production: - &deploy
<<: *defaults
environment:
<<: *environment
# <<: *env_production
steps:
- *restore_git_cache
- checkout
- *restore_npm_cache
- run:
name: "Run npm test to build"
command: |
npm --production=false ci
WWW_VERSION=${CIRCLE_SHA1:0:5} npm run test npm run test
- *save_npm_cache
- *save_git_cache
- *save_build_cache
deploy-staging:
<<: *defaults <<: *defaults
environment:
<<: *environment
<<: *env_staging
steps: steps:
- *restore_git_cache - *restore_git_cache
- checkout - checkout
...@@ -128,33 +101,12 @@ jobs: ...@@ -128,33 +101,12 @@ jobs:
- run: - run:
name: "deploy to staging" name: "deploy to staging"
command: | command: |
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
pip install -r requirements.txt
FASTLY_API_KEY="${FASTLY_API_KEY_STAGING}" FASTLY_SERVICE_ID="${FASTLY_SERVICE_ID_STAGING}" npm run deploy
deploy-production:
<<: *defaults
environment:
<<: *environment
# <<: *env_production
steps:
- *restore_git_cache
- checkout
- *restore_npm_cache
- *restore_build_cache
- run:
name: "deploy to production"
command: |
echo "don't deploy to production until we know it works"
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py python get-pip.py
pip install -r requirements.txt pip install -r requirements.txt
npm run deploy npm run deploy
integration-staging: - &integration
<<: *defaults <<: *defaults
environment:
<<: *environment
<<: *env_staging
steps: steps:
- *restore_git_cache - *restore_git_cache
- checkout - checkout
...@@ -163,24 +115,29 @@ jobs: ...@@ -163,24 +115,29 @@ jobs:
name: "integration tests" name: "integration tests"
command: | command: |
npm run test:integration:remote npm run test:integration:remote
jobs:
build-staging:
<<: *build
build-production:
# <<: *build
deploy-staging:
<<: *deploy
deploy-production:
# <<: *deploy
integration-staging:
<<: *integration
integration-production: integration-production:
<<: *defaults # <<: *integration
environment:
<<: *environment
# <<: *env_production
steps:
- *restore_git_cache
- checkout
- *restore_npm_cache
- run:
name: "integration tests"
command: |
npm run test:integration:remote
workflows: workflows:
build-test-deploy: build-test-deploy:
jobs: jobs:
- build-staging: - build-staging:
context:
- scratch-www-all
- scratch-www-staging
filters: filters:
branches: branches:
only: only:
...@@ -189,6 +146,9 @@ workflows: ...@@ -189,6 +146,9 @@ workflows:
- /^hotfix\/.*/ - /^hotfix\/.*/
- /^release\/.*/ - /^release\/.*/
- deploy-staging: - deploy-staging:
context:
- scratch-www-all
- scratch-www-staging
requires: requires:
- build-staging - build-staging
filters: filters:
...@@ -199,6 +159,9 @@ workflows: ...@@ -199,6 +159,9 @@ workflows:
- /^hotfix\/.*/ # make sure this syntax works. may need a regex - /^hotfix\/.*/ # make sure this syntax works. may need a regex
- /^release\/.*/ - /^release\/.*/
- integration-staging: - integration-staging:
context:
- scratch-www-all
- scratch-www-staging
requires: requires:
- deploy-staging - deploy-staging
filters: filters:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment