Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #1826

Merged
merged 254 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
dc4cfc9
chore: Changed title and description
devops-chris Dec 11, 2023
ecc8219
Merge pull request #1746 from HHS/1372-build-workflow-dev
devops-chris Dec 11, 2023
42abff8
feat: added terraform module for asa deployment
devops-chris Dec 11, 2023
a2ac7c3
Merge pull request #1747 from HHS/1372-build-workflow-dev
devops-chris Dec 11, 2023
63ef970
chore: pointed context to versioned ref
devops-chris Dec 11, 2023
7872d96
Merge pull request #1748 from HHS/1372-build-workflow-dev
devops-chris Dec 11, 2023
e7b52d6
Update Dockerfile
devops-chris Dec 11, 2023
184fbf2
chore: case sensitive?
devops-chris Dec 11, 2023
b78215a
Merge pull request #1749 from HHS/devops-chris-patch-1
devops-chris Dec 11, 2023
175d8fd
chore: moved workflows
devops-chris Dec 11, 2023
8485451
Merge remote-tracking branch 'origin/development' into 1372-build-wor…
devops-chris Dec 11, 2023
ea0c2c3
Merge pull request #1751 from HHS/1372-build-workflow-dev
devops-chris Dec 11, 2023
454a6af
Update dev_pr.yml
devops-chris Dec 11, 2023
ed3c3c9
Update dev_pr_merge.yml
devops-chris Dec 11, 2023
40f1169
chore: troubleshooting
devops-chris Dec 11, 2023
4efb5ad
chore: I think I need bash here
devops-chris Dec 11, 2023
a6fd91f
chore: ssh is no go in gha
devops-chris Dec 11, 2023
6d79f6b
chore: commented out old deployments
devops-chris Dec 12, 2023
83757c6
chore: updated version
devops-chris Dec 12, 2023
c468708
chore: added env
devops-chris Dec 12, 2023
76c1afe
chore: testing with PR only
devops-chris Dec 12, 2023
dd4093c
chore: workflow needs permissions to write comments
devops-chris Dec 12, 2023
210db93
Update Dockerfile
devops-chris Dec 12, 2023
681ffb5
chore: troubleshooting
devops-chris Dec 12, 2023
59c180c
Merge pull request #1758 from HHS/devops-chris-patch-4
devops-chris Dec 12, 2023
cdce6e0
Update Dockerfile again
devops-chris Dec 12, 2023
bf6ca6f
Merge pull request #1759 from HHS/devops-chris-patch-4
devops-chris Dec 12, 2023
fcf4466
chore: more troubleshooting
devops-chris Dec 12, 2023
ffc7581
Update Dockerfile another
devops-chris Dec 12, 2023
388e9c0
chore: updated for bun
devops-chris Dec 12, 2023
315430b
Merge pull request #1760 from HHS/devops-chris-patch-4
devops-chris Dec 12, 2023
050b7bb
Update Dockerfilesies
devops-chris Dec 12, 2023
0483b10
chore: some troubleshooting
devops-chris Dec 12, 2023
31e3fea
Merge pull request #1761 from HHS/devops-chris-patch-4
devops-chris Dec 12, 2023
76594f1
Update Dockerfile-ts
devops-chris Dec 12, 2023
0a43b38
chore: still troubleshooting
devops-chris Dec 12, 2023
3f7f2c5
Merge pull request #1762 from HHS/devops-chris-patch-4
devops-chris Dec 12, 2023
2b327fd
Update Dockerfile
devops-chris Dec 12, 2023
04cd2fc
chore: trying to output at set
devops-chris Dec 12, 2023
84e28bc
Merge pull request #1763 from HHS/devops-chris-patch-4
devops-chris Dec 12, 2023
6c045cc
chore: Think something is wrong with INPUT_ in composite action
devops-chris Dec 12, 2023
c9dc12f
chore: json parse
devops-chris Dec 12, 2023
bda67f8
chore: Trying write to global env
devops-chris Dec 12, 2023
339e4d4
chore: Running the build on PR
devops-chris Dec 13, 2023
bcb6ed7
chore: Take out build here
devops-chris Dec 13, 2023
16d5b5b
Update dev_pr.yml
devops-chris Dec 13, 2023
2cd58a6
chore: debugging
devops-chris Dec 13, 2023
e938487
chore: debugging
devops-chris Dec 13, 2023
7ec20e4
chore: removed path
devops-chris Dec 13, 2023
711e18e
chore: set deploy to need build
devops-chris Dec 13, 2023
83cde0b
chore: change path
devops-chris Dec 13, 2023
9f0aaa6
chore: testing
devops-chris Dec 14, 2023
9f0e035
Update Dockerfile
devops-chris Dec 14, 2023
ab9db2a
Merge pull request #1776 from HHS/devops-chris-patch-4
devops-chris Dec 14, 2023
e668ae2
chore: testing
devops-chris Dec 14, 2023
6710ce4
chore: rebase issues
devops-chris Dec 14, 2023
72768a4
chore: troubleshooting
devops-chris Dec 14, 2023
41f475f
Update Dockerfile
devops-chris Dec 14, 2023
f50b1be
Merge pull request #1778 from HHS/devops-chris-patch-4
devops-chris Dec 14, 2023
2c31444
chore: troubleshooting
devops-chris Dec 14, 2023
4363fb0
Update Dockerfile
devops-chris Dec 14, 2023
8c62101
Merge pull request #1779 from HHS/devops-chris-patch-4
devops-chris Dec 14, 2023
e6f0b01
chore: updated apply
devops-chris Dec 14, 2023
b9ac568
Update Dockerfile
devops-chris Dec 14, 2023
141c0e9
Merge pull request #1780 from HHS/devops-chris-patch-4
devops-chris Dec 14, 2023
648ecb9
chore: fixed typo
devops-chris Dec 14, 2023
431b536
chore: indention?
devops-chris Dec 14, 2023
70c0fdd
Update Dockerfile
devops-chris Dec 14, 2023
d30871e
Merge pull request #1781 from HHS/devops-chris-patch-4
devops-chris Dec 14, 2023
8dac472
chore: Troubleshooting logging
devops-chris Dec 14, 2023
e6a51f1
chore: troubleshooting
devops-chris Dec 14, 2023
95cfc61
Update Dockerfile
devops-chris Dec 14, 2023
4713d9b
Merge pull request #1782 from HHS/devops-chris-patch-4
devops-chris Dec 14, 2023
f44587e
chore: troubleshooting
devops-chris Dec 14, 2023
ca5e218
chore: rolled back format
devops-chris Dec 14, 2023
abaef11
Update Dockerfile
devops-chris Dec 14, 2023
8e68a6a
Merge pull request #1783 from HHS/devops-chris-patch-4
devops-chris Dec 14, 2023
91d14e8
chore: changing PR Id to match dev_pr
devops-chris Dec 14, 2023
824b79b
Update Dockerfile
devops-chris Dec 14, 2023
ec0f88e
Merge pull request #1784 from HHS/devops-chris-patch-4
devops-chris Dec 14, 2023
96b8ec3
chore: another approach
devops-chris Dec 14, 2023
efc7e97
Update Dockerfile
devops-chris Dec 14, 2023
653ffe7
Merge pull request #1786 from HHS/devops-chris-patch-4
devops-chris Dec 14, 2023
2696322
chore: another approach
devops-chris Dec 14, 2023
7dc26ae
chore: troubleshooting
devops-chris Dec 14, 2023
0d7fe70
chore: troubleshooting
devops-chris Dec 14, 2023
f5826bf
chore: troubleshooting
devops-chris Dec 14, 2023
a507cde
chore: moved apply to seperate job
devops-chris Dec 15, 2023
4edcdb4
chore: moved apply to seperate job
devops-chris Dec 15, 2023
4b0524e
chore: Had to add the action checkout
devops-chris Dec 15, 2023
2ab4e19
chore: restructured
devops-chris Dec 15, 2023
1ddaa5c
Update Dockerfile
devops-chris Dec 15, 2023
1de0ae7
Merge pull request #1793 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
390816a
chore: troubleshooting
devops-chris Dec 15, 2023
fae82cf
Update Dockerfile
devops-chris Dec 15, 2023
66033d1
Merge pull request #1794 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
9f4b14d
chore: troubleshooting
devops-chris Dec 15, 2023
bba9478
Update Dockerfile
devops-chris Dec 15, 2023
d023bf6
Merge pull request #1795 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
7fd7b74
chore: cleanup
devops-chris Dec 15, 2023
f40f2e1
Update Dockerfile
devops-chris Dec 15, 2023
2716413
Merge pull request #1796 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
c01a28e
chore: updated and importing build
devops-chris Dec 15, 2023
ec89892
Update Dockerfile
devops-chris Dec 15, 2023
a6b820c
Merge pull request #1797 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
db337e5
chore: added permissions
devops-chris Dec 15, 2023
61049c3
Update Dockerfile
devops-chris Dec 15, 2023
7e834f3
Merge pull request #1798 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
9396fb9
chore: Changed names
devops-chris Dec 15, 2023
2686ec4
Update index.html
devops-chris Dec 15, 2023
f567ce0
chore: fixed name issues
devops-chris Dec 15, 2023
17eefee
Merge pull request #1799 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
6797097
chore: more name fixes
devops-chris Dec 15, 2023
98a0eb6
Update index.html
devops-chris Dec 15, 2023
a6af5be
Merge pull request #1801 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
3df71f4
chore: more name fixes
devops-chris Dec 15, 2023
73f059e
Update index.html
devops-chris Dec 15, 2023
0922ddb
Merge pull request #1802 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
ca7160e
feat: Added backend deploy
devops-chris Dec 15, 2023
c9ba1c0
chore: added azure env config
devops-chris Dec 15, 2023
60604e9
chore: fixed dockerfile name
devops-chris Dec 15, 2023
46dec29
Update Dockerfile.ops-api
devops-chris Dec 15, 2023
4d3049e
chore: updated paths
devops-chris Dec 15, 2023
880e6c5
chore: updated paths
devops-chris Dec 15, 2023
6dea474
chore: added dispatch
devops-chris Dec 15, 2023
294d683
chore: Maybe indented wrong?
devops-chris Dec 15, 2023
ef01fea
chore: Updated the context source
devops-chris Dec 15, 2023
1d9582e
chore: fixed json error
devops-chris Dec 15, 2023
64268e1
Merge pull request #1804 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
ffee0ae
chrore: Updating output of domain names
devops-chris Dec 15, 2023
69d25e5
Update index.html
devops-chris Dec 15, 2023
af7df9c
Update Dockerfile.ops-api
devops-chris Dec 15, 2023
50c1ab4
Merge pull request #1809 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
4433e0d
Merge pull request #1810 from HHS/devops-chris-patch-3
devops-chris Dec 15, 2023
684b4a4
chore: cleaned up
devops-chris Dec 15, 2023
90273e7
chore: made plan optional
devops-chris Dec 15, 2023
726d560
Update Dockerfile.ops-api
devops-chris Dec 15, 2023
a04b269
Merge pull request #1811 from HHS/devops-chris-patch-1
devops-chris Dec 15, 2023
d2a32a7
chore: Updated to allow var input on apply
devops-chris Dec 18, 2023
c19a4e4
chore: Moving build to terraform for context
devops-chris Dec 18, 2023
f2418f8
chore: Updated workflow to use terraform
devops-chris Dec 18, 2023
74a1aa9
chore: Removed restraint on planfile
devops-chris Dec 18, 2023
89cbb95
chore: Added conditional for the plan
devops-chris Dec 18, 2023
b4ef6b2
chore: Giving it a non-default dir path
devops-chris Dec 18, 2023
dce60d6
chore: Forgot ','
devops-chris Dec 18, 2023
d2f1490
chore: Needs permissions
devops-chris Dec 18, 2023
2ffac5e
chore: Updated state file names
devops-chris Dec 18, 2023
2a83b4a
chore: Test TF Bun Build
devops-chris Dec 18, 2023
374ca4a
Merge pull request #1815 from HHS/devops-chris-patch-3
devops-chris Dec 18, 2023
b3b7612
Merge remote-tracking branch 'origin/main' into development
devops-chris Dec 18, 2023
6303a4f
chore: Pulled latest main for testing.
devops-chris Dec 18, 2023
4190469
Merge pull request #1816 from HHS/devops-chris-patch-1
devops-chris Dec 18, 2023
e466c3a
chore: fix gunicorn worker pid
devops-chris Dec 18, 2023
09f4b13
Merge pull request #1817 from HHS/devops-chris-patch-1
devops-chris Dec 18, 2023
b862302
chore: Created optional PR comment
devops-chris Dec 18, 2023
df62714
chore: add tf for data-tools deploy
devops-chris Dec 18, 2023
59caa51
chore: Add config for data-tools
devops-chris Dec 18, 2023
54ffc92
chore: add data-tools deploy
devops-chris Dec 18, 2023
9dc0fcb
chore: kicking off action
devops-chris Dec 18, 2023
9d62127
chore: fixed typo
devops-chris Dec 18, 2023
7e620a9
chore: removed push
devops-chris Dec 18, 2023
08cc728
chore: a few fixes
devops-chris Dec 18, 2023
1535f8a
chore: typo
devops-chris Dec 18, 2023
b71875c
chore: fixed wrong file
devops-chris Dec 18, 2023
3dbd108
chore: import azure config
devops-chris Dec 18, 2023
118b283
chore: updated python import command
devops-chris Dec 18, 2023
5d8ea88
chore: put the min to 0
devops-chris Dec 18, 2023
aa366e9
chore: Added runtime-env-config setup
devops-chris Dec 20, 2023
0df9337
chore: Changed to alpine image
devops-chris Dec 20, 2023
e369762
chore: set workflows for deployments
devops-chris Dec 20, 2023
af0bd2c
chore: Updated output
devops-chris Dec 20, 2023
4376bd0
chore: Added container only deployments
devops-chris Dec 20, 2023
069e7ab
chore: Added comment
devops-chris Dec 20, 2023
ebea6c0
Merge pull request #1821 from HHS/devops-chris-patch-1
devops-chris Dec 20, 2023
264fa84
chore: Minor Fixes
devops-chris Dec 20, 2023
52b9f75
Update Dockerfile.ops-api
devops-chris Dec 20, 2023
693b5fe
Merge pull request #1822 from HHS/devops-chris-patch-1
devops-chris Dec 20, 2023
4a07c37
Update Dockerfile.azure
devops-chris Dec 20, 2023
ab121b0
chore: no artifacts to download
devops-chris Dec 20, 2023
4163d5d
chore: Always trigger build
devops-chris Dec 20, 2023
6413080
Merge pull request #1823 from HHS/devops-chris-patch-1
devops-chris Dec 20, 2023
999db4a
chore: Output FE Domain
devops-chris Dec 20, 2023
570821b
chore: fixed typo
devops-chris Dec 20, 2023
efb0254
chore: Comment index
devops-chris Dec 20, 2023
4d96a06
Merge pull request #1824 from HHS/devops-chris-patch-1
devops-chris Dec 20, 2023
e10b782
chore: added error path
devops-chris Dec 20, 2023
b340692
Merge pull request #1825 from HHS/cml/newserve
devops-chris Dec 20, 2023
6bb99a3
chore: Changed all actions to commit hash vs. versions
devops-chris Dec 26, 2023
59f676e
chore: cleared whitespace
devops-chris Dec 26, 2023
345a86a
chore: Typo in hash
devops-chris Dec 26, 2023
8d2e239
Merge pull request #1831 from HHS/devops-chris-patch-1
devops-chris Dec 26, 2023
20a2f2a
chore: Verifying action changes
devops-chris Dec 26, 2023
41cac48
Merge pull request #1832 from HHS/devops-chris-patch-1
devops-chris Dec 26, 2023
35cc6c0
chore: test a combined workflow
devops-chris Dec 27, 2023
bb4f7a7
Update Dockerfile.ops-api
devops-chris Dec 27, 2023
cc85401
Merge pull request #1834 from HHS/devops-chris-patch-1
devops-chris Dec 27, 2023
67f865f
chore: Skipped the apply, trying something different
devops-chris Dec 27, 2023
d37f0f3
Update Dockerfile.ops-api
devops-chris Dec 27, 2023
209d570
Merge pull request #1835 from HHS/devops-chris-patch-1
devops-chris Dec 27, 2023
7d1f133
chore: deleted the combined... not working
devops-chris Dec 27, 2023
9674752
chore: test matrix idea
devops-chris Dec 28, 2023
30320c1
Update index.js
devops-chris Dec 28, 2023
11936aa
Update test_matrix.yml
devops-chris Dec 28, 2023
955437c
chore: added shell
devops-chris Dec 28, 2023
d06fe6a
chore: diff change
devops-chris Dec 28, 2023
16a2784
chore: diff change
devops-chris Dec 28, 2023
5e67578
chore: fix no output
devops-chris Dec 28, 2023
995d759
chore: add debug
devops-chris Dec 28, 2023
d88614f
chore: path fix
devops-chris Dec 28, 2023
7302c82
chore: more debugging
devops-chris Dec 28, 2023
d20f821
chore: more debugging
devops-chris Dec 28, 2023
e43c3ac
chore: more debugging
devops-chris Dec 28, 2023
fe5fe43
chore: more debugging
devops-chris Dec 28, 2023
51f0274
chore: more debugging
devops-chris Dec 28, 2023
c69fb54
chore: more debugging
devops-chris Dec 28, 2023
5492bee
chore: more debugging
devops-chris Dec 28, 2023
c3533bd
chore: more debugging
devops-chris Dec 28, 2023
71464ef
chore: more debugging
devops-chris Dec 28, 2023
713760d
chore: more debugging
devops-chris Dec 28, 2023
ffb068a
chore: more debugging
devops-chris Dec 28, 2023
5151e05
chore: more debugging
devops-chris Dec 28, 2023
5912d3d
chore: more debugging
devops-chris Dec 28, 2023
9f7cc34
chore: more debugging
devops-chris Dec 28, 2023
097acaa
chore: more debugging
devops-chris Dec 28, 2023
972f1d9
chore: more debugging
devops-chris Dec 28, 2023
48a6c78
chore: more debugging
devops-chris Dec 28, 2023
781c24b
chore: more debugging
devops-chris Dec 28, 2023
f2b6443
chore: more debugging
devops-chris Dec 28, 2023
bb7df22
chore: more debugging
devops-chris Dec 28, 2023
1231483
chore: cleanup
devops-chris Dec 28, 2023
79ed595
Update Dockerfile.ops-api
devops-chris Dec 28, 2023
e12eb2f
Merge pull request #1837 from HHS/devops-chris-patch-2
devops-chris Dec 28, 2023
fc8477b
chore: cleanup
devops-chris Dec 28, 2023
7a49471
chore: consolidating builds
devops-chris Dec 28, 2023
6284bb6
chore: giving work dir specific names
devops-chris Dec 28, 2023
7ff6927
chore: indentation issues
devops-chris Dec 28, 2023
161473c
chore: cleanup
devops-chris Dec 28, 2023
0e1efca
chore: set to output
devops-chris Dec 28, 2023
523d834
chore: trying to get output
devops-chris Dec 28, 2023
26bd032
Merge pull request #1836 from HHS/devops-chris-patch-1
devops-chris Dec 28, 2023
8126fa3
chore: typo
devops-chris Dec 28, 2023
4e4fe09
chore: cleanup
devops-chris Dec 28, 2023
583e3b1
chore: cleanup version locks
devops-chris Dec 28, 2023
06e20e9
Update index.js
devops-chris Dec 28, 2023
0244b2f
Update Dockerfile.ops-api
devops-chris Dec 28, 2023
61eaaae
Merge pull request #1838 from HHS/devops-chris-patch-1
devops-chris Dec 28, 2023
2654f11
Merge pull request #1839 from HHS/devops-chris-patch-2
devops-chris Dec 28, 2023
3b315da
chore: set branch trigger
devops-chris Jan 2, 2024
b76eedc
Merge branch 'main' into development
devops-chris Jan 3, 2024
3c5b2ce
linting
tdonaworth Jan 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 121 additions & 0 deletions .github/actions/tf-apply/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: 'Terraform setup and apply'
description: 'Setup Terraform and applies Terraform config'
inputs:
terraform_directory:
description: 'Directory that holds Terraform code'
required: true
azure_client_id:
description: 'Azure client id'
required: true
azure_client_secret:
description: 'Azure client secret'
required: true
azure_subscription_id:
description: 'Azure subscription id'
required: true
azure_tenant_id:
description: 'Azure tenant id'
required: true
terraform_version:
description: 'Terraform Version'
required: true
default: 1.5.7
github_token:
description: 'GitHub token for auth'
required: true
pr_id:
description: 'Pull request ID'
required: false
tf_vars:
description: 'A map of variable inputs for Terraform'
required: false
plan_workflow_file:
description: 'Filename of workflow containing the tf plan artifact.'
required: false

runs:
using: "composite"
steps:
- name: Get last directory name
id: get-tf-dir
run: |
tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev)
echo "tf_dir=$tf_dir" >> $GITHUB_OUTPUT
shell: bash

- name: Set Terraform Variables
run: |
if [[ -n "${INPUT_TF_VARS}" ]]; then
for key in $(echo "${INPUT_TF_VARS}" | jq -r 'keys[]'); do
value=$(echo "${INPUT_TF_VARS}" | jq -r ".$key")

echo "TF_VAR_${key// /}=${value}" >> $GITHUB_ENV

# Print debug statement
echo "Exported TF_VAR_${key// /}=${value}"
done
fi
shell: bash
env:
INPUT_TF_VARS: ${{ inputs.tf_vars }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 #v3.0.0
with:
terraform_version: ${{ inputs.terraform_version }}
terraform_wrapper: false

- name: Terraform Init
id: init
working-directory: ${{ inputs.terraform_directory }}
shell: bash
env:
ARM_CLIENT_ID: ${{ inputs.azure_client_id }}
ARM_CLIENT_SECRET: ${{ inputs.azure_client_secret }}
ARM_SUBSCRIPTION_ID: ${{ inputs.azure_subscription_id }}
ARM_TENANT_ID: ${{ inputs.azure_tenant_id }}
run: |
terraform init

- name: Download Plan
id: download-plan
if: ${{ inputs.plan_workflow_file != '' }}
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d #v3.0.0
with:
github_token: ${{ inputs.github_token }}
workflow: ${{ inputs.plan_workflow_file }}
pr: ${{ inputs.pr_id }}
name: ${{ inputs.pr_id }}-${{ steps.get-tf-dir.outputs.tf_dir }}-tf-plan
path: ${{ inputs.terraform_directory }}

- name: Terraform Apply
id: apply
working-directory: ${{ inputs.terraform_directory }}
shell: bash
env:
ARM_CLIENT_ID: ${{ inputs.azure_client_id }}
ARM_CLIENT_SECRET: ${{ inputs.azure_client_secret }}
ARM_SUBSCRIPTION_ID: ${{ inputs.azure_subscription_id }}
ARM_TENANT_ID: ${{ inputs.azure_tenant_id }}
run: |
echo 'apply<<EOF' >> $GITHUB_OUTPUT
if [ -f "tfplan" ]; then
terraform apply -input=false -no-color tfplan >> $GITHUB_OUTPUT
else
terraform apply -auto-approve -input=false -no-color >> $GITHUB_OUTPUT
fi
echo 'EOF' >> $GITHUB_OUTPUT

- name: Comment Apply
id: comment-apply
if: ${{ inputs.pr_id != '' }}
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 #v3.1.0
with:
token: ${{ inputs.github_token }}
issue-number: ${{ inputs.pr_id }}
body: |
Terraform Apply for for ${{ inputs.terraform_directory }}:

```
${{ steps.apply.outputs.apply }}
```
111 changes: 111 additions & 0 deletions .github/actions/tf-plan/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: 'Terraform setup and plan'
description: 'Setup Terraform and creates plan'
inputs:
terraform_directory:
description: 'Directory that holds Terraform code'
required: true
azure_client_id:
description: 'Azure client id'
required: true
azure_client_secret:
description: 'Azure client secret'
required: true
azure_subscription_id:
description: 'Azure subscription id'
required: true
azure_tenant_id:
description: 'Azure tenant id'
required: true
terraform_version:
description: 'Terraform Version'
required: true
default: 1.5.7
github_token:
description: 'GitHub token for auth'
required: true
pr_id:
description: 'Pull request ID'
required: true
tf_vars:
description: 'A map of variable inputs for Terraform'
required: false

runs:
using: "composite"
steps:
- name: Get last directory name
id: get-tf-dir
run: |
tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev)
echo "tf_dir=$tf_dir" >> $GITHUB_OUTPUT
shell: bash

