Skip to content

Commit

Permalink
updated logic for when workflows should run and added utility and inf…
Browse files Browse the repository at this point in the history
…rastructure to filters
  • Loading branch information
George Hudson committed May 2, 2023
1 parent 0bd5793 commit 098d560
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 29 deletions.
6 changes: 6 additions & 0 deletions .circleci/base_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ parameters:
build_and_test_frontend:
type: boolean
default: false
deploy_infrastructure:
type: boolean
default: false
develop_branch_deploy:
type: boolean
default: false
Expand All @@ -42,3 +45,6 @@ parameters:
target_env:
type: string
default: ''
util_make_erd:
type: boolean
default: false
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ parameters:
build_and_test_frontend:
type: boolean
default: false
deploy_infrastructure:
type: boolean
default: false
develop_branch_deploy:
type: boolean
default: false
Expand All @@ -34,6 +37,9 @@ parameters:
target_env:
type: string
default: ''
util_make_erd:
type: boolean
default: false

jobs:
setup:
Expand Down
2 changes: 1 addition & 1 deletion .circleci/infrastructure/workflows.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#workflows:

enable-versioning-for-s3-buckets:
unless: << pipeline.parameters.run_nightly_owasp_scan >>
when: << pipeline.parameters.deploy_infrastructure >>
jobs:
- enable-versioning:
filters:
Expand Down
6 changes: 1 addition & 5 deletions .circleci/util/workflows.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# workflows:
erd:
unless: << pipeline.parameters.run_nightly_owasp_scan >>
when: << pipeline.parameters.util_make_erd >>
jobs:
- make_erd:
filters:
branches:
only:
develop
53 changes: 32 additions & 21 deletions .github/workflows/build-all-on-pr.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
###########################################################################
# GitHub Action Workflow
# On pull request or changes to scripts/commands to any branch,
# triggers the full build and test pipeline.
# CLARIFY THIS
# On pull request or changes to scripts/commands or changes to the pipeline
# code to any branch besides develop, staging and master triggers the full
# build and test pipeline.
#
# NOTE: develop, staging(main) and master are skipped on the push because this
# would be redundant after running the full set of tests from the PR.
# See deploy-develop-on-merge.yml and make_erd for the workflow
# pipelines that run on merge to develop, staging, and master branches.
#
# Step 0: make PR from your branch into develop, or make changes on your
# branch to non-documentation files in scripts or commands.sh and
Expand All @@ -24,29 +29,35 @@ name: Build and test All for PRs and when scripts/commands change
on:
push:
branches_ignore:
- develop
- develop
- main
- master
paths:
- 'scripts/**'
- 'commands.sh'
- 'scripts/**'
- 'commands.sh'
- '.circleci/**'
- '.github/**'
paths_ignore:
- '**.md'
pull_request:
paths_ignore:
- 'docs/**'
- '**.md'
- '**.txt'
- '.gitattributes'
- '.gitignore'
- 'LICENSE'
- 'docs/**'
- '**.md'
- '**.txt'
- '.gitattributes'
- '.gitignore'
- 'LICENSE'
jobs:
build_and_test_all:
runs-on: ubuntu-latest
name: Initiate deploy job in CircleCI
steps:
- uses: actions/checkout@v2
- name: Circle CI Deployment Trigger
id: curl-circle-ci
uses: promiseofcake/circleci-trigger-action@v1
with:
user-token: ${{ secrets.CIRCLE_CI_V2_TOKEN }}
project-slug: raft-tech/TANF-app
branch: ${{ github.ref }}
payload: '{"build_and_test_backend": true, "build_and_test_frontend": true}'
- uses: actions/checkout@v2
- name: Circle CI Deployment Trigger
id: curl-circle-ci
uses: promiseofcake/circleci-trigger-action@v1
with:
user-token: ${{ secrets.CIRCLE_CI_V2_TOKEN }}
project-slug: raft-tech/TANF-app
branch: ${{ github.ref }}
payload: '{"build_and_test_backend": true, "build_and_test_frontend": true}'
7 changes: 5 additions & 2 deletions .github/workflows/build-backend.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###########################################################################
# GitHub Action Workflow
# On push to any branch, triggers the front end build and test pipeline
# On push to any branch, triggers the back end build and test pipeline
# if the tdrs-backend has changed.
#
# Step 0: make changes on your branch to non-documentation files in
Expand All @@ -17,12 +17,15 @@
# Leverages the open source GitHub Action:
# https://github.com/promiseofcake/circleci-trigger-action
###########################################################################
name: Build Only Backend When tdrs-backend Files Change
name: Build Only Backend When tdrs-backend/ Files Change
branches-ignore:
- develop
on:
push:
paths: 'tdrs-backend/**'
paths_ignore:
- '**.md'
- '**.txt'
jobs:
build_and_test_backend:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ branches-ignore:
on:
push:
paths: 'tdrs-frontend/**'
paths_ignore:
- '**.md'
- '**.txt'
jobs:
build_and_test_frontend:
runs-on: ubuntu-latest
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/deploy-infrastructure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
###########################################################################
# GitHub Action Workflow
# On push changing terraform files or infrastructure pipelines, triggers the
# terraform deploy pipeline for the appropriate cf space.
#
# Step 0: make changes to non-documentation files in terraform/ or
# .circleci/infrastructure/ and push/merge changes.
#
# Step 1: Makes a request to the V2 CircleCI API to initiate the project,
# which will filter based upon terraform: true flag
# to run the workflow/jobs listed here:
# build-and-test:[
# enable-versioning-for-s3-buckets
# ]
#
# Leverages the open source GitHub Action:
# https://github.com/promiseofcake/circleci-trigger-action
###########################################################################
name: Run Infrastructure Pipeline When Terraform or Infrastructure Files Change
on:
push:
paths:
- 'terraform/**'
- '.circleci/infrastructure/**'
paths_ignore:
- '**.md'
- '**.txt'
jobs:
deploy_infrastructure:
runs-on: ubuntu-latest
name: Deploy Infrastructure
steps:
- uses: actions/checkout@v2
- name: Circle CI Deployment Trigger
id: curl-circle-ci
uses: promiseofcake/circleci-trigger-action@v1
with:
user-token: ${{ secrets.CIRCLE_CI_V2_TOKEN }}
project-slug: raft-tech/TANF-app
branch: ${{ github.ref }}
payload: '{"deploy_infrastructure": true}'
36 changes: 36 additions & 0 deletions .github/workflows/make_erd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
###########################################################################
# GitHub Action Workflow
# On push to develop or master branches, triggers the make erd util pipeline.
#
# Step 0: merge to develop or master
#
# Step 1: Makes a request to the V2 CircleCI API to initiate the project,
# which will filter based upon terraform: true flag
# to run the workflow/jobs listed here:
# build-and-test:[
# enable-versioning-for-s3-buckets
# ]
#
# Leverages the open source GitHub Action:
# https://github.com/promiseofcake/circleci-trigger-action
###########################################################################
name: Run The Utility Make ERD Pipeline
on:
push:
branches:
- develop
- master
jobs:
make_erd:
runs-on: ubuntu-latest
name: Make ERD
steps:
- uses: actions/checkout@v2
- name: Circle CI Deployment Trigger
id: curl-circle-ci
uses: promiseofcake/circleci-trigger-action@v1
with:
user-token: ${{ secrets.CIRCLE_CI_V2_TOKEN }}
project-slug: raft-tech/TANF-app
branch: ${{ github.ref }}
payload: '{"util_make_erd": true}'

0 comments on commit 098d560

Please sign in to comment.