Skip to content

Commit

Permalink
keeping make_erd job and commands definitions in separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
George Hudson committed Jul 31, 2023
1 parent 2a8a295 commit 04eedc9
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 74 deletions.
53 changes: 0 additions & 53 deletions .circleci/deployment/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,59 +150,6 @@
echo "export DEPLOY_STRATEGY=rolling" >> $BASH_ENV
fi
docker-compose-check:
steps:
- run:
name: Ensure docker-compose exists, otherwise install it.
command: ./scripts/docker-compose-check.sh

docker-compose-up-backend:
steps:
- run:
name: Build and spin-up Django API service
command: cd tdrs-backend; docker network create external-net; docker-compose up -d --build

cf-check:
steps:
- run:
name: Ensure cf cli is installed, otherwise install it.
command: sudo ./scripts/cf-check.sh

# This allows us to use the orb stanza for node/install within other commands
# NOTE: This doesn't work correctly on machine executors
install-nodejs: node/install

sudo-check:
steps:
- run:
name: Ensure sudo is installed, otherwise install it.
command: ./scripts/sudo-check.sh

login-cloud-dot-gov:
description: Authenticates with Cloud.gov and sets org and space targets
parameters:
cf-password:
type: env_var_name
default: CF_PASSWORD_DEV
cf-org:
type: env_var_name
default: CF_ORG
cf-space:
type: string
default: tanf-dev
cf-username:
type: env_var_name
default: CF_USERNAME_DEV
steps:
- run:
name: Login to Cloud.gov and set application targets
command: |
cf login -a https://api.fr.cloud.gov \
-u ${<<parameters.cf-username>>} \
-p ${<<parameters.cf-password>>} \
-o ${<<parameters.cf-org>>} \
-s <<parameters.cf-space>>
deploy-infrastructure:
parameters:
tf-path:
Expand Down
19 changes: 0 additions & 19 deletions .circleci/deployment/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,25 +123,6 @@
cf-username: <<parameters.cf-username>>
cf-space: <<parameters.cf-space>>


make_erd:
executor: machine-executor
working_directory: ~/tdp_apps
steps:
- checkout
- docker-compose-check
- run:
name: Run graph_models
command: |
cd tdrs-backend
if [ $(docker network inspect external-net 2>&1 | grep -c Scope) == 0 ]; then
docker network create external-net
fi
docker-compose run --rm web bash -c \
"./manage.py graph_models -a -g -o tdp_erd.png"
- store_artifacts:
path: tdrs-backend/tdp_erd.png

test-deployment-e2e:
executor: machine-executor
working_directory: ~/tdp-apps
Expand Down
4 changes: 2 additions & 2 deletions .circleci/deployment/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
branches:
only:
- develop
- make_erd:
- make_erd: # from ../util folder
filters:
branches:
only:
Expand Down Expand Up @@ -118,7 +118,7 @@
branches:
only:
- master
- make_erd:
- make_erd: # from ../util folder
filters:
branches:
only:
Expand Down
2 changes: 2 additions & 0 deletions .circleci/generate_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ echo 'commands:' >> generated_config.yml
cat build-and-test/commands.yml >> generated_config.yml
cat deployment/commands.yml >> generated_config.yml
cat owasp/commands.yml >> generated_config.yml
cat util/commands.yml >> generated_config.yml

# Jobs
echo 'jobs:' >> generated_config.yml
cat build-and-test/jobs.yml >> generated_config.yml
cat deployment/jobs.yml >> generated_config.yml
cat owasp/jobs.yml >> generated_config.yml
cat util/jobs.yml >> generated_config.yml

# Workflows
echo 'workflows:' >> generated_config.yml
Expand Down
53 changes: 53 additions & 0 deletions .circleci/util/commands.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# commands:
docker-compose-check:
steps:
- run:
name: Ensure docker-compose exists, otherwise install it.
command: ./scripts/docker-compose-check.sh

docker-compose-up-backend:
steps:
- run:
name: Build and spin-up Django API service
command: cd tdrs-backend; docker network create external-net; docker-compose up -d --build

cf-check:
steps:
- run:
name: Ensure cf cli is installed, otherwise install it.
command: sudo ./scripts/cf-check.sh

# This allows us to use the orb stanza for node/install within other commands
# NOTE: This doesn't work correctly on machine executors
install-nodejs: node/install

sudo-check:
steps:
- run:
name: Ensure sudo is installed, otherwise install it.
command: ./scripts/sudo-check.sh

login-cloud-dot-gov:
description: Authenticates with Cloud.gov and sets org and space targets
parameters:
cf-password:
type: env_var_name
default: CF_PASSWORD_DEV
cf-org:
type: env_var_name
default: CF_ORG
cf-space:
type: string
default: tanf-dev
cf-username:
type: env_var_name
default: CF_USERNAME_DEV
steps:
- run:
name: Login to Cloud.gov and set application targets
command: |
cf login -a https://api.fr.cloud.gov \
-u ${<<parameters.cf-username>>} \
-p ${<<parameters.cf-password>>} \
-o ${<<parameters.cf-org>>} \
-s <<parameters.cf-space>>
18 changes: 18 additions & 0 deletions .circleci/util/jobs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# jobs:
make_erd:
executor: machine-executor
working_directory: ~/tdp_apps
steps:
- checkout
- docker-compose-check
- run:
name: Run graph_models
command: |
cd tdrs-backend
if [ $(docker network inspect external-net 2>&1 | grep -c Scope) == 0 ]; then
docker network create external-net
fi
docker-compose run --rm web bash -c \
"./manage.py graph_models -a -g -o tdp_erd.png"
- store_artifacts:
path: tdrs-backend/tdp_erd.png

0 comments on commit 04eedc9

Please sign in to comment.