- name: Set Terraform Variables
run: |
if [[ -n "${INPUT_TF_VARS}" ]]; then
for key in $(echo "${INPUT_TF_VARS}" | jq -r 'keys[]'); do
value=$(echo "${INPUT_TF_VARS}" | jq -r ".$key")

echo "TF_VAR_${key// /}=${value}" >> $GITHUB_ENV

# Print debug statement
echo "Exported TF_VAR_${key// /}=${value}"
done
fi
shell: bash
env:
INPUT_TF_VARS: ${{ inputs.tf_vars }}

- name: Setup Terraform
uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 #v3.0.0
with:
terraform_version: ${{ inputs.terraform_version }}
terraform_wrapper: false

- name: Terraform Init
id: init
working-directory: ${{ inputs.terraform_directory }}
shell: bash
env:
ARM_CLIENT_ID: ${{ inputs.azure_client_id }}
ARM_CLIENT_SECRET: ${{ inputs.azure_client_secret }}
ARM_SUBSCRIPTION_ID: ${{ inputs.azure_subscription_id }}
ARM_TENANT_ID: ${{ inputs.azure_tenant_id }}
run: |
terraform init

- name: Terraform Plan
id: plan
working-directory: ${{ inputs.terraform_directory }}
shell: bash
env:
ARM_CLIENT_ID: ${{ inputs.azure_client_id }}
ARM_CLIENT_SECRET: ${{ inputs.azure_client_secret }}
ARM_SUBSCRIPTION_ID: ${{ inputs.azure_subscription_id }}
ARM_TENANT_ID: ${{ inputs.azure_tenant_id }}
run: |
echo 'plan<<EOF' >> $GITHUB_OUTPUT
terraform plan -no-color -out=tfplan >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT

