Skip to content

Commit

Permalink
move graph to its own workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
HectorCastelli committed Nov 19, 2023
1 parent eb25965 commit 5268a17
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 33 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/graph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Infrastructure - Graph

concurrency:
cancel-in-progress: true
group: '${{ github.workflow }}'

on:
pull_request:

permissions:
contents: read

env:
terragrunt_version: '0.53.4'

jobs:
graph:
name: "Update Graph"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Install graphvix
run: sudo apt install graphviz
- uses: opentofu/setup-opentofu@v1
with:
tofu_wrapper: false
- uses: ./.github/actions/install-terragrunt
with:
version: ${{ env.terragrunt_version }}
- name: Generate graph
working-directory: stages
env:
GH_ADMIN_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }}
PG_CONN_STR: ${{ secrets.PG_CONN_STR }}
ELEPHANTSQL_APIKEY: ${{ secrets.ELEPHANTSQL_APIKEY }}
GANDI_KEY: ${{ secrets.GANDI_KEY }}
IMPROVMX_API_TOKEN: ${{ secrets.IMPROVMX_API_TOKEN }}
run: terragrunt graph-dependencies | sed '2d' | dot -T png > "$GITHUB_WORKSPACE/graph.png"
- name: GitHub Commit & Push
uses: actions-js/push@v1.4
with:
github_token: ${{ secrets.GH_ADMIN_TOKEN }}
message: "chore(graph): update graph dependencies"
branch: ${{ github.head_ref }}
33 changes: 0 additions & 33 deletions .github/workflows/infrastructure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,6 @@ jobs:
GANDI_KEY: ${{ secrets.GANDI_KEY }}
IMPROVMX_API_TOKEN: ${{ secrets.IMPROVMX_API_TOKEN }}
run: terragrunt run-all plan --terragrunt-non-interactive
graph:
name: "Terragrunt: Graph"
needs: [plan]
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Install graphvix
run: sudo apt install graphviz
- uses: opentofu/setup-opentofu@v1
with:
tofu_wrapper: false
- uses: ./.github/actions/install-terragrunt
with:
version: ${{ env.terragrunt_version }}
- name: Generate graph
working-directory: stages
env:
GH_ADMIN_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }}
PG_CONN_STR: ${{ secrets.PG_CONN_STR }}
ELEPHANTSQL_APIKEY: ${{ secrets.ELEPHANTSQL_APIKEY }}
GANDI_KEY: ${{ secrets.GANDI_KEY }}
IMPROVMX_API_TOKEN: ${{ secrets.IMPROVMX_API_TOKEN }}
run: terragrunt graph-dependencies | sed '2d' | dot -T png > "$GITHUB_WORKSPACE/graph.png"
- name: GitHub Commit & Push
uses: actions-js/push@v1.4
with:
github_token: ${{ secrets.GH_ADMIN_TOKEN }}
message: "chore(graph): update graph dependencies"
branch: ${{ github.head_ref }}
apply:
name: "Terragrunt: Apply"
needs: [plan]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Stages are logical separation between systems, and can be, at first-glance,

Stages can only use environment variables or the outputs of other stages as input.

![Stage dependencies](./graph.png)

### Modules

Modules are repeatable packages of code that can be used in stages to abstract
Expand Down

0 comments on commit 5268a17

Please sign in to comment.