From 1d46abca6bd4dd0098d316b0fc18912467adb884 Mon Sep 17 00:00:00 2001 From: Laura Beaufort Date: Wed, 2 Feb 2022 13:15:08 -0500 Subject: [PATCH] Add deploy to CircleCI --- .circleci/config.yml | 25 +++++++++++++++++++++++++ bin/run.sh | 1 - manifest-prod.yml | 14 ++++++++++++++ manifest-stage.yml | 14 ++++++++++++++ tasks.py | 3 ++- 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 manifest-prod.yml create mode 100644 manifest-stage.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 9fb3f3b17e..c191437b23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -97,6 +97,30 @@ jobs: command: python manage.py test --keep working_directory: ~/project/django-backend/ + deploy: + + docker: + - image: cimg/python:3.7 + + steps: + - checkout + + - python/install-packages: + pkg-manager: pip + pip-dependency-file: requirements.txt + + - run: + name: Installs for deploy + command: | + mkdir -p $HOME/bin + export PATH=$HOME/bin:$PATH + curl -L "https://cli.run.pivotal.io/stable?release=linux64-binary&version=7.1.0" | tar xzv -C $HOME/bin + + - deploy: + name: Deploy API + command: | + export PATH=$HOME/bin:$PATH + invoke deploy --branch $CIRCLE_BRANCH --login True # Invoke jobs via workflows # See: https://circleci.com/docs/2.0/configuration-reference/#workflows @@ -105,5 +129,6 @@ workflows: jobs: - unit-test - lint + - deploy diff --git a/bin/run.sh b/bin/run.sh index e0ba765c1c..c91a82629c 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -5,5 +5,4 @@ cd django-backend ./manage.py migrate --noinput # Run application -# python wait_for_db.py && gunicorn --bind 0.0.0.0:8080 fecfiler.wsgi -w 10 -t 200 --reload diff --git a/manifest-prod.yml b/manifest-prod.yml new file mode 100644 index 0000000000..e355a3e4ce --- /dev/null +++ b/manifest-prod.yml @@ -0,0 +1,14 @@ +--- +applications: +- name: fecfile-web-api + routes: + - route: fecfile-web-api-prod.app.cloud.gov + stack: cflinuxfs3 + buildpacks: + - python_buildpack + memory: 512M + services: + - fecfile-api-rds + env: + DISABLE_COLLECTSTATIC: 1 + # DJANGO_SETTINGS_MODULE: django-backend.fecfiler.settings.production diff --git a/manifest-stage.yml b/manifest-stage.yml new file mode 100644 index 0000000000..5a185b39b1 --- /dev/null +++ b/manifest-stage.yml @@ -0,0 +1,14 @@ +--- +applications: +- name: fecfile-web-api + routes: + - route: fecfile-web-api-stage.app.cloud.gov + stack: cflinuxfs3 + buildpacks: + - python_buildpack + memory: 512M + services: + - fecfile-api-rds + env: + DISABLE_COLLECTSTATIC: 1 + # DJANGO_SETTINGS_MODULE: django-backend.fecfiler.settings.production diff --git a/tasks.py b/tasks.py index a4b354942d..e82b1b3d93 100644 --- a/tasks.py +++ b/tasks.py @@ -56,7 +56,8 @@ def _detect_space(repo, branch=None): DEPLOY_RULES = ( ('prod', _detect_prod), ('stage', lambda _, branch: branch.startswith('release')), - ('dev', lambda _, branch: branch == 'develop'), + #('dev', lambda _, branch: branch == 'develop'), + ('dev', lambda _, branch: branch == 'feature/40-test-cloud-gov'), )