- name: Save Artifact
id: save-artifact
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0
with:
name: ${{ inputs.pr_id }}-${{ steps.get-tf-dir.outputs.tf_dir }}-tf-plan
path: ${{ inputs.terraform_directory }}/tfplan

- name: Comment Plan
id: comment-plan
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 #v3.1.0
with:
token: ${{ inputs.github_token }}
issue-number: ${{ inputs.pr_id }}
body: |
Terraform Plan for ${{ inputs.terraform_directory }}:

```
${{ steps.plan.outputs.plan }}
```

Plan saved to GH artifacts.
88 changes: 88 additions & 0 deletions .github/workflows/dev_backend_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Dev BE Pull Request

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- backend/models/**
- backend/ops_api/**
- backend/Dockerfile.ops-api

env:
TERRAFORM_VERSION: "1.5.7"
TF_IN_AUTOMATION: "True"
ENVIRONMENT: "dev"
WORKING_DIR: "backend"
DOCKER_FILE: "Dockerfile.ops-api"

jobs:
build:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- name: Build and publish the Docker image for ${{ github.repository }}
uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b4d44 #v13
with:
image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} # it will be lowercased internally
github_token: ${{ secrets.GITHUB_TOKEN }}
context: ${{ github.workspace }}/${{ env.WORKING_DIR }}
dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DOCKER_FILE }}
image_tag: ${{ github.sha }}

plan-backend-deploy:
needs: build
permissions:
pull-requests: write

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- name: Terraform Plan
uses: ./.github/actions/tf-plan
with:
terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}"
terraform_version: ${{ env.TERRAFORM_VERSION }}
azure_client_id: ${{ secrets.ARM_CLIENT_ID }}
azure_client_secret: ${{ secrets.ARM_CLIENT_SECRET }}
azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
azure_tenant_id: ${{ secrets.ARM_TENANT_ID }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_id: ${{ github.event.pull_request.number }}
tf_vars: |
{
"environment": "${{ env.ENVIRONMENT }}",
"container_tag": "${{ github.sha }}"
}

plan-backend-asa-deploy:
needs: build
permissions:
pull-requests: write

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- name: Terraform Plan
uses: ./.github/actions/tf-plan
with:
terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa"
terraform_version: ${{ env.TERRAFORM_VERSION }}
azure_client_id: ${{ secrets.ARM_CLIENT_ID }}
azure_client_secret: ${{ secrets.ARM_CLIENT_SECRET }}
azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
azure_tenant_id: ${{ secrets.ARM_TENANT_ID }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_id: ${{ github.event.pull_request.number }}
tf_vars: |
{
"environment": "${{ env.ENVIRONMENT }}",
"container_tag": "${{ github.sha }}"
}
62 changes: 62 additions & 0 deletions .github/workflows/dev_backend_pr_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Dev BE Pull Request Merged

on:
workflow_dispatch:
pull_request:
types:
- closed
branches:
- main
paths:
- backend/models/**
- backend/ops_api/**
- backend/Dockerfile.ops-api

env:
TERRAFORM_VERSION: "1.5.7"
TF_IN_AUTOMATION: "True"
ENVIRONMENT: "dev"
WORKING_DIR: "backend"

jobs:
apply-deploy:
permissions:
pull-requests: write
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- name: Terraform Apply
uses: ./.github/actions/tf-apply
with:
terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}"
terraform_version: ${{ env.TERRAFORM_VERSION }}
azure_client_id: ${{ secrets.ARM_CLIENT_ID }}
azure_client_secret: ${{ secrets.ARM_CLIENT_SECRET }}
azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
azure_tenant_id: ${{ secrets.ARM_TENANT_ID }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_id: ${{ github.event.pull_request.number }}
plan_workflow_file: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml

apply-asa-deploy:
permissions:
pull-requests: write
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1

- name: Terraform Apply
uses: ./.github/actions/tf-apply
with:
terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa"
terraform_version: ${{ env.TERRAFORM_VERSION }}
azure_client_id: ${{ secrets.ARM_CLIENT_ID }}
azure_client_secret: ${{ secrets.ARM_CLIENT_SECRET }}
azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }}
azure_tenant_id: ${{ secrets.ARM_TENANT_ID }}
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_id: ${{ github.event.pull_request.number }}
plan_workflow_file: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml
Loading
Loading