From be207d21ce9dfbb725553b944cdf745ef092d121 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 8 Dec 2023 11:07:17 -0500 Subject: [PATCH 001/202] chore: Added terraform composite actions --- .github/actions/tf-apply/action.yaml | 86 ++++++++++++++++++++++++++++ .github/actions/tf-plan/action.yaml | 85 +++++++++++++++++++++++++++ 2 files changed, 171 insertions(+) create mode 100644 .github/actions/tf-apply/action.yaml create mode 100644 .github/actions/tf-plan/action.yaml diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml new file mode 100644 index 0000000000..c03167e5b4 --- /dev/null +++ b/.github/actions/tf-apply/action.yaml @@ -0,0 +1,86 @@ +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 + +runs: + using: "composite" + steps: + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: ${{ inputs.terraforom_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 + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{ inputs.github_token }} + workflow: plan.yaml + pr: ${{ inputs.pr_id }} + name: ${{ inputs.pr_id }}-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<> $GITHUB_OUTPUT + terraform apply -input=false -no-color tfplan >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + + - name: Comment Apply + id: comment-apply + uses: peter-evans/create-or-update-comment@v2 + with: + token: ${{ inputs.github_token }} + issue-number: ${{ inputs.pr_id }} + body: | + Terraform Apply: + + ``` + ${{ steps.apply.outputs.apply }} + ``` \ No newline at end of file diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml new file mode 100644 index 0000000000..79c5bc1dd4 --- /dev/null +++ b/.github/actions/tf-plan/action.yaml @@ -0,0 +1,85 @@ +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 + +runs: + using: "composite" + steps: + - name: Setup Terraform + uses: hashicorp/setup-terraform@v2 + with: + terraform_version: ${{ inputs.terraforom_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<> $GITHUB_OUTPUT + terraform plan -no-color -out=tfplan >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + + - name: Save Artifact + id: save-artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.pr_id }}-tf-plan + path: ${{ inputs.terraform_directory }}/tfplan + + - name: Comment Plan + id: comment-plan + uses: peter-evans/create-or-update-comment@v2 + with: + token: ${{ inputs.github_token }} + issue-number: ${{ inputs.pr_id }} + body: | + Terraform Plan: + + ``` + ${{ steps.plan.outputs.plan }} + ``` + + Plan saved to GH artifacts. \ No newline at end of file From 0694917edb94653f7ded33564ac3cd775283b7e8 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 11 Dec 2023 10:22:59 -0500 Subject: [PATCH 002/202] chore: added map of tf_vars as input --- .github/actions/tf-plan/action.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index 79c5bc1dd4..98bf330efd 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -26,10 +26,21 @@ inputs: 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: Set Terraform Variables + run: | + if [[ -n "${INPUT_TF_VARS}" ]]; then + for key in "${!INPUT_TF_VARS[@]}"; do + export TF_VAR_$key="${INPUT_TF_VARS[$key]}" + done + fi + - name: Setup Terraform uses: hashicorp/setup-terraform@v2 with: From 9be30f87eb6cd654bf0875a90c7a4e0b1ba610f0 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 11 Dec 2023 10:47:32 -0500 Subject: [PATCH 003/202] chore: Add workflow for dev prs --- .github/workflows/frontend_asa/dev_pr.yml | 47 +++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/frontend_asa/dev_pr.yml diff --git a/.github/workflows/frontend_asa/dev_pr.yml b/.github/workflows/frontend_asa/dev_pr.yml new file mode 100644 index 0000000000..a05f41ceb2 --- /dev/null +++ b/.github/workflows/frontend_asa/dev_pr.yml @@ -0,0 +1,47 @@ +name: Development Front End Pull Request + +on: + pull_request: + branches: + - Development + paths: + - 'frontend/**' + workflow_dispatch: + +env: + TERRAFORM_VERSION: "1.2.9" + TF_IN_AUTOMATION: "True" + ENVIRONMENT: "dev" + +jobs: + terraform_plan: + runs-on: ubuntu-latest + if: github.event.review.state != 'approved' + steps: + - uses: actions/checkout@v3 + + - name: Get PR ID + id: pr-id + shell: bash + env: + GITHUB_REF: ${{ inputs.github_ref }} + run: | + PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT + + - name: Terraform Plan + uses: ./.github/actions/tf-plan + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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: ${{ steps.pr-id.outputs.PR_NUMBER }} + tf_vars: | + { + "environment": "${{ env.ENVIRONMENT }}", + "commit_hash": "${{ github.sha }}" + } From f9aab858ce51a8407aca845ef93ee39dc5d1d955 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 11 Dec 2023 11:57:34 -0500 Subject: [PATCH 004/202] chore: Updated condition to run when a PR is created --- .github/workflows/frontend_asa/dev_pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/frontend_asa/dev_pr.yml b/.github/workflows/frontend_asa/dev_pr.yml index a05f41ceb2..2f78815ffc 100644 --- a/.github/workflows/frontend_asa/dev_pr.yml +++ b/.github/workflows/frontend_asa/dev_pr.yml @@ -16,7 +16,6 @@ env: jobs: terraform_plan: runs-on: ubuntu-latest - if: github.event.review.state != 'approved' steps: - uses: actions/checkout@v3 From dc4cfc946f820ab635f62b3cc2c2e96781b8efc3 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 11 Dec 2023 12:01:10 -0500 Subject: [PATCH 005/202] chore: Changed title and description --- .github/actions/tf-apply/action.yaml | 4 +- .../workflows/frontend_asa/dev_pr_merge.yml | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/frontend_asa/dev_pr_merge.yml diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index c03167e5b4..4e3400b96c 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -1,5 +1,5 @@ -name: 'Terraform setup and plan' -description: 'Setup Terraform and creates plan' +name: 'Terraform setup and apply' +description: 'Setup Terraform and applies Terraform config' inputs: terraform_directory: description: 'Directory that holds Terraform code' diff --git a/.github/workflows/frontend_asa/dev_pr_merge.yml b/.github/workflows/frontend_asa/dev_pr_merge.yml new file mode 100644 index 0000000000..a12b75ab75 --- /dev/null +++ b/.github/workflows/frontend_asa/dev_pr_merge.yml @@ -0,0 +1,43 @@ +name: Development Front End Pull Request Merge + +on: + pull_request: + branches: + - Development + paths: + - 'frontend/**' + workflow_dispatch: + +env: + TERRAFORM_VERSION: "1.2.9" + TF_IN_AUTOMATION: "True" + ENVIRONMENT: "dev" + +jobs: + terraform_apply: + runs-on: ubuntu-latest + if: github.event.action == 'closed' && github.event.pull_request.merged + steps: + - uses: actions/checkout@v3 + + - name: Get PR ID + id: pr-id + shell: bash + run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV + + - name: Terraform Apply + uses: ./.github/actions/tf-apply + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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: ${{ steps.pr-id.outputs.PR_NUMBER }} + # tf_vars: | + # { + # "environment": "${{ env.ENVIRONMENT }}", + # "commit_hash": "${{ github.sha }}" + # } From 42abff8f97f94040179b1ec7b0ac70bb7ec708d0 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 11 Dec 2023 13:30:41 -0500 Subject: [PATCH 006/202] feat: added terraform module for asa deployment --- terraform/eus/dev/frontend_asa/context.tf | 11 +++++ terraform/eus/dev/frontend_asa/main.tf | 54 +++++++++++++++++++++ terraform/eus/dev/frontend_asa/providers.tf | 3 ++ terraform/eus/dev/frontend_asa/terraform.tf | 15 ++++++ terraform/eus/dev/frontend_asa/variables.tf | 17 +++++++ 5 files changed, 100 insertions(+) create mode 100644 terraform/eus/dev/frontend_asa/context.tf create mode 100644 terraform/eus/dev/frontend_asa/main.tf create mode 100644 terraform/eus/dev/frontend_asa/providers.tf create mode 100644 terraform/eus/dev/frontend_asa/terraform.tf create mode 100644 terraform/eus/dev/frontend_asa/variables.tf diff --git a/terraform/eus/dev/frontend_asa/context.tf b/terraform/eus/dev/frontend_asa/context.tf new file mode 100644 index 0000000000..9b5302007d --- /dev/null +++ b/terraform/eus/dev/frontend_asa/context.tf @@ -0,0 +1,11 @@ +module "ctx" { + source = "../../../global/context" + environment = var.environment + custom_workload = "be4s" + +} + +data "azurerm_container_app_environment" "aca_env" { + name = module.ctx.labels.core.resourceNames["azurerm_container_app_environment"] + resource_group_name = module.ctx.resource_group_name +} diff --git a/terraform/eus/dev/frontend_asa/main.tf b/terraform/eus/dev/frontend_asa/main.tf new file mode 100644 index 0000000000..7c98c2c27e --- /dev/null +++ b/terraform/eus/dev/frontend_asa/main.tf @@ -0,0 +1,54 @@ +locals { + content_types = { + ".json" = "application/json", + ".ico" = "image/x-icon", + ".html" = "text/html", + ".png" = "image/png", + ".jpg" = "image/jpeg", + ".txt" = "text/plain", + ".js" = "application/javascript", + ".css" = "text/css", + ".map" = "application/json", + ".woff2" = "font/woff2", + ".svg" = "image/svg+xml", + # Add more extensions and content types as needed + } +} + +## Build the react app +resource "null_resource" "build" { + triggers = { + backend_domain = "https://${module.ctx.labels.sbe.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" + commit = var.commit_hash + } + + provisioner "local-exec" { + + working_dir = var.frontend_dir + command = "yarn build:terraform" + + environment = { + REACT_APP_BACKEND_DOMAIN = self.triggers.backend_domain + } + } +} + +## Use terraform data source for files to get hashes +data "local_file" "fileset_hash" { + for_each = fileset("${var.frontend_dir}/build", "**/*.*") + + filename = "${var.frontend_dir}/build/${each.value}" + depends_on = [null_resource.build] +} + +## "Deploy" +resource "azurerm_storage_blob" "site" { + for_each = data.local_file.fileset_hash + name = trimprefix(each.value.filename, "${var.frontend_dir}/build/") + storage_account_name = module.ctx.labels.sfe.resourceNames["azurerm_storage_account"] + storage_container_name = "$web" + type = "Block" + source = each.value.filename #"../../../../frontend/build/${each.value}" + content_type = local.content_types[lower(regex("\\.[^.]+$", basename(each.value.filename)))] + content_md5 = each.value.content_md5 +} diff --git a/terraform/eus/dev/frontend_asa/providers.tf b/terraform/eus/dev/frontend_asa/providers.tf new file mode 100644 index 0000000000..ab91b24812 --- /dev/null +++ b/terraform/eus/dev/frontend_asa/providers.tf @@ -0,0 +1,3 @@ +provider "azurerm" { + features {} +} diff --git a/terraform/eus/dev/frontend_asa/terraform.tf b/terraform/eus/dev/frontend_asa/terraform.tf new file mode 100644 index 0000000000..512b23f676 --- /dev/null +++ b/terraform/eus/dev/frontend_asa/terraform.tf @@ -0,0 +1,15 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "3.79.0" + } + } + + backend "azurerm" { + resource_group_name = "opre-ops-dev-eus-tf-rg" + storage_account_name = "opreopsdeveustfst" + container_name = "opre-ops-dev-eus-tf-sc" + key = "ops-fe-static-deployment.tfstate" + } +} diff --git a/terraform/eus/dev/frontend_asa/variables.tf b/terraform/eus/dev/frontend_asa/variables.tf new file mode 100644 index 0000000000..ae9f3b4be0 --- /dev/null +++ b/terraform/eus/dev/frontend_asa/variables.tf @@ -0,0 +1,17 @@ +variable "commit_hash" { + type = string + description = "Git Commit Hash to which this is built to" + default = "noworky" +} + +variable "frontend_dir" { + type = string + description = "Relative path to frontend app directory" + default = "../../../../frontend" +} + +variable "environment" { + description = "Environment tag for the resources" + type = string + default = "dev" +} From 63ef97059c6fa7a1c77afe6020f3daa9a2155afe Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 11 Dec 2023 13:42:43 -0500 Subject: [PATCH 007/202] chore: pointed context to versioned ref --- terraform/eus/dev/frontend_asa/context.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/eus/dev/frontend_asa/context.tf b/terraform/eus/dev/frontend_asa/context.tf index 9b5302007d..508d7e481a 100644 --- a/terraform/eus/dev/frontend_asa/context.tf +++ b/terraform/eus/dev/frontend_asa/context.tf @@ -1,5 +1,5 @@ module "ctx" { - source = "../../../global/context" + source = "git@github.com:HHS/OPRE-OPS.git//terraform/global/context?ref=tf-global-context-v0.0.1" environment = var.environment custom_workload = "be4s" From e7b52d62a2fc4bd3a57c1a5d07e1e6834aa64716 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 11 Dec 2023 13:44:46 -0500 Subject: [PATCH 008/202] Update Dockerfile Testing gha. --- frontend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index a012c8e1e4..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -9,4 +9,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ -CMD ["bun", "start"] \ No newline at end of file +CMD ["bun", "start"] From 184fbf247bda737df677deffa9cde3c7276ad887 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 11 Dec 2023 13:47:00 -0500 Subject: [PATCH 009/202] chore: case sensitive? --- .github/workflows/frontend_asa/dev_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend_asa/dev_pr.yml b/.github/workflows/frontend_asa/dev_pr.yml index 2f78815ffc..52fd86e3a8 100644 --- a/.github/workflows/frontend_asa/dev_pr.yml +++ b/.github/workflows/frontend_asa/dev_pr.yml @@ -3,7 +3,7 @@ name: Development Front End Pull Request on: pull_request: branches: - - Development + - development paths: - 'frontend/**' workflow_dispatch: From 175d8fda99ddd30ab28cc038e6dca7f89fce68de Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 11 Dec 2023 13:59:02 -0500 Subject: [PATCH 010/202] chore: moved workflows --- .github/workflows/{frontend_asa => }/dev_pr.yml | 2 +- .github/workflows/{frontend_asa => }/dev_pr_merge.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{frontend_asa => }/dev_pr.yml (98%) rename .github/workflows/{frontend_asa => }/dev_pr_merge.yml (98%) diff --git a/.github/workflows/frontend_asa/dev_pr.yml b/.github/workflows/dev_pr.yml similarity index 98% rename from .github/workflows/frontend_asa/dev_pr.yml rename to .github/workflows/dev_pr.yml index 2f78815ffc..52fd86e3a8 100644 --- a/.github/workflows/frontend_asa/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -3,7 +3,7 @@ name: Development Front End Pull Request on: pull_request: branches: - - Development + - development paths: - 'frontend/**' workflow_dispatch: diff --git a/.github/workflows/frontend_asa/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml similarity index 98% rename from .github/workflows/frontend_asa/dev_pr_merge.yml rename to .github/workflows/dev_pr_merge.yml index a12b75ab75..80243cfc43 100644 --- a/.github/workflows/frontend_asa/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -3,7 +3,7 @@ name: Development Front End Pull Request Merge on: pull_request: branches: - - Development + - development paths: - 'frontend/**' workflow_dispatch: From 454a6afaf795ce768daecdb8f92b805470b8c5cc Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 11 Dec 2023 14:19:45 -0500 Subject: [PATCH 011/202] Update dev_pr.yml --- .github/workflows/dev_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 52fd86e3a8..c12f5a705a 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -1,6 +1,7 @@ name: Development Front End Pull Request on: + push: pull_request: branches: - development From ed3c3c91f25afa3f931a2c3073eb2b9eea053716 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 11 Dec 2023 14:20:20 -0500 Subject: [PATCH 012/202] Update dev_pr_merge.yml --- .github/workflows/dev_pr_merge.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index 80243cfc43..61cbb9dfa6 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -1,6 +1,7 @@ name: Development Front End Pull Request Merge on: + push: pull_request: branches: - development From 40f1169b10c5ff22cce8ee14c5f1c6046aff638c Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 11 Dec 2023 14:32:24 -0500 Subject: [PATCH 013/202] chore: troubleshooting --- .github/actions/tf-plan/action.yaml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index 98bf330efd..b8fc0934b2 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -44,30 +44,18 @@ runs: - name: Setup Terraform uses: hashicorp/setup-terraform@v2 with: - terraform_version: ${{ inputs.terraforom_version }} + 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<> $GITHUB_OUTPUT terraform plan -no-color -out=tfplan >> $GITHUB_OUTPUT @@ -93,4 +81,4 @@ runs: ${{ steps.plan.outputs.plan }} ``` - Plan saved to GH artifacts. \ No newline at end of file + Plan saved to GH artifacts. From 4efb5ad50568e8b80c7911a408e9f00b7c88f310 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 11 Dec 2023 14:37:41 -0500 Subject: [PATCH 014/202] chore: I think I need bash here --- .github/actions/tf-plan/action.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index b8fc0934b2..3121da2734 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -40,6 +40,7 @@ runs: export TF_VAR_$key="${INPUT_TF_VARS[$key]}" done fi + shell: bash - name: Setup Terraform uses: hashicorp/setup-terraform@v2 @@ -52,6 +53,7 @@ runs: working-directory: ${{ inputs.terraform_directory }} run: | terraform init + shell: bash - name: Terraform Plan id: plan @@ -60,6 +62,7 @@ runs: echo 'plan<> $GITHUB_OUTPUT terraform plan -no-color -out=tfplan >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT + shell: bash - name: Save Artifact id: save-artifact From a6fd91f7f86182b58d52d8caa004aafcb0ca1fae Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 11 Dec 2023 14:41:32 -0500 Subject: [PATCH 015/202] chore: ssh is no go in gha --- terraform/eus/dev/frontend_asa/context.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/eus/dev/frontend_asa/context.tf b/terraform/eus/dev/frontend_asa/context.tf index 508d7e481a..359ae3ee04 100644 --- a/terraform/eus/dev/frontend_asa/context.tf +++ b/terraform/eus/dev/frontend_asa/context.tf @@ -1,5 +1,5 @@ module "ctx" { - source = "git@github.com:HHS/OPRE-OPS.git//terraform/global/context?ref=tf-global-context-v0.0.1" + source = "git::https://github.com/HHS/OPRE-OPS.git//terraform/global/context?ref=tf-global-context-v0.0.1" environment = var.environment custom_workload = "be4s" From 6d79f6b34618d92e26cc671f74a721d629ec71ae Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 09:29:11 -0500 Subject: [PATCH 016/202] chore: commented out old deployments --- .github/workflows/dev_deploy.yml | 52 +++++++++++++-------------- .github/workflows/staging_deploy.yml | 54 ++++++++++++++-------------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/.github/workflows/dev_deploy.yml b/.github/workflows/dev_deploy.yml index 8e399c27c6..f0f9eeb791 100644 --- a/.github/workflows/dev_deploy.yml +++ b/.github/workflows/dev_deploy.yml @@ -1,30 +1,30 @@ -name: Deployment DEV +# name: Deployment DEV -on: - # Disable until we have a new cloud environment. - # workflow_run: - # workflows: ["Continuous Integration"] - # types: - # - completed - # branches: [main] # extra branch for testing only during dev. - push: - branches: [development] - paths-ignore: - - '.github/**' # We don't want to trigger a deployment when we update the workflows. - - 'docs/**' # We don't want to trigger a deployment when we update the docs. - - '*.md' +# on: +# # Disable until we have a new cloud environment. +# # workflow_run: +# # workflows: ["Continuous Integration"] +# # types: +# # - completed +# # branches: [main] # extra branch for testing only during dev. +# push: +# branches: [development] +# paths-ignore: +# - '.github/**' # We don't want to trigger a deployment when we update the workflows. +# - 'docs/**' # We don't want to trigger a deployment when we update the docs. +# - '*.md' -jobs: +# jobs: - deployment: - permissions: - contents: read +# deployment: +# permissions: +# contents: read - # This uses a reusable_workflow a few special rules apply - # see ref: https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/reusing-workflows - name: Deploy to cloud.gov - uses: ./.github/workflows/deploy_reusable.yml - with: - environment: cloud_gov_dev - space: dev - secrets: inherit # This will allow the jobs to inherit from the envrionment secrets; which are limited to only deployment items anyway. +# # This uses a reusable_workflow a few special rules apply +# # see ref: https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/reusing-workflows +# name: Deploy to cloud.gov +# uses: ./.github/workflows/deploy_reusable.yml +# with: +# environment: cloud_gov_dev +# space: dev +# secrets: inherit # This will allow the jobs to inherit from the envrionment secrets; which are limited to only deployment items anyway. diff --git a/.github/workflows/staging_deploy.yml b/.github/workflows/staging_deploy.yml index 86e82c081f..0d8753af8f 100644 --- a/.github/workflows/staging_deploy.yml +++ b/.github/workflows/staging_deploy.yml @@ -1,31 +1,31 @@ -name: Deployment STAGING +# name: Deployment STAGING -on: - # Deploy to STAGING nightly, since DEV is updated on each PUSH. This will ensure STAGING remains close to DEV - # but doesn't conflict with daily testing. - # schedule: - # cron format: 'minute hour dayofmonth month dayofweek' - # this will run at 8AM UTC every day (3am EST / 4am EDT) - # - cron: '0 8 * * *' - push: - branches: - - staging - paths-ignore: - - '.github/**' # We don't want to trigger a deployment when we update the workflows. - - 'docs/**' # We don't want to trigger a deployment when we update the docs. - - '*.md' +# on: +# # Deploy to STAGING nightly, since DEV is updated on each PUSH. This will ensure STAGING remains close to DEV +# # but doesn't conflict with daily testing. +# # schedule: +# # cron format: 'minute hour dayofmonth month dayofweek' +# # this will run at 8AM UTC every day (3am EST / 4am EDT) +# # - cron: '0 8 * * *' +# push: +# branches: +# - staging +# paths-ignore: +# - '.github/**' # We don't want to trigger a deployment when we update the workflows. +# - 'docs/**' # We don't want to trigger a deployment when we update the docs. +# - '*.md' -jobs: +# jobs: - deployment: - permissions: - contents: read +# deployment: +# permissions: +# contents: read - # This uses a reusable_workflow a few special rules apply - # see ref: https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/reusing-workflows - name: Deploy to cloud.gov - uses: ./.github/workflows/deploy_reusable.yml - with: - environment: cloud_gov_staging - space: staging - secrets: inherit # This will allow the jobs to inherit from the envrionment secrets; which are limited to only deployment items anyway. +# # This uses a reusable_workflow a few special rules apply +# # see ref: https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/reusing-workflows +# name: Deploy to cloud.gov +# uses: ./.github/workflows/deploy_reusable.yml +# with: +# environment: cloud_gov_staging +# space: staging +# secrets: inherit # This will allow the jobs to inherit from the envrionment secrets; which are limited to only deployment items anyway. From 83757c6bfba87ec356b5fbf8d33ba7312109890c Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 09:34:40 -0500 Subject: [PATCH 017/202] chore: updated version --- terraform/eus/dev/frontend_asa/context.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/eus/dev/frontend_asa/context.tf b/terraform/eus/dev/frontend_asa/context.tf index 359ae3ee04..65c1890b96 100644 --- a/terraform/eus/dev/frontend_asa/context.tf +++ b/terraform/eus/dev/frontend_asa/context.tf @@ -1,5 +1,5 @@ module "ctx" { - source = "git::https://github.com/HHS/OPRE-OPS.git//terraform/global/context?ref=tf-global-context-v0.0.1" + source = "git::https://github.com/HHS/OPRE-OPS.git//terraform/global/context?ref=tf-global-context-v0.0.2" environment = var.environment custom_workload = "be4s" From c4687080776874a60169b89a584c6972e63776f1 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 09:39:31 -0500 Subject: [PATCH 018/202] chore: added env --- .github/actions/tf-plan/action.yaml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index 3121da2734..a0c31222b8 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -51,18 +51,28 @@ runs: - 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 - shell: bash - 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<> $GITHUB_OUTPUT terraform plan -no-color -out=tfplan >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT - shell: bash - name: Save Artifact id: save-artifact From 76c1afe86b535718bc2a80b60330749f7b2ce0c1 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 09:43:47 -0500 Subject: [PATCH 019/202] chore: testing with PR only --- .github/workflows/dev_pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index c12f5a705a..52fd86e3a8 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -1,7 +1,6 @@ name: Development Front End Pull Request on: - push: pull_request: branches: - development From dd4093c5fcf095dc61eba5befe8fff0ace6ef0ba Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 09:52:56 -0500 Subject: [PATCH 020/202] chore: workflow needs permissions to write comments --- .github/workflows/dev_pr.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 52fd86e3a8..6f867f867b 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -15,6 +15,10 @@ env: jobs: terraform_plan: + + permissions: + pull-requests: write + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 From 210db939daf7b586ff5131b6afb1eee4a94a35ee Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 09:57:20 -0500 Subject: [PATCH 021/202] Update Dockerfile From 681ffb5c7deacf596c2e414e5caa8d8fc19659af Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 09:59:21 -0500 Subject: [PATCH 022/202] chore: troubleshooting --- .github/workflows/dev_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 6f867f867b..7eeab9d8d3 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -1,6 +1,7 @@ name: Development Front End Pull Request on: + push: pull_request: branches: - development From cdce6e0a39a5ca0d3356cd9a111fb774f8057128 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 10:02:17 -0500 Subject: [PATCH 023/202] Update Dockerfile again --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..0ab07df4bb 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +#commented From fcf446600d87ef10db130fb52e34fa0227acbbea Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 10:06:26 -0500 Subject: [PATCH 024/202] chore: more troubleshooting --- .github/workflows/dev_pr.yml | 1 - .github/workflows/dev_pr_merge.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 7eeab9d8d3..6f867f867b 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -1,7 +1,6 @@ name: Development Front End Pull Request on: - push: pull_request: branches: - development diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index 61cbb9dfa6..80243cfc43 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -1,7 +1,6 @@ name: Development Front End Pull Request Merge on: - push: pull_request: branches: - development From ffc7581da4fea05266107b32f205f1416f6f839e Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 10:07:19 -0500 Subject: [PATCH 025/202] Update Dockerfile another --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 0ab07df4bb..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -#commented From 388e9c0028017fc52f9126247d64f74024403326 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 10:14:10 -0500 Subject: [PATCH 026/202] chore: updated for bun --- terraform/eus/dev/frontend_asa/main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/eus/dev/frontend_asa/main.tf b/terraform/eus/dev/frontend_asa/main.tf index 7c98c2c27e..9291c94a23 100644 --- a/terraform/eus/dev/frontend_asa/main.tf +++ b/terraform/eus/dev/frontend_asa/main.tf @@ -25,10 +25,11 @@ resource "null_resource" "build" { provisioner "local-exec" { working_dir = var.frontend_dir - command = "yarn build:terraform" + command = "bun run build" environment = { REACT_APP_BACKEND_DOMAIN = self.triggers.backend_domain + VITE_BACKEND_DOMAIN = self.triggers.backend_domain } } } From 050b7bb0f2acdadd9b767b53e834ed91dd3ee4bd Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 10:16:23 -0500 Subject: [PATCH 027/202] Update Dockerfilesies --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..71cd255e14 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +#test-comment From 0483b10e01f9fd4f44d35a75574df8c8c2ec8f77 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 11:09:04 -0500 Subject: [PATCH 028/202] chore: some troubleshooting --- .github/actions/tf-plan/action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index a0c31222b8..9e0c0135f8 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -58,6 +58,8 @@ runs: ARM_SUBSCRIPTION_ID: ${{ inputs.azure_subscription_id }} ARM_TENANT_ID: ${{ inputs.azure_tenant_id }} run: | + env + echo "TF_COMMIT_HASH: $TF_VAR_commit_hash" terraform init - name: Terraform Plan From 76594f1c27bd4d847a37c79a2979cd2938b2b06b Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 11:31:41 -0500 Subject: [PATCH 029/202] Update Dockerfile-ts --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 71cd255e14..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -#test-comment From 0a43b3832c971054d99f272cfe22f8bc951b7fc7 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 11:37:13 -0500 Subject: [PATCH 030/202] chore: still troubleshooting --- .github/actions/tf-plan/action.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index 9e0c0135f8..d828094a5e 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -35,9 +35,10 @@ runs: steps: - name: Set Terraform Variables run: | - if [[ -n "${INPUT_TF_VARS}" ]]; then - for key in "${!INPUT_TF_VARS[@]}"; do - export TF_VAR_$key="${INPUT_TF_VARS[$key]}" + if [[ -n "${{ inputs.tf_vars }}" ]]; then + for key in "${!{ inputs.tf_vars }[@]}"; do + export TF_VAR_$key="${{ inputs.tf_vars }[$key]}" + echo "Exported TF_VAR_$key=${{ inputs.tf_vars }[$key]}" done fi shell: bash From 2b327fd2adc5cc915f6aed6cb415aeccc020a492 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 11:39:26 -0500 Subject: [PATCH 031/202] Update Dockerfile --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..1addddbf4b 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +#fjklsdjfksf From 04cd2fc0c01a4ca702149839353e216743d6e1de Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 11:48:06 -0500 Subject: [PATCH 032/202] chore: trying to output at set --- .github/actions/tf-plan/action.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index d828094a5e..cf17b8ead3 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -35,10 +35,10 @@ runs: steps: - name: Set Terraform Variables run: | - if [[ -n "${{ inputs.tf_vars }}" ]]; then - for key in "${!{ inputs.tf_vars }[@]}"; do - export TF_VAR_$key="${{ inputs.tf_vars }[$key]}" - echo "Exported TF_VAR_$key=${{ inputs.tf_vars }[$key]}" + if [[ -n "${INPUT_TF_VARS}" ]]; then + for key in "${!INPUT_TF_VARS[@]}"; do + export TF_VAR_$key="${INPUT_TF_VARS[$key]}" + echo "Exported TF_VAR_$key=${INPUT_TF_VARS[$key]}" done fi shell: bash @@ -59,7 +59,6 @@ runs: ARM_SUBSCRIPTION_ID: ${{ inputs.azure_subscription_id }} ARM_TENANT_ID: ${{ inputs.azure_tenant_id }} run: | - env echo "TF_COMMIT_HASH: $TF_VAR_commit_hash" terraform init From 6c045cc3770f9d6871f4c6e9a78b7427324279d3 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 11:56:15 -0500 Subject: [PATCH 033/202] chore: Think something is wrong with INPUT_ in composite action --- .github/actions/tf-plan/action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index cf17b8ead3..08ef9cd90b 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -42,6 +42,8 @@ runs: done fi shell: bash + env: + INPUT_TF_VARS: ${{ inputs.tf_vars }} - name: Setup Terraform uses: hashicorp/setup-terraform@v2 From c9dc12f83aaf8dd255b0cf66ac1a931048b2fc71 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 13:10:09 -0500 Subject: [PATCH 034/202] chore: json parse --- .github/actions/tf-plan/action.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index 08ef9cd90b..d7bbb1b14f 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -36,9 +36,13 @@ runs: - name: Set Terraform Variables run: | if [[ -n "${INPUT_TF_VARS}" ]]; then - for key in "${!INPUT_TF_VARS[@]}"; do - export TF_VAR_$key="${INPUT_TF_VARS[$key]}" - echo "Exported TF_VAR_$key=${INPUT_TF_VARS[$key]}" + for key in $(echo "${INPUT_TF_VARS}" | jq -r 'keys[]'); do + value=$(echo "${INPUT_TF_VARS}" | jq -r ".$key") + + export "TF_VAR_${key// /}=${value}" + + # Print debug statement + echo "Exported TF_VAR_${key// /}=${value}" done fi shell: bash From bda67f89f2f806aa09bcfd57ea4bfcb36be2bf3d Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 13:22:39 -0500 Subject: [PATCH 035/202] chore: Trying write to global env --- .github/actions/tf-plan/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index d7bbb1b14f..d8be5c9ccc 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -39,7 +39,7 @@ runs: for key in $(echo "${INPUT_TF_VARS}" | jq -r 'keys[]'); do value=$(echo "${INPUT_TF_VARS}" | jq -r ".$key") - export "TF_VAR_${key// /}=${value}" + echo "TF_VAR_${key// /}=${value}" >> $GITHUB_ENV # Print debug statement echo "Exported TF_VAR_${key// /}=${value}" From 339e4d437d0aca51d6ffce2824c963089a90258d Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 22:58:42 -0500 Subject: [PATCH 036/202] chore: Running the build on PR --- .github/workflows/dev_pr.yml | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 6f867f867b..6267fc8143 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -14,8 +14,31 @@ env: ENVIRONMENT: "dev" jobs: - terraform_plan: + frontend-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + path: frontend + + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + - name: Install dependencies + run: bun install + + - name: Build Frontend + run: bun run build + + - name: Archive Artifacts + uses: actions/upload-artifact@v2 + with: + name: frontend-${{ env.ENVIRONMENT }}-build-${{ github.sha }} + path: frontend/build + + terraform_plan: permissions: pull-requests: write @@ -23,6 +46,12 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Download Frontend Artifacts + uses: actions/download-artifact@v2 + with: + name: frontend-${{ env.ENVIRONMENT }}-build-${{ github.sha }} + path: frontend + - name: Get PR ID id: pr-id shell: bash From bcb6ed7b933e80be267d412fbcfb94df82e3b1a1 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 23:00:48 -0500 Subject: [PATCH 037/202] chore: Take out build here --- terraform/eus/dev/frontend_asa/main.tf | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/terraform/eus/dev/frontend_asa/main.tf b/terraform/eus/dev/frontend_asa/main.tf index 9291c94a23..99cb7c506b 100644 --- a/terraform/eus/dev/frontend_asa/main.tf +++ b/terraform/eus/dev/frontend_asa/main.tf @@ -15,31 +15,31 @@ locals { } } -## Build the react app -resource "null_resource" "build" { - triggers = { - backend_domain = "https://${module.ctx.labels.sbe.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" - commit = var.commit_hash - } +# ## Build the react app +# resource "null_resource" "build" { +# triggers = { +# backend_domain = "https://${module.ctx.labels.sbe.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" +# commit = var.commit_hash +# } - provisioner "local-exec" { +# provisioner "local-exec" { - working_dir = var.frontend_dir - command = "bun run build" +# working_dir = var.frontend_dir +# command = "bun run build" - environment = { - REACT_APP_BACKEND_DOMAIN = self.triggers.backend_domain - VITE_BACKEND_DOMAIN = self.triggers.backend_domain - } - } -} +# environment = { +# REACT_APP_BACKEND_DOMAIN = self.triggers.backend_domain +# VITE_BACKEND_DOMAIN = self.triggers.backend_domain +# } +# } +# } ## Use terraform data source for files to get hashes data "local_file" "fileset_hash" { for_each = fileset("${var.frontend_dir}/build", "**/*.*") filename = "${var.frontend_dir}/build/${each.value}" - depends_on = [null_resource.build] + //depends_on = [null_resource.build] } ## "Deploy" From 16d5b5b6632286466a8699850965710ee1f5e9b8 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 12 Dec 2023 23:09:03 -0500 Subject: [PATCH 038/202] Update dev_pr.yml --- .github/workflows/dev_pr.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 6267fc8143..b7f167461f 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -12,6 +12,7 @@ env: TERRAFORM_VERSION: "1.2.9" TF_IN_AUTOMATION: "True" ENVIRONMENT: "dev" + FRONTEND_DIR: "frontend" jobs: frontend-build: @@ -19,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v2 with: - path: frontend + path: ${{ env.FRONTEND_DIR }} - name: Setup Bun uses: oven-sh/setup-bun@v1 @@ -27,16 +28,18 @@ jobs: bun-version: latest - name: Install dependencies + working-directory: ${{ env.FRONTEND_DIR }} run: bun install - name: Build Frontend + working-directory: ${{ env.FRONTEND_DIR }} run: bun run build - name: Archive Artifacts uses: actions/upload-artifact@v2 with: - name: frontend-${{ env.ENVIRONMENT }}-build-${{ github.sha }} - path: frontend/build + name: ${{ env.FRONTEND_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} + path: ${{ env.FRONTEND_DIR }}/build terraform_plan: permissions: @@ -49,8 +52,8 @@ jobs: - name: Download Frontend Artifacts uses: actions/download-artifact@v2 with: - name: frontend-${{ env.ENVIRONMENT }}-build-${{ github.sha }} - path: frontend + name: ${{ env.FRONTEND_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} + path: ${{ env.FRONTEND_DIR }} - name: Get PR ID id: pr-id From 2cd58a685dda2ca17c91c54f97a87c8d2443bfed Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 23:15:32 -0500 Subject: [PATCH 039/202] chore: debugging --- .github/workflows/dev_pr.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index b7f167461f..0d2d2e5a5a 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -12,7 +12,7 @@ env: TERRAFORM_VERSION: "1.2.9" TF_IN_AUTOMATION: "True" ENVIRONMENT: "dev" - FRONTEND_DIR: "frontend" + WORKING_DIR: "frontend" jobs: frontend-build: @@ -20,7 +20,13 @@ jobs: steps: - uses: actions/checkout@v2 with: - path: ${{ env.FRONTEND_DIR }} + path: ${{ env.WORKING_DIR }} + + - name: Debug Info + run: | + pwd + ls -a + working-directory: ${{ env.FRONTEND_DIR }} - name: Setup Bun uses: oven-sh/setup-bun@v1 @@ -28,18 +34,18 @@ jobs: bun-version: latest - name: Install dependencies - working-directory: ${{ env.FRONTEND_DIR }} + working-directory: ${{ env.WORKING_DIR }} run: bun install - name: Build Frontend - working-directory: ${{ env.FRONTEND_DIR }} + working-directory: ${{ env.WORKING_DIR }} run: bun run build - name: Archive Artifacts uses: actions/upload-artifact@v2 with: - name: ${{ env.FRONTEND_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} - path: ${{ env.FRONTEND_DIR }}/build + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} + path: ${{ env.WORKING_DIR }}/build terraform_plan: permissions: @@ -52,8 +58,8 @@ jobs: - name: Download Frontend Artifacts uses: actions/download-artifact@v2 with: - name: ${{ env.FRONTEND_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} - path: ${{ env.FRONTEND_DIR }} + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} + path: ${{ env.WORKING_DIR }} - name: Get PR ID id: pr-id From e938487de36b57de9cd4b4274189f19474bbf5d7 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 23:20:53 -0500 Subject: [PATCH 040/202] chore: debugging --- .github/workflows/dev_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 0d2d2e5a5a..43eeafc22b 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -26,7 +26,7 @@ jobs: run: | pwd ls -a - working-directory: ${{ env.FRONTEND_DIR }} + working-directory: ${{ env.WORKING_DIR }} - name: Setup Bun uses: oven-sh/setup-bun@v1 From 7ec20e450256abfe4384adb2ddda0ec5bcc7273e Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 23:29:31 -0500 Subject: [PATCH 041/202] chore: removed path --- .github/workflows/dev_pr.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 43eeafc22b..2ab9d5ec8e 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -19,15 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: - path: ${{ env.WORKING_DIR }} - - - name: Debug Info - run: | - pwd - ls -a - working-directory: ${{ env.WORKING_DIR }} - + - name: Setup Bun uses: oven-sh/setup-bun@v1 with: From 711e18e7a35e52619ef16903104f7dda55a9d768 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 23:36:33 -0500 Subject: [PATCH 042/202] chore: set deploy to need build --- .github/workflows/dev_pr.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 2ab9d5ec8e..0c9f505a91 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -15,7 +15,7 @@ env: WORKING_DIR: "frontend" jobs: - frontend-build: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -39,7 +39,8 @@ jobs: name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} path: ${{ env.WORKING_DIR }}/build - terraform_plan: + deploy: + needs: build permissions: pull-requests: write From 83cde0bdef8eb38c4b6a6b58e1e6cab027cb07a9 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 12 Dec 2023 23:56:11 -0500 Subject: [PATCH 043/202] chore: change path --- .github/workflows/dev_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 0c9f505a91..acd8d5c0ae 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -52,7 +52,7 @@ jobs: uses: actions/download-artifact@v2 with: name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} - path: ${{ env.WORKING_DIR }} + path: ${{ env.WORKING_DIR }}/build - name: Get PR ID id: pr-id From 9f0aaa6dfc883e3c3e4d6e81c0ea09099200bfb3 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 11:18:13 -0500 Subject: [PATCH 044/202] chore: testing --- .github/actions/tf-apply/action.yaml | 22 +++++++++++----------- .github/workflows/dev_pr.yml | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 4e3400b96c..e2a956a1d1 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -72,15 +72,15 @@ runs: terraform apply -input=false -no-color tfplan >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT - - name: Comment Apply - id: comment-apply - uses: peter-evans/create-or-update-comment@v2 - with: - token: ${{ inputs.github_token }} - issue-number: ${{ inputs.pr_id }} - body: | - Terraform Apply: + # - name: Comment Apply + # id: comment-apply + # uses: peter-evans/create-or-update-comment@v2 + # with: + # token: ${{ inputs.github_token }} + # issue-number: ${{ inputs.pr_id }} + # body: | + # Terraform Apply: - ``` - ${{ steps.apply.outputs.apply }} - ``` \ No newline at end of file + # ``` + # ${{ steps.apply.outputs.apply }} + # ``` \ No newline at end of file diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index acd8d5c0ae..ef2b84fdc5 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -9,7 +9,7 @@ on: workflow_dispatch: env: - TERRAFORM_VERSION: "1.2.9" + TERRAFORM_VERSION: "1.5.7" TF_IN_AUTOMATION: "True" ENVIRONMENT: "dev" WORKING_DIR: "frontend" From 9f0e03502cd3d3e7c0c46889149faae65ee00ce3 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 11:19:46 -0500 Subject: [PATCH 045/202] Update Dockerfile --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 1addddbf4b..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -#fjklsdjfksf From e668ae2b51bb068fd3f646d3e778994e1a42918b Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 11:39:01 -0500 Subject: [PATCH 046/202] chore: testing --- .github/workflows/dev_push.yml | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/dev_push.yml diff --git a/.github/workflows/dev_push.yml b/.github/workflows/dev_push.yml new file mode 100644 index 0000000000..efe571d21b --- /dev/null +++ b/.github/workflows/dev_push.yml @@ -0,0 +1,43 @@ +name: Terraform Apply + +on: + push: + branches: + - development + +jobs: + terraform_apply: + runs-on: ubuntu-latest + + steps: + - name: Check if push is from a PR + run: | + if [ "${{ github.event_name }}" = "push" ]; then + if [ "${{ github.event.pull_request }}" != "null" ]; then + PR_NUMBER=$(jq -r .number $GITHUB_EVENT_PATH) + echo "This push is from PR #$PR_NUMBER." + + # Download Terraform plan archive from the PR + terraform_archive_path="terraform_plan_${PR_NUMBER}.zip" + echo "::set-env name=TERRAFORM_ARCHIVE_PATH::$terraform_archive_path" + echo "Downloading Terraform plan archive from PR..." + gh run download -R $GITHUB_REPOSITORY -r $PR_NUMBER -n "Terraform Plan" -p /github/workspace -f $terraform_archive_path + else + echo "This push is not from a PR." + fi + else + echo "This is not a push event." + fi + + # - name: Display Terraform Plan + # if: success() && env.TERRAFORM_ARCHIVE_PATH + # run: | + # # Unzip and display the Terraform plan + # unzip -q $TERRAFORM_ARCHIVE_PATH -d terraform_plan + # cat terraform_plan/tfplan + + # - name: Apply Terraform Changes + # if: success() && !env.TERRAFORM_ARCHIVE_PATH + # run: | + # # Apply Terraform changes without a plan + # terraform apply -auto-approve From 6710ce420d6a27ec04698da630bb66053ba3a4e2 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 11:40:05 -0500 Subject: [PATCH 047/202] chore: rebase issues --- frontend/.dockerignore | 20 ++++++++++++++++++-- terraform/eus/dev/frontend_asa/variables.tf | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/frontend/.dockerignore b/frontend/.dockerignore index c42a621545..9bc634a139 100644 --- a/frontend/.dockerignore +++ b/frontend/.dockerignore @@ -1,3 +1,19 @@ +# node_modules +# ./node_modules +# .yarn + node_modules -./node_modules -.yarn \ No newline at end of file +Dockerfile* +docker-compose* +.dockerignore +.git +.gitignore +README.md +LICENSE +.vscode +Makefile +helm-charts +.env +.editorconfig +.idea +coverage* \ No newline at end of file diff --git a/terraform/eus/dev/frontend_asa/variables.tf b/terraform/eus/dev/frontend_asa/variables.tf index ae9f3b4be0..3c34374bb0 100644 --- a/terraform/eus/dev/frontend_asa/variables.tf +++ b/terraform/eus/dev/frontend_asa/variables.tf @@ -1,7 +1,7 @@ variable "commit_hash" { type = string description = "Git Commit Hash to which this is built to" - default = "noworky" + default = "hmm" } variable "frontend_dir" { From 72768a46578eb078bcff1f7486f58f3cf28b34c1 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 12:03:47 -0500 Subject: [PATCH 048/202] chore: troubleshooting --- .github/workflows/dev_push.yml | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/dev_push.yml b/.github/workflows/dev_push.yml index efe571d21b..8eb3d6aa2c 100644 --- a/.github/workflows/dev_push.yml +++ b/.github/workflows/dev_push.yml @@ -1,33 +1,23 @@ name: Terraform Apply on: - push: + pull-request: + types: + - closed branches: - development - + paths: + - 'frontend/**' + jobs: terraform_apply: runs-on: ubuntu-latest steps: - name: Check if push is from a PR + if: ${{ github.event.pull_request.merged }} run: | - if [ "${{ github.event_name }}" = "push" ]; then - if [ "${{ github.event.pull_request }}" != "null" ]; then - PR_NUMBER=$(jq -r .number $GITHUB_EVENT_PATH) - echo "This push is from PR #$PR_NUMBER." - - # Download Terraform plan archive from the PR - terraform_archive_path="terraform_plan_${PR_NUMBER}.zip" - echo "::set-env name=TERRAFORM_ARCHIVE_PATH::$terraform_archive_path" - echo "Downloading Terraform plan archive from PR..." - gh run download -R $GITHUB_REPOSITORY -r $PR_NUMBER -n "Terraform Plan" -p /github/workspace -f $terraform_archive_path - else - echo "This push is not from a PR." - fi - else - echo "This is not a push event." - fi + echo " I think this worked ?? " # - name: Display Terraform Plan # if: success() && env.TERRAFORM_ARCHIVE_PATH From 41f475fb2b32484951d9d4b3a6a7aec322e32cee Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 12:04:43 -0500 Subject: [PATCH 049/202] Update Dockerfile --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..3ebd2ed5c8 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +##### From 2c31444a0af6fbf203bec6af2b4e3980b004a556 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 12:16:27 -0500 Subject: [PATCH 050/202] chore: troubleshooting --- .github/workflows/dev_push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev_push.yml b/.github/workflows/dev_push.yml index 8eb3d6aa2c..7bed192b19 100644 --- a/.github/workflows/dev_push.yml +++ b/.github/workflows/dev_push.yml @@ -1,14 +1,14 @@ name: Terraform Apply on: - pull-request: + pull_request: types: - closed branches: - development paths: - 'frontend/**' - + jobs: terraform_apply: runs-on: ubuntu-latest From 4363fb0605b3f7a04b66dd7c6046ef8f7d29b011 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 12:17:12 -0500 Subject: [PATCH 051/202] Update Dockerfile --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 3ebd2ed5c8..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -##### From e6f0b0176b195a6bda1a8a09fc5d5574936d3798 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 12:40:28 -0500 Subject: [PATCH 052/202] chore: updated apply --- .github/actions/tf-apply/action.yaml | 22 +++++++++++----------- .github/workflows/dev_pr_merge.yml | 5 +++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index e2a956a1d1..4e3400b96c 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -72,15 +72,15 @@ runs: terraform apply -input=false -no-color tfplan >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT - # - name: Comment Apply - # id: comment-apply - # uses: peter-evans/create-or-update-comment@v2 - # with: - # token: ${{ inputs.github_token }} - # issue-number: ${{ inputs.pr_id }} - # body: | - # Terraform Apply: + - name: Comment Apply + id: comment-apply + uses: peter-evans/create-or-update-comment@v2 + with: + token: ${{ inputs.github_token }} + issue-number: ${{ inputs.pr_id }} + body: | + Terraform Apply: - # ``` - # ${{ steps.apply.outputs.apply }} - # ``` \ No newline at end of file + ``` + ${{ steps.apply.outputs.apply }} + ``` \ No newline at end of file diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index 80243cfc43..a6e289b49d 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -2,11 +2,12 @@ name: Development Front End Pull Request Merge on: pull_request: + types: + - closed branches: - development paths: - 'frontend/**' - workflow_dispatch: env: TERRAFORM_VERSION: "1.2.9" @@ -16,7 +17,7 @@ env: jobs: terraform_apply: runs-on: ubuntu-latest - if: github.event.action == 'closed' && github.event.pull_request.merged + if: ${{ github.event.pull_request.merged }} steps: - uses: actions/checkout@v3 From b9ac568356a614ae0f111ca241005c1fe138602e Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 12:41:27 -0500 Subject: [PATCH 053/202] Update Dockerfile --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..91ba18cb82 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +### Comment From 648ecb9263d5951b471e4fc27c52dfc4f0179972 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 12:50:50 -0500 Subject: [PATCH 054/202] chore: fixed typo --- .github/actions/tf-apply/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 4e3400b96c..063919d511 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -33,7 +33,7 @@ runs: - name: Setup Terraform uses: hashicorp/setup-terraform@v2 with: - terraform_version: ${{ inputs.terraforom_version }} + terraform_version: ${{ inputs.terraform_version }} terraform_wrapper: false - name: Terraform Init From 431b536725bda94b7c329b8f7b78e8f991da3bf1 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 12:54:29 -0500 Subject: [PATCH 055/202] chore: indention? --- .github/actions/tf-apply/action.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 063919d511..cf9bfe5510 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -58,7 +58,7 @@ runs: name: ${{ inputs.pr_id }}-tf-plan path: ${{ inputs.terraform_directory }} - - name: Terraform Apply + - name: Terraform Apply id: apply working-directory: ${{ inputs.terraform_directory }} shell: bash @@ -72,6 +72,7 @@ runs: terraform apply -input=false -no-color tfplan >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT + - name: Comment Apply id: comment-apply uses: peter-evans/create-or-update-comment@v2 From 70c0fdda4f8d52af41be2e1362658b5a13129b1e Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 12:55:37 -0500 Subject: [PATCH 056/202] Update Dockerfile --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 91ba18cb82..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -### Comment From 8dac4723b8e955be61c41ca7e9224279924f4c95 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 13:01:57 -0500 Subject: [PATCH 057/202] chore: Troubleshooting logging --- .github/actions/tf-plan/action.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index d8be5c9ccc..f5009a0449 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -78,9 +78,11 @@ runs: ARM_SUBSCRIPTION_ID: ${{ inputs.azure_subscription_id }} ARM_TENANT_ID: ${{ inputs.azure_tenant_id }} run: | - echo 'plan<> $GITHUB_OUTPUT - terraform plan -no-color -out=tfplan >> $GITHUB_OUTPUT - echo 'EOF' >> $GITHUB_OUTPUT + { + echo 'plan<> $GITHUB_OUTPUT + terraform plan -no-color -out=tfplan >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT + } - name: Save Artifact id: save-artifact From e6a51f1cb9c81ad0f2a38167035a42a9e6550859 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 13:06:48 -0500 Subject: [PATCH 058/202] chore: troubleshooting --- .github/actions/tf-apply/action.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index cf9bfe5510..371ff5d405 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -58,6 +58,14 @@ runs: name: ${{ inputs.pr_id }}-tf-plan path: ${{ inputs.terraform_directory }} + - name: Debug - List Contents + run: | + ls -la ${{ inputs.terraform_directory }} + + - name: Debug - Display tfplan + run: | + cat ${{ inputs.terraform_directory }}/tfplan + - name: Terraform Apply id: apply working-directory: ${{ inputs.terraform_directory }} From 95cfc61097ba3fb1012c08d3f10b1a3da0c05024 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 13:07:19 -0500 Subject: [PATCH 059/202] Update Dockerfile --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..873a1c16a2 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +#3 From f44587e0bec323126a81dd75aca9fbacb11d37f5 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 13:17:51 -0500 Subject: [PATCH 060/202] chore: troubleshooting --- .github/actions/tf-apply/action.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 371ff5d405..2eb352ddba 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -58,11 +58,15 @@ runs: name: ${{ inputs.pr_id }}-tf-plan path: ${{ inputs.terraform_directory }} - - name: Debug - List Contents + - name: Debug List Contents + id: debug-contents + shell: bash run: | ls -la ${{ inputs.terraform_directory }} - - name: Debug - Display tfplan + - name: Debug Display tfplan + id: debug-display + shell: bash run: | cat ${{ inputs.terraform_directory }}/tfplan From ca5e218d723e5e8ae0dcef0eac4b922d0a78d783 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 13:18:28 -0500 Subject: [PATCH 061/202] chore: rolled back format --- .github/actions/tf-plan/action.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index f5009a0449..d8be5c9ccc 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -78,11 +78,9 @@ runs: ARM_SUBSCRIPTION_ID: ${{ inputs.azure_subscription_id }} ARM_TENANT_ID: ${{ inputs.azure_tenant_id }} run: | - { - echo 'plan<> $GITHUB_OUTPUT - terraform plan -no-color -out=tfplan >> $GITHUB_OUTPUT - echo 'EOF' >> $GITHUB_OUTPUT - } + echo 'plan<> $GITHUB_OUTPUT + terraform plan -no-color -out=tfplan >> $GITHUB_OUTPUT + echo 'EOF' >> $GITHUB_OUTPUT - name: Save Artifact id: save-artifact From abaef1141a154083c3a92167897aa9230915e605 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 13:19:05 -0500 Subject: [PATCH 062/202] Update Dockerfile --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 873a1c16a2..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -#3 From 91d14e8aab5bb2341274eba97b526bdcf484df04 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 13:50:39 -0500 Subject: [PATCH 063/202] chore: changing PR Id to match dev_pr --- .github/workflows/dev_pr_merge.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index a6e289b49d..10e57ec246 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -24,8 +24,10 @@ jobs: - name: Get PR ID id: pr-id shell: bash - run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV - + run: | + PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT + - name: Terraform Apply uses: ./.github/actions/tf-apply with: From 824b79b29c55deed2abd59c7f2b4bb8868deba42 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 13:52:18 -0500 Subject: [PATCH 064/202] Update Dockerfile --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..585bee1140 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +## From 96b8ec36c8a476d6909479b5268105abed2dd0e6 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 17:01:37 -0500 Subject: [PATCH 065/202] chore: another approach --- .github/workflows/dev_pr_merge.yml | 84 +++++++++++++++--------------- .github/workflows/dev_push.yml | 63 ++++++++++++---------- 2 files changed, 77 insertions(+), 70 deletions(-) diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index 10e57ec246..94a686ee14 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -1,46 +1,46 @@ -name: Development Front End Pull Request Merge +# name: Development Front End Pull Request Merge -on: - pull_request: - types: - - closed - branches: - - development - paths: - - 'frontend/**' +# on: +# pull_request: +# types: +# - closed +# branches: +# - development +# paths: +# - 'frontend/**' -env: - TERRAFORM_VERSION: "1.2.9" - TF_IN_AUTOMATION: "True" - ENVIRONMENT: "dev" +# env: +# TERRAFORM_VERSION: "1.2.9" +# TF_IN_AUTOMATION: "True" +# ENVIRONMENT: "dev" -jobs: - terraform_apply: - runs-on: ubuntu-latest - if: ${{ github.event.pull_request.merged }} - steps: - - uses: actions/checkout@v3 +# jobs: +# terraform_apply: +# runs-on: ubuntu-latest +# if: ${{ github.event.pull_request.merged }} +# steps: +# - uses: actions/checkout@v3 - - name: Get PR ID - id: pr-id - shell: bash - run: | - PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') - echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT - - - name: Terraform Apply - uses: ./.github/actions/tf-apply - with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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: ${{ steps.pr-id.outputs.PR_NUMBER }} - # tf_vars: | - # { - # "environment": "${{ env.ENVIRONMENT }}", - # "commit_hash": "${{ github.sha }}" - # } +# - name: Get PR ID +# id: pr-id +# shell: bash +# run: | +# PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') +# echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT + +# - name: Terraform Apply +# uses: ./.github/actions/tf-apply +# with: +# terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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: ${{ steps.pr-id.outputs.PR_NUMBER }} +# # tf_vars: | +# # { +# # "environment": "${{ env.ENVIRONMENT }}", +# # "commit_hash": "${{ github.sha }}" +# # } diff --git a/.github/workflows/dev_push.yml b/.github/workflows/dev_push.yml index 7bed192b19..f8536540a6 100644 --- a/.github/workflows/dev_push.yml +++ b/.github/workflows/dev_push.yml @@ -1,33 +1,40 @@ -name: Terraform Apply +# name: Terraform Apply -on: - pull_request: - types: - - closed - branches: - - development - paths: - - 'frontend/**' +# on: +# pull_request: +# types: +# - closed +# branches: +# - development +# paths: +# - 'frontend/**' -jobs: - terraform_apply: - runs-on: ubuntu-latest +# jobs: +# terraform_apply: +# runs-on: ubuntu-latest - steps: - - name: Check if push is from a PR - if: ${{ github.event.pull_request.merged }} - run: | - echo " I think this worked ?? " +# steps: +# - name: Check if push is from a PR +# if: ${{ github.event.pull_request.merged }} +# run: | +# echo " I think this worked ?? " - # - name: Display Terraform Plan - # if: success() && env.TERRAFORM_ARCHIVE_PATH - # run: | - # # Unzip and display the Terraform plan - # unzip -q $TERRAFORM_ARCHIVE_PATH -d terraform_plan - # cat terraform_plan/tfplan - # - name: Apply Terraform Changes - # if: success() && !env.TERRAFORM_ARCHIVE_PATH - # run: | - # # Apply Terraform changes without a plan - # terraform apply -auto-approve +# - name: Get PR ID +# id: pr-id +# shell: bash +# run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV + + +# # - name: Display Terraform Plan +# # if: success() && env.TERRAFORM_ARCHIVE_PATH +# # run: | +# # # Unzip and display the Terraform plan +# # unzip -q $TERRAFORM_ARCHIVE_PATH -d terraform_plan +# # cat terraform_plan/tfplan + +# # - name: Apply Terraform Changes +# # if: success() && !env.TERRAFORM_ARCHIVE_PATH +# # run: | +# # # Apply Terraform changes without a plan +# # terraform apply -auto-approve From efc7e9787a253f85c6aeb3e9142505e4c0c3b762 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 17:02:33 -0500 Subject: [PATCH 066/202] Update Dockerfile --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 585bee1140..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -## From 2696322db030a14aa46da8019be7079b4e6fd8d4 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 17:08:33 -0500 Subject: [PATCH 067/202] chore: another approach --- .github/workflows/dev_pr.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index ef2b84fdc5..7c721cb77c 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -79,3 +79,21 @@ jobs: "environment": "${{ env.ENVIRONMENT }}", "commit_hash": "${{ github.sha }}" } + + - name: Terraform Apply + if: ${{ github.event.pull_request.closed }} && ${{ github.event.pull_request.merged }} + uses: ./.github/actions/tf-apply + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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: ${{ steps.pr-id.outputs.PR_NUMBER }} + # tf_vars: | + # { + # "environment": "${{ env.ENVIRONMENT }}", + # "commit_hash": "${{ github.sha }}" + # } From 7dc26ae903cb6eb5bdfc0881f10e5398f895cb98 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 17:38:13 -0500 Subject: [PATCH 068/202] chore: troubleshooting --- .github/workflows/dev_pr.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 7c721cb77c..ffae72774a 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -46,6 +46,13 @@ jobs: runs-on: ubuntu-latest steps: + - name: Debug Info + run: | + echo "Event Name: ${{ github.event_name }}" + echo "Event Action: ${{ github.event.action }}" + echo "Pull Request Number: ${{ github.event.pull_request.number }}" + if: always() + - uses: actions/checkout@v3 - name: Download Frontend Artifacts From 0d7fe706c321639d228419954770112fa0325d56 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 17:46:11 -0500 Subject: [PATCH 069/202] chore: troubleshooting --- .github/workflows/dev_pr.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index ffae72774a..31490cfbc9 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -51,6 +51,9 @@ jobs: echo "Event Name: ${{ github.event_name }}" echo "Event Action: ${{ github.event.action }}" echo "Pull Request Number: ${{ github.event.pull_request.number }}" + echo "Pull Request State: ${{ github.event.pull_request.state }}" + echo "Pull Request Merged: ${{ github.event.pull_request.merged }}" + echo "GitHub Event: ${{ toJson(github.event) }}" if: always() - uses: actions/checkout@v3 From f5826bf7a5d2b1993060bab2d243f8392fec3b1a Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 17:55:40 -0500 Subject: [PATCH 070/202] chore: troubleshooting --- .github/workflows/dev_pr.yml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 31490cfbc9..00e8210805 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -6,7 +6,6 @@ on: - development paths: - 'frontend/**' - workflow_dispatch: env: TERRAFORM_VERSION: "1.5.7" @@ -46,15 +45,15 @@ jobs: runs-on: ubuntu-latest steps: - - name: Debug Info - run: | - echo "Event Name: ${{ github.event_name }}" - echo "Event Action: ${{ github.event.action }}" - echo "Pull Request Number: ${{ github.event.pull_request.number }}" - echo "Pull Request State: ${{ github.event.pull_request.state }}" - echo "Pull Request Merged: ${{ github.event.pull_request.merged }}" - echo "GitHub Event: ${{ toJson(github.event) }}" - if: always() + # - name: Debug Info + # run: | + # echo "Event Name: ${{ github.event_name }}" + # echo "Event Action: ${{ github.event.action }}" + # echo "Pull Request Number: ${{ github.event.pull_request.number }}" + # echo "Pull Request State: ${{ github.event.pull_request.state }}" + # echo "Pull Request Merged: ${{ github.event.pull_request.merged }}" + # echo "GitHub Event: ${{ toJson(github.event) }}" + # if: always() - uses: actions/checkout@v3 @@ -91,7 +90,7 @@ jobs: } - name: Terraform Apply - if: ${{ github.event.pull_request.closed }} && ${{ github.event.pull_request.merged }} + if: ${{ github.event.pull_request.closed }} && ${{ github.event.pull_request.merged }} uses: ./.github/actions/tf-apply with: terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_asa" From a507cde8b75f1e9bec21b500dcb494e2005b2efd Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 23:14:21 -0500 Subject: [PATCH 071/202] chore: moved apply to seperate job --- .github/workflows/dev_pr.yml | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 00e8210805..2d03b750b0 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - + - name: Setup Bun uses: oven-sh/setup-bun@v1 with: @@ -27,7 +27,7 @@ jobs: - name: Install dependencies working-directory: ${{ env.WORKING_DIR }} run: bun install - + - name: Build Frontend working-directory: ${{ env.WORKING_DIR }} run: bun run build @@ -37,24 +37,14 @@ jobs: with: name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} path: ${{ env.WORKING_DIR }}/build - - deploy: + + plan-deploy: needs: build permissions: pull-requests: write runs-on: ubuntu-latest steps: - # - name: Debug Info - # run: | - # echo "Event Name: ${{ github.event_name }}" - # echo "Event Action: ${{ github.event.action }}" - # echo "Pull Request Number: ${{ github.event.pull_request.number }}" - # echo "Pull Request State: ${{ github.event.pull_request.state }}" - # echo "Pull Request Merged: ${{ github.event.pull_request.merged }}" - # echo "GitHub Event: ${{ toJson(github.event) }}" - # if: always() - - uses: actions/checkout@v3 - name: Download Frontend Artifacts @@ -66,8 +56,6 @@ jobs: - name: Get PR ID id: pr-id shell: bash - env: - GITHUB_REF: ${{ inputs.github_ref }} run: | PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT @@ -89,8 +77,12 @@ jobs: "commit_hash": "${{ github.sha }}" } + apply-deploy: + needs: plan-deploy + if: ${{ github.event.pull_request.closed }} && ${{ github.event.pull_request.merged }} + runs-on: ubuntu-latest + steps: - name: Terraform Apply - if: ${{ github.event.pull_request.closed }} && ${{ github.event.pull_request.merged }} uses: ./.github/actions/tf-apply with: terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_asa" From 4edcdb4d52dbfb6894c04c1a9a369712b6e290e7 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 23:19:52 -0500 Subject: [PATCH 072/202] chore: moved apply to seperate job --- .github/workflows/dev_pr.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 2d03b750b0..16a2b571ba 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -78,8 +78,11 @@ jobs: } apply-deploy: - needs: plan-deploy if: ${{ github.event.pull_request.closed }} && ${{ github.event.pull_request.merged }} + needs: plan-deploy + permissions: + pull-requests: write + runs-on: ubuntu-latest steps: - name: Terraform Apply From 4b0524e9cace3f636599edfcac1c0c3bb20b8b5e Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 23:25:15 -0500 Subject: [PATCH 073/202] chore: Had to add the action checkout --- .github/workflows/dev_pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 16a2b571ba..744958dc3c 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -85,6 +85,8 @@ jobs: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + - name: Terraform Apply uses: ./.github/actions/tf-apply with: From 2ab4e19b395fd22628e4ee939f6b81670e50275e Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 23:40:37 -0500 Subject: [PATCH 074/202] chore: restructured --- .github/actions/tf-apply/action.yaml | 5 +- .github/workflows/dev_pr.yml | 47 ++++++---------- .github/workflows/dev_pr_merge.yml | 83 ++++++++++++++-------------- 3 files changed, 62 insertions(+), 73 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 2eb352ddba..71566ad040 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -26,6 +26,9 @@ inputs: pr_id: description: 'Pull request ID' required: true + plan_workflow_file: + description: 'Filename of workflow containing the tf plan artifact.' + required: true runs: using: "composite" @@ -53,7 +56,7 @@ runs: uses: dawidd6/action-download-artifact@v2 with: github_token: ${{ inputs.github_token }} - workflow: plan.yaml + workflow: ${{ inputs.plan_workflow_file }} pr: ${{ inputs.pr_id }} name: ${{ inputs.pr_id }}-tf-plan path: ${{ inputs.terraform_directory }} diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 744958dc3c..0ea3a10dcf 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - + - name: Setup Bun uses: oven-sh/setup-bun@v1 with: @@ -27,7 +27,7 @@ jobs: - name: Install dependencies working-directory: ${{ env.WORKING_DIR }} run: bun install - + - name: Build Frontend working-directory: ${{ env.WORKING_DIR }} run: bun run build @@ -37,14 +37,24 @@ jobs: with: name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} path: ${{ env.WORKING_DIR }}/build - - plan-deploy: + + deploy: needs: build permissions: pull-requests: write runs-on: ubuntu-latest steps: + # - name: Debug Info + # run: | + # echo "Event Name: ${{ github.event_name }}" + # echo "Event Action: ${{ github.event.action }}" + # echo "Pull Request Number: ${{ github.event.pull_request.number }}" + # echo "Pull Request State: ${{ github.event.pull_request.state }}" + # echo "Pull Request Merged: ${{ github.event.pull_request.merged }}" + # echo "GitHub Event: ${{ toJson(github.event) }}" + # if: always() + - uses: actions/checkout@v3 - name: Download Frontend Artifacts @@ -56,6 +66,8 @@ jobs: - name: Get PR ID id: pr-id shell: bash + env: + GITHUB_REF: ${{ inputs.github_ref }} run: | PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT @@ -76,30 +88,3 @@ jobs: "environment": "${{ env.ENVIRONMENT }}", "commit_hash": "${{ github.sha }}" } - - apply-deploy: - if: ${{ github.event.pull_request.closed }} && ${{ github.event.pull_request.merged }} - needs: plan-deploy - permissions: - pull-requests: write - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Terraform Apply - uses: ./.github/actions/tf-apply - with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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: ${{ steps.pr-id.outputs.PR_NUMBER }} - # tf_vars: | - # { - # "environment": "${{ env.ENVIRONMENT }}", - # "commit_hash": "${{ github.sha }}" - # } diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index 94a686ee14..02aaef2e9f 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -1,46 +1,47 @@ -# name: Development Front End Pull Request Merge +name: Development Front End Pull Request Merge -# on: -# pull_request: -# types: -# - closed -# branches: -# - development -# paths: -# - 'frontend/**' +on: + pull_request: + types: + - closed + branches: + - development + paths: + - 'frontend/**' -# env: -# TERRAFORM_VERSION: "1.2.9" -# TF_IN_AUTOMATION: "True" -# ENVIRONMENT: "dev" +env: + TERRAFORM_VERSION: "1.2.9" + TF_IN_AUTOMATION: "True" + ENVIRONMENT: "dev" -# jobs: -# terraform_apply: -# runs-on: ubuntu-latest -# if: ${{ github.event.pull_request.merged }} -# steps: -# - uses: actions/checkout@v3 +jobs: + terraform_apply: + runs-on: ubuntu-latest + if: ${{ github.event.pull_request.merged }} + steps: + - uses: actions/checkout@v3 -# - name: Get PR ID -# id: pr-id -# shell: bash -# run: | -# PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') -# echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT + - name: Get PR ID + id: pr-id + shell: bash + run: | + PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') + echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT -# - name: Terraform Apply -# uses: ./.github/actions/tf-apply -# with: -# terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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: ${{ steps.pr-id.outputs.PR_NUMBER }} -# # tf_vars: | -# # { -# # "environment": "${{ env.ENVIRONMENT }}", -# # "commit_hash": "${{ github.sha }}" -# # } + - name: Terraform Apply + uses: ./.github/actions/tf-apply + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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: ${{ steps.pr-id.outputs.PR_NUMBER }} + plan_workflow_file: dev_pr.yml + # tf_vars: | + # { + # "environment": "${{ env.ENVIRONMENT }}", + # "commit_hash": "${{ github.sha }}" + # } From 1ddaa5c800b1a9b00f7d74f47e8191585805d060 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 23:41:49 -0500 Subject: [PATCH 075/202] Update Dockerfile --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..a2a412a3f5 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +### From 390816a546250f2d27237474e52002a40a59760e Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 14 Dec 2023 23:54:06 -0500 Subject: [PATCH 076/202] chore: troubleshooting --- .github/workflows/dev_pr_merge.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index 02aaef2e9f..eecb6b82d4 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -24,6 +24,8 @@ jobs: - name: Get PR ID id: pr-id shell: bash + env: + GITHUB_REF: ${{ inputs.github_ref }} run: | PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT From fae82cf71f416c420802d0b30c6f3d8a9ee08185 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 14 Dec 2023 23:55:08 -0500 Subject: [PATCH 077/202] Update Dockerfile --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index a2a412a3f5..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -### From 9f4b14d57fd6e7bb595207e4b5862763641ef80a Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 00:07:34 -0500 Subject: [PATCH 078/202] chore: troubleshooting --- .github/workflows/dev_pr_merge.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index eecb6b82d4..c4d5b4eaf6 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -21,14 +21,14 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Get PR ID - id: pr-id - shell: bash - env: - GITHUB_REF: ${{ inputs.github_ref }} - run: | - PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') - echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT + # - name: Get PR ID + # id: pr-id + # shell: bash + # env: + # GITHUB_REF: ${{ inputs.github_ref }} + # run: | + # PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') + # echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT - name: Terraform Apply uses: ./.github/actions/tf-apply @@ -40,7 +40,7 @@ jobs: azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }} azure_tenant_id: ${{ secrets.ARM_TENANT_ID }} github_token: ${{ secrets.GITHUB_TOKEN }} - pr_id: ${{ steps.pr-id.outputs.PR_NUMBER }} + pr_id: ${{ github.event.pull_request.number }} plan_workflow_file: dev_pr.yml # tf_vars: | # { From bba9478a37c8fda7acc2105ea6f9ad22682cf937 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 00:08:10 -0500 Subject: [PATCH 079/202] Update Dockerfile --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..cb04cde06a 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +#help From 7fd7b74d68c27d3cf14edaaad07bcc5457281279 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 00:14:47 -0500 Subject: [PATCH 080/202] chore: cleanup --- .github/actions/tf-apply/action.yaml | 12 ------------ .github/workflows/dev_pr.yml | 19 ++++++++++--------- .github/workflows/dev_pr_merge.yml | 2 +- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 71566ad040..e8d9daa557 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -61,18 +61,6 @@ runs: name: ${{ inputs.pr_id }}-tf-plan path: ${{ inputs.terraform_directory }} - - name: Debug List Contents - id: debug-contents - shell: bash - run: | - ls -la ${{ inputs.terraform_directory }} - - - name: Debug Display tfplan - id: debug-display - shell: bash - run: | - cat ${{ inputs.terraform_directory }}/tfplan - - name: Terraform Apply id: apply working-directory: ${{ inputs.terraform_directory }} diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index 0ea3a10dcf..cfe314e01c 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -63,14 +63,14 @@ jobs: name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} path: ${{ env.WORKING_DIR }}/build - - name: Get PR ID - id: pr-id - shell: bash - env: - GITHUB_REF: ${{ inputs.github_ref }} - run: | - PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') - echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT + # - name: Get PR ID + # id: pr-id + # shell: bash + # env: + # GITHUB_REF: ${{ inputs.github_ref }} + # run: | + # PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') + # echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT - name: Terraform Plan uses: ./.github/actions/tf-plan @@ -82,7 +82,8 @@ jobs: azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }} azure_tenant_id: ${{ secrets.ARM_TENANT_ID }} github_token: ${{ secrets.GITHUB_TOKEN }} - pr_id: ${{ steps.pr-id.outputs.PR_NUMBER }} + # pr_id: ${{ steps.pr-id.outputs.PR_NUMBER }} + pr_id: ${{ github.event.pull_request.number }} tf_vars: | { "environment": "${{ env.ENVIRONMENT }}", diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index c4d5b4eaf6..46e52d6793 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -10,7 +10,7 @@ on: - 'frontend/**' env: - TERRAFORM_VERSION: "1.2.9" + TERRAFORM_VERSION: "1.5.7" TF_IN_AUTOMATION: "True" ENVIRONMENT: "dev" From f40f2e1c1c481fb1511a66cbe149a69a6f2ba4c9 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 00:15:37 -0500 Subject: [PATCH 081/202] Update Dockerfile --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index cb04cde06a..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -#help From c01a28ead3b877ac74b75185de3007fe350c3ac7 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 08:35:15 -0500 Subject: [PATCH 082/202] chore: updated and importing build --- .github/workflows/dev_pr.yml | 26 +++----------------------- .github/workflows/dev_pr_merge.yml | 25 +++++++++++-------------- 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index cfe314e01c..be9621bdff 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -35,7 +35,7 @@ jobs: - name: Archive Artifacts uses: actions/upload-artifact@v2 with: - name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} path: ${{ env.WORKING_DIR }}/build deploy: @@ -45,33 +45,14 @@ jobs: runs-on: ubuntu-latest steps: - # - name: Debug Info - # run: | - # echo "Event Name: ${{ github.event_name }}" - # echo "Event Action: ${{ github.event.action }}" - # echo "Pull Request Number: ${{ github.event.pull_request.number }}" - # echo "Pull Request State: ${{ github.event.pull_request.state }}" - # echo "Pull Request Merged: ${{ github.event.pull_request.merged }}" - # echo "GitHub Event: ${{ toJson(github.event) }}" - # if: always() - - uses: actions/checkout@v3 - name: Download Frontend Artifacts uses: actions/download-artifact@v2 with: - name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.sha }} + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} path: ${{ env.WORKING_DIR }}/build - # - name: Get PR ID - # id: pr-id - # shell: bash - # env: - # GITHUB_REF: ${{ inputs.github_ref }} - # run: | - # PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') - # echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT - - name: Terraform Plan uses: ./.github/actions/tf-plan with: @@ -82,10 +63,9 @@ jobs: azure_subscription_id: ${{ secrets.ARM_SUBSCRIPTION_ID }} azure_tenant_id: ${{ secrets.ARM_TENANT_ID }} github_token: ${{ secrets.GITHUB_TOKEN }} - # pr_id: ${{ steps.pr-id.outputs.PR_NUMBER }} pr_id: ${{ github.event.pull_request.number }} tf_vars: | { "environment": "${{ env.ENVIRONMENT }}", - "commit_hash": "${{ github.sha }}" + "commit_hash": "${{ github.event.pull_request.number }}" } diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index 46e52d6793..432b0c8178 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -13,6 +13,7 @@ env: TERRAFORM_VERSION: "1.5.7" TF_IN_AUTOMATION: "True" ENVIRONMENT: "dev" + WORKING_DIR: "frontend" jobs: terraform_apply: @@ -21,14 +22,15 @@ jobs: steps: - uses: actions/checkout@v3 - # - name: Get PR ID - # id: pr-id - # shell: bash - # env: - # GITHUB_REF: ${{ inputs.github_ref }} - # run: | - # PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') - # echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_OUTPUT + - name: Load Archived build + id: download-plan + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + workflow: ${{ env.ENVIRONMENT }}_pr.yml + pr: ${{ github.event.pull_request.number }} + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} + path: ${{ env.WORKING_DIR }}/build - name: Terraform Apply uses: ./.github/actions/tf-apply @@ -41,9 +43,4 @@ jobs: azure_tenant_id: ${{ secrets.ARM_TENANT_ID }} github_token: ${{ secrets.GITHUB_TOKEN }} pr_id: ${{ github.event.pull_request.number }} - plan_workflow_file: dev_pr.yml - # tf_vars: | - # { - # "environment": "${{ env.ENVIRONMENT }}", - # "commit_hash": "${{ github.sha }}" - # } + plan_workflow_file: ${{ env.ENVIRONMENT }}_pr.yml From ec898924bf413f0c78d437726f78d535af0350e7 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 08:36:24 -0500 Subject: [PATCH 083/202] Update Dockerfile --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..9a754e6941 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +#Prove it From db337e59541c481724a03e0360773632021d18d3 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 08:43:38 -0500 Subject: [PATCH 084/202] chore: added permissions --- .github/workflows/dev_pr.yml | 2 +- .github/workflows/dev_pr_merge.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index be9621bdff..640396048c 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -38,7 +38,7 @@ jobs: name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} path: ${{ env.WORKING_DIR }}/build - deploy: + plan-deploy: needs: build permissions: pull-requests: write diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_pr_merge.yml index 432b0c8178..c1a1b7fb4a 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_pr_merge.yml @@ -16,7 +16,9 @@ env: WORKING_DIR: "frontend" jobs: - terraform_apply: + apply-deploy: + permissions: + pull-requests: write runs-on: ubuntu-latest if: ${{ github.event.pull_request.merged }} steps: From 61049c3ce1f73eb29e87fbd1a2f50fa9a63d60c2 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 08:45:00 -0500 Subject: [PATCH 085/202] Update Dockerfile --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 9a754e6941..da1ede0d77 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -#Prove it From 9396fb9a7b9086a101b439d5637d4d8de0325b06 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 09:10:02 -0500 Subject: [PATCH 086/202] chore: Changed names --- .github/workflows/dev_deploy.yml | 30 -------------- .../workflows/{dev_pr.yml => dev_fe_pr.yml} | 2 +- .../{dev_pr_merge.yml => dev_fe_pr_merge.yml} | 2 +- .github/workflows/dev_push.yml | 40 ------------------- 4 files changed, 2 insertions(+), 72 deletions(-) delete mode 100644 .github/workflows/dev_deploy.yml rename .github/workflows/{dev_pr.yml => dev_fe_pr.yml} (97%) rename .github/workflows/{dev_pr_merge.yml => dev_fe_pr_merge.yml} (96%) delete mode 100644 .github/workflows/dev_push.yml diff --git a/.github/workflows/dev_deploy.yml b/.github/workflows/dev_deploy.yml deleted file mode 100644 index f0f9eeb791..0000000000 --- a/.github/workflows/dev_deploy.yml +++ /dev/null @@ -1,30 +0,0 @@ -# name: Deployment DEV - -# on: -# # Disable until we have a new cloud environment. -# # workflow_run: -# # workflows: ["Continuous Integration"] -# # types: -# # - completed -# # branches: [main] # extra branch for testing only during dev. -# push: -# branches: [development] -# paths-ignore: -# - '.github/**' # We don't want to trigger a deployment when we update the workflows. -# - 'docs/**' # We don't want to trigger a deployment when we update the docs. -# - '*.md' - -# jobs: - -# deployment: -# permissions: -# contents: read - -# # This uses a reusable_workflow a few special rules apply -# # see ref: https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/reusing-workflows -# name: Deploy to cloud.gov -# uses: ./.github/workflows/deploy_reusable.yml -# with: -# environment: cloud_gov_dev -# space: dev -# secrets: inherit # This will allow the jobs to inherit from the envrionment secrets; which are limited to only deployment items anyway. diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_fe_pr.yml similarity index 97% rename from .github/workflows/dev_pr.yml rename to .github/workflows/dev_fe_pr.yml index 640396048c..10fb557324 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_fe_pr.yml @@ -1,4 +1,4 @@ -name: Development Front End Pull Request +name: [Dev] FrontEnd Pull Request on: pull_request: diff --git a/.github/workflows/dev_pr_merge.yml b/.github/workflows/dev_fe_pr_merge.yml similarity index 96% rename from .github/workflows/dev_pr_merge.yml rename to .github/workflows/dev_fe_pr_merge.yml index c1a1b7fb4a..1033e91f94 100644 --- a/.github/workflows/dev_pr_merge.yml +++ b/.github/workflows/dev_fe_pr_merge.yml @@ -1,4 +1,4 @@ -name: Development Front End Pull Request Merge +name: [Dev] FrontEnd Pull Request Merged on: pull_request: diff --git a/.github/workflows/dev_push.yml b/.github/workflows/dev_push.yml deleted file mode 100644 index f8536540a6..0000000000 --- a/.github/workflows/dev_push.yml +++ /dev/null @@ -1,40 +0,0 @@ -# name: Terraform Apply - -# on: -# pull_request: -# types: -# - closed -# branches: -# - development -# paths: -# - 'frontend/**' - -# jobs: -# terraform_apply: -# runs-on: ubuntu-latest - -# steps: -# - name: Check if push is from a PR -# if: ${{ github.event.pull_request.merged }} -# run: | -# echo " I think this worked ?? " - - -# - name: Get PR ID -# id: pr-id -# shell: bash -# run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV - - -# # - name: Display Terraform Plan -# # if: success() && env.TERRAFORM_ARCHIVE_PATH -# # run: | -# # # Unzip and display the Terraform plan -# # unzip -q $TERRAFORM_ARCHIVE_PATH -d terraform_plan -# # cat terraform_plan/tfplan - -# # - name: Apply Terraform Changes -# # if: success() && !env.TERRAFORM_ARCHIVE_PATH -# # run: | -# # # Apply Terraform changes without a plan -# # terraform apply -auto-approve From 2686ec4127a5632b9b07bc439c1b80a8c8e9ea1b Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 09:11:08 -0500 Subject: [PATCH 087/202] Update index.html --- frontend/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/index.html b/frontend/index.html index 5010e8a46b..be34c0f1a1 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -37,3 +37,4 @@ > + From f567ce0593cf0b04c1622d239cf2b3b87db26ab5 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 09:15:03 -0500 Subject: [PATCH 088/202] chore: fixed name issues --- .github/workflows/dev_fe_pr.yml | 2 +- .github/workflows/dev_fe_pr_merge.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev_fe_pr.yml b/.github/workflows/dev_fe_pr.yml index 10fb557324..ea7c21448c 100644 --- a/.github/workflows/dev_fe_pr.yml +++ b/.github/workflows/dev_fe_pr.yml @@ -1,4 +1,4 @@ -name: [Dev] FrontEnd Pull Request +name: Dev FE Pull Request on: pull_request: diff --git a/.github/workflows/dev_fe_pr_merge.yml b/.github/workflows/dev_fe_pr_merge.yml index 1033e91f94..a5f99b9bbb 100644 --- a/.github/workflows/dev_fe_pr_merge.yml +++ b/.github/workflows/dev_fe_pr_merge.yml @@ -1,4 +1,4 @@ -name: [Dev] FrontEnd Pull Request Merged +name: Dev FE Pull Request Merged on: pull_request: From 679709732f22f61a0afdd85d5c19d251ec222baf Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 09:23:14 -0500 Subject: [PATCH 089/202] chore: more name fixes --- .github/workflows/{dev_fe_pr.yml => dev_frontend_pr.yml} | 0 .../{dev_fe_pr_merge.yml => dev_frontend_pr_merge.yml} | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{dev_fe_pr.yml => dev_frontend_pr.yml} (100%) rename .github/workflows/{dev_fe_pr_merge.yml => dev_frontend_pr_merge.yml} (92%) diff --git a/.github/workflows/dev_fe_pr.yml b/.github/workflows/dev_frontend_pr.yml similarity index 100% rename from .github/workflows/dev_fe_pr.yml rename to .github/workflows/dev_frontend_pr.yml diff --git a/.github/workflows/dev_fe_pr_merge.yml b/.github/workflows/dev_frontend_pr_merge.yml similarity index 92% rename from .github/workflows/dev_fe_pr_merge.yml rename to .github/workflows/dev_frontend_pr_merge.yml index a5f99b9bbb..53ae3a41c5 100644 --- a/.github/workflows/dev_fe_pr_merge.yml +++ b/.github/workflows/dev_frontend_pr_merge.yml @@ -37,7 +37,7 @@ jobs: - name: Terraform Apply uses: ./.github/actions/tf-apply with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_asa" + 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 }} @@ -45,4 +45,4 @@ jobs: azure_tenant_id: ${{ secrets.ARM_TENANT_ID }} github_token: ${{ secrets.GITHUB_TOKEN }} pr_id: ${{ github.event.pull_request.number }} - plan_workflow_file: ${{ env.ENVIRONMENT }}_pr.yml + plan_workflow_file: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml From 98a0eb634db3f5346151cf074c3ca22eb3b1a0c0 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 09:24:14 -0500 Subject: [PATCH 090/202] Update index.html --- frontend/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/index.html b/frontend/index.html index be34c0f1a1..39c6b72cac 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -37,4 +37,4 @@ > - + From 3df71f4815a110b350fa67d9f16fad847041896e Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 09:29:46 -0500 Subject: [PATCH 091/202] chore: more name fixes --- .github/workflows/dev_frontend_pr_merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_frontend_pr_merge.yml b/.github/workflows/dev_frontend_pr_merge.yml index 53ae3a41c5..98fa38d441 100644 --- a/.github/workflows/dev_frontend_pr_merge.yml +++ b/.github/workflows/dev_frontend_pr_merge.yml @@ -29,7 +29,7 @@ jobs: uses: dawidd6/action-download-artifact@v2 with: github_token: ${{ secrets.GITHUB_TOKEN }} - workflow: ${{ env.ENVIRONMENT }}_pr.yml + workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml pr: ${{ github.event.pull_request.number }} name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} path: ${{ env.WORKING_DIR }}/build From 73f059e6714e944c1d2b9c2526d30e0eba96248e Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 09:30:42 -0500 Subject: [PATCH 092/202] Update index.html --- frontend/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/index.html b/frontend/index.html index 39c6b72cac..448a9f731a 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -37,4 +37,4 @@ > - + From ca7160e2ddf7c77f13069c5658e1fc2f7a127049 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 11:20:29 -0500 Subject: [PATCH 093/202] feat: Added backend deploy --- .github/workflows/dev_backend_pr.yml | 68 ++++++++++++++++++++ .github/workflows/dev_backend_pr_merge.yml | 48 +++++++++++++++ terraform/eus/dev/backend_asa/context.tf | 36 +++++++++++ terraform/eus/dev/backend_asa/main.tf | 72 ++++++++++++++++++++++ terraform/eus/dev/backend_asa/providers.tf | 3 + terraform/eus/dev/backend_asa/terraform.tf | 15 +++++ terraform/eus/dev/backend_asa/variables.tf | 61 ++++++++++++++++++ 7 files changed, 303 insertions(+) create mode 100644 .github/workflows/dev_backend_pr.yml create mode 100644 .github/workflows/dev_backend_pr_merge.yml create mode 100644 terraform/eus/dev/backend_asa/context.tf create mode 100644 terraform/eus/dev/backend_asa/main.tf create mode 100644 terraform/eus/dev/backend_asa/providers.tf create mode 100644 terraform/eus/dev/backend_asa/terraform.tf create mode 100644 terraform/eus/dev/backend_asa/variables.tf diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml new file mode 100644 index 0000000000..c01d0eebc4 --- /dev/null +++ b/.github/workflows/dev_backend_pr.yml @@ -0,0 +1,68 @@ +name: Dev BE Pull Request + +on: + pull_request: + branches: + - development + paths: + - backend/models/** + - backend/ops_api/** + - backend/Dockerfile.cg-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: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Build and publish the Docker image for ${{ github.repository }} + uses: macbre/push-to-ghcr@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-deploy: + needs: build + permissions: + pull-requests: write + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + # - name: Download Backend Artifacts + # uses: actions/download-artifact@v2 + # with: + # name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} + # path: ${{ env.WORKING_DIR }}/build + + - 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 }} + } diff --git a/.github/workflows/dev_backend_pr_merge.yml b/.github/workflows/dev_backend_pr_merge.yml new file mode 100644 index 0000000000..ed52a87664 --- /dev/null +++ b/.github/workflows/dev_backend_pr_merge.yml @@ -0,0 +1,48 @@ +name: Dev BE Pull Request Merged + +on: + pull_request: + types: + - closed + branches: + - development + paths: + - 'backend/**' + +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@v3 + + # - name: Load Archived build + # id: download-plan + # uses: dawidd6/action-download-artifact@v2 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # workflow: ${{ env.ENVIRONMENT }}_pr.yml + # pr: ${{ github.event.pull_request.number }} + # name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} + # path: ${{ env.WORKING_DIR }}/build + + - 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 diff --git a/terraform/eus/dev/backend_asa/context.tf b/terraform/eus/dev/backend_asa/context.tf new file mode 100644 index 0000000000..47b26f18a3 --- /dev/null +++ b/terraform/eus/dev/backend_asa/context.tf @@ -0,0 +1,36 @@ +module "ctx" { + source = "../../../global/context" + environment = var.environment + custom_workload = "be4s" +} + +data "azurerm_storage_account" "static_fe" { + name = module.ctx.labels.sfe.resourceNames["azurerm_storage_account"] + resource_group_name = module.ctx.resource_group_name + +} + +data "azurerm_container_app_environment" "aca_env" { + name = module.ctx.labels.core.resourceNames["azurerm_container_app_environment"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_postgresql_flexible_server" "ops_dbs" { + name = module.ctx.labels.db.resourceNames["azurerm_postgresql_flexible_server"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_key_vault" "vault" { + name = module.ctx.labels.core.resourceNames["azurerm_key_vault"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_key_vault_secret" "ops-pw" { + name = "ops-role-password" + key_vault_id = data.azurerm_key_vault.vault.id +} + +data "azurerm_key_vault_secret" "ops-jwt-private-key" { + name = "ops-jwt-private-key" + key_vault_id = data.azurerm_key_vault.vault.id +} \ No newline at end of file diff --git a/terraform/eus/dev/backend_asa/main.tf b/terraform/eus/dev/backend_asa/main.tf new file mode 100644 index 0000000000..026f7e7e4f --- /dev/null +++ b/terraform/eus/dev/backend_asa/main.tf @@ -0,0 +1,72 @@ + + +resource "azurerm_container_app" "backend" { + name = module.ctx.labels.sbe.resourceNames["azurerm_container_app"] + container_app_environment_id = data.azurerm_container_app_environment.aca_env.id + resource_group_name = module.ctx.resource_group_name + revision_mode = "Multiple" + + template { + revision_suffix = substr(var.container_tag, 0, 8) + min_replicas = 1 + container { + name = var.container_name + image = "${var.container_image}:${var.container_tag}" + cpu = var.cpu + memory = var.memory + env { + name = "OPS_CONFIG" + value = "environment/azure/dev.py" + } + env { + name = "PGUSER" + value = "ops" + } + env { + name = "PGPASSWORD" + secret_name = "pgpassword" + } + env { + name = "PGHOST" + value = data.azurerm_postgresql_flexible_server.ops_dbs.fqdn + } + env { + name = "PGPORT" + value = 5432 + } + env { + name = "PGDATABASE" + value = "postgres" + } + env { + name = "JWT_PRIVATE_KEY" + secret_name = "jwt-private-key" + } + env { + name = "OPS_FRONTEND_URL" + value = trimsuffix(data.azurerm_storage_account.static_fe.primary_web_endpoint, "/") + } + } + } + + ingress { + external_enabled = true + target_port = var.port + traffic_weight { + percentage = 100 + latest_revision = true + } + } + secret { + name = "pgpassword" + value = data.azurerm_key_vault_secret.ops-pw.value + } + secret { + name = "jwt-private-key" + value = data.azurerm_key_vault_secret.ops-jwt-private-key.value + } +} + +output "domain" { + value = trimsuffix(data.azurerm_storage_account.static_fe.primary_web_endpoint, "/") +} \ No newline at end of file diff --git a/terraform/eus/dev/backend_asa/providers.tf b/terraform/eus/dev/backend_asa/providers.tf new file mode 100644 index 0000000000..ab91b24812 --- /dev/null +++ b/terraform/eus/dev/backend_asa/providers.tf @@ -0,0 +1,3 @@ +provider "azurerm" { + features {} +} diff --git a/terraform/eus/dev/backend_asa/terraform.tf b/terraform/eus/dev/backend_asa/terraform.tf new file mode 100644 index 0000000000..beb0e7a0ff --- /dev/null +++ b/terraform/eus/dev/backend_asa/terraform.tf @@ -0,0 +1,15 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "3.79.0" + } + } + + backend "azurerm" { + resource_group_name = "opre-ops-dev-eus-tf-rg" + storage_account_name = "opreopsdeveustfst" + container_name = "opre-ops-dev-eus-tf-sc" + key = "ops-be4s-deployment.tfstate" + } +} diff --git a/terraform/eus/dev/backend_asa/variables.tf b/terraform/eus/dev/backend_asa/variables.tf new file mode 100644 index 0000000000..78345f89d3 --- /dev/null +++ b/terraform/eus/dev/backend_asa/variables.tf @@ -0,0 +1,61 @@ +variable "owner" { + description = "Name of the owner of the workload and resources" + type = string + default = "OPRE" +} + +variable "project" { + description = "Project name that resources fall under" + type = string + default = "ops" +} + +variable "environment" { + description = "Environment tag for the resources" + type = string + default = "dev" +} + +variable "location" { + description = "Azure location for the resources" + type = string + default = "eastus" +} + +### Container Details + +variable "container_name" { + description = "Name of the container" + type = string + default = "ops-backend" +} + +variable "container_image" { + description = "Container image" + type = string + default = "ghcr.io/hhs/opre-ops/ops-backend" +} + +variable "container_tag" { + description = "Container image tag" + type = string + default = "764bc3296bcdc1abeac2b230088857a54bf4c84e" +} + +variable "cpu" { + description = "CPU requirements. This has specific ration with memory... (beta)" + type = number + default = 0.25 +} + +variable "memory" { + description = "Memory requirements. This has specific ration with cpu... (beta)" + type = string + default = "0.5Gi" +} + +variable "port" { + description = "Port for application" + type = number + default = 8080 +} \ No newline at end of file From c9ba1c0a7e2466563d5a504fe0825c625d30ab7f Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 11:29:42 -0500 Subject: [PATCH 094/202] chore: added azure env config --- .../ops_api/ops/environment/azure/__inti__.py | 0 backend/ops_api/ops/environment/azure/dev.py | 46 +++++++++++++++++++ backend/ops_api/ops/environment/azure/prod.py | 14 ++++++ .../ops_api/ops/environment/azure/staging.py | 14 ++++++ 4 files changed, 74 insertions(+) create mode 100644 backend/ops_api/ops/environment/azure/__inti__.py create mode 100644 backend/ops_api/ops/environment/azure/dev.py create mode 100644 backend/ops_api/ops/environment/azure/prod.py create mode 100644 backend/ops_api/ops/environment/azure/staging.py diff --git a/backend/ops_api/ops/environment/azure/__inti__.py b/backend/ops_api/ops/environment/azure/__inti__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/backend/ops_api/ops/environment/azure/dev.py b/backend/ops_api/ops/environment/azure/dev.py new file mode 100644 index 0000000000..6881d005ee --- /dev/null +++ b/backend/ops_api/ops/environment/azure/dev.py @@ -0,0 +1,46 @@ +import os + +from ops_api.ops.environment.default_settings import * # noqa: F403, F401 + +DEBUG = True + +# Pull secrets from ACA Environment +db_username = os.getenv("PGUSER") +db_password = os.getenv("PGPASSWORD") +db_host = os.getenv("PGHOST") +db_port = os.getenv("PGPORT") +db_name = os.getenv("PGDATABASE") + +OPS_FRONTEND_URL = os.getenv("OPS_FRONTEND_URL") + +SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" # noqa: B950 + +AUTHLIB_OAUTH_CLIENTS = { + "logingov": { + "server_metadata_url": "https://idp.int.identitysandbox.gov/.well-known/openid-configuration", + "user_info_url": "https://idp.int.identitysandbox.gov/api/openid_connect/userinfo", + "client_id": "urn:gov:gsa:openidconnect.profiles:sp:sso:hhs_acf:opre_ops", + "client_kwargs": {"scope": "openid email"}, + "redirect_uri": "http://localhost:3000", + }, + "hhsams": { + "server_metadata_url": "https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/.well-known/openid-configuration", + "token_endpoint": "https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/token", + "user_info_url": "https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/userinfo", + "client_id": "44fe2c7a-e9c5-43ec-87e9-3de78d2d3a11", + "client_kwargs": {"scope": "openid email"}, + "aud": "https://sso-stage.acf.hhs.gov/auth/realms/ACF-SSO/protocol/openid-connect/token", + "redirect_uri": "http://localhost:3000", + }, + "fakeauth": { + "server_metadata_url": "http://localhost:5000/oidc/.well-known/openid-configuration", + "token_endpoint": "http://localhost:5000/oidc/openid-connect/token", + "user_info_url": "http://localhost:5000/oidc/openid-connect/userinfo", + "client_id": "blah:blah", + "client_kwargs": {"scope": "openid email"}, + "aud": "http://localhost:5000/oidc/openid-connect/token", + "redirect_uri": "http://localhost:3000/login", + }, +} + +JWT_PUBLIC_KEY_PATH = "static/public.pem" diff --git a/backend/ops_api/ops/environment/azure/prod.py b/backend/ops_api/ops/environment/azure/prod.py new file mode 100644 index 0000000000..96954739c8 --- /dev/null +++ b/backend/ops_api/ops/environment/azure/prod.py @@ -0,0 +1,14 @@ +import os + +from ops_api.ops.environment.default_settings import * # noqa: F403, F401 + +DEBUG = False + +# Pull secrets from ACA Environment +db_username = os.getenv("PGUSER") +db_password = os.getenv("PGPASSWORD") +db_host = os.getenv("PGHOST") +db_port = os.getenv("PGPORT") +db_name = os.getenv("PGDATABASE") + +SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" # noqa: B950 diff --git a/backend/ops_api/ops/environment/azure/staging.py b/backend/ops_api/ops/environment/azure/staging.py new file mode 100644 index 0000000000..347ab39e6f --- /dev/null +++ b/backend/ops_api/ops/environment/azure/staging.py @@ -0,0 +1,14 @@ +import os + +from ops_api.ops.environment.default_settings import * # noqa: F403, F401 + +DEBUG = True + +# Pull secrets from ACA Environment +db_username = os.getenv("PGUSER") +db_password = os.getenv("PGPASSWORD") +db_host = os.getenv("PGHOST") +db_port = os.getenv("PGPORT") +db_name = os.getenv("PGDATABASE") + +SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" # noqa: B950 From 60604e962182815103ee39d73648dfcd92b8e71b Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 11:29:54 -0500 Subject: [PATCH 095/202] chore: fixed dockerfile name --- .github/workflows/dev_backend_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index c01d0eebc4..ee63461842 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -7,7 +7,7 @@ on: paths: - backend/models/** - backend/ops_api/** - - backend/Dockerfile.cg-ops-api + - backend/Dockerfile.ops-api env: TERRAFORM_VERSION: "1.5.7" From 46dec29bdc7bda1d9507fa1a69e91dda0839b8c9 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 11:39:25 -0500 Subject: [PATCH 096/202] Update Dockerfile.ops-api --- backend/Dockerfile.ops-api | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index 940c414f35..8b4c73c874 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -22,3 +22,4 @@ ENV FLASK_APP=ops_api.ops ENV FLASK_DEBUG=true CMD ["python", "-m", "gunicorn", "-b", ":8080", "ops_api.ops:create_app()"] +## From 4d3049eb83dfef67dcb321244e787cf594467d12 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 14:39:20 -0500 Subject: [PATCH 097/202] chore: updated paths --- .github/workflows/dev_backend_pr_merge.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev_backend_pr_merge.yml b/.github/workflows/dev_backend_pr_merge.yml index ed52a87664..57e5ab49a6 100644 --- a/.github/workflows/dev_backend_pr_merge.yml +++ b/.github/workflows/dev_backend_pr_merge.yml @@ -7,7 +7,9 @@ on: branches: - development paths: - - 'backend/**' + - backend/models/** + - backend/ops_api/** + - backend/Dockerfile.ops-api env: TERRAFORM_VERSION: "1.5.7" From 880e6c5902f02e540bc3bb8296011e3774e116f9 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 14:42:06 -0500 Subject: [PATCH 098/202] chore: updated paths --- .github/workflows/dev_backend_pr.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index ee63461842..434fe0a35c 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -5,9 +5,8 @@ on: branches: - development paths: - - backend/models/** - - backend/ops_api/** - - backend/Dockerfile.ops-api + - 'backend/**' + env: TERRAFORM_VERSION: "1.5.7" From 6dea474069bfe0958407cba42ddfd3e177ff0300 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 14:45:16 -0500 Subject: [PATCH 099/202] chore: added dispatch --- .github/workflows/dev_backend_pr.yml | 6 ++++-- .github/workflows/dev_backend_pr_merge.yml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index 434fe0a35c..87950538f4 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -1,12 +1,14 @@ name: Dev BE Pull Request on: + workflow_dispatch: pull_request: branches: - development paths: - - 'backend/**' - + - backend/models/** + - backend/ops_api/** + - backend/Dockerfile.ops-api env: TERRAFORM_VERSION: "1.5.7" diff --git a/.github/workflows/dev_backend_pr_merge.yml b/.github/workflows/dev_backend_pr_merge.yml index 57e5ab49a6..197fefa67e 100644 --- a/.github/workflows/dev_backend_pr_merge.yml +++ b/.github/workflows/dev_backend_pr_merge.yml @@ -1,6 +1,7 @@ name: Dev BE Pull Request Merged on: + workflow_dispatch: pull_request: types: - closed From 294d6832e2d6d3be805c044999f6cb6aff6bf30c Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 15:32:33 -0500 Subject: [PATCH 100/202] chore: Maybe indented wrong? --- .github/workflows/dev_backend_pr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index 87950538f4..98b18151dc 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -24,8 +24,7 @@ jobs: packages: write runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - name: Build and publish the Docker image for ${{ github.repository }} uses: macbre/push-to-ghcr@v13 From ef01feaae1be18d416a7853b6f64a159792204c2 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 15:37:55 -0500 Subject: [PATCH 101/202] chore: Updated the context source --- terraform/eus/dev/backend_asa/context.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/eus/dev/backend_asa/context.tf b/terraform/eus/dev/backend_asa/context.tf index 47b26f18a3..f6545ee7d7 100644 --- a/terraform/eus/dev/backend_asa/context.tf +++ b/terraform/eus/dev/backend_asa/context.tf @@ -1,5 +1,5 @@ module "ctx" { - source = "../../../global/context" + source = "git::https://github.com/HHS/OPRE-OPS.git//terraform/global/context?ref=tf-global-context-v0.0.2" environment = var.environment custom_workload = "be4s" } From 1d9582e74e16529df2e00ec497884c19c48151fe Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 16:08:54 -0500 Subject: [PATCH 102/202] chore: fixed json error --- .github/actions/tf-plan/action.yaml | 1 - .github/workflows/dev_backend_pr.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index d8be5c9ccc..10e1931480 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -65,7 +65,6 @@ runs: ARM_SUBSCRIPTION_ID: ${{ inputs.azure_subscription_id }} ARM_TENANT_ID: ${{ inputs.azure_tenant_id }} run: | - echo "TF_COMMIT_HASH: $TF_VAR_commit_hash" terraform init - name: Terraform Plan diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index 98b18151dc..2aaedeb5fa 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -64,5 +64,5 @@ jobs: tf_vars: | { "environment": "${{ env.ENVIRONMENT }}", - "container_tag": ${{ github.sha }} + "container_tag": "${{ github.sha }}" } From ffee0aebd92df3a40f6323d81d9621490041ebc5 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 16:57:08 -0500 Subject: [PATCH 103/202] chrore: Updating output of domain names --- terraform/eus/dev/backend_asa/main.tf | 8 ++++++-- terraform/eus/dev/frontend_asa/context.tf | 6 ++++++ terraform/eus/dev/frontend_asa/main.tf | 4 ++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/terraform/eus/dev/backend_asa/main.tf b/terraform/eus/dev/backend_asa/main.tf index 026f7e7e4f..5ba8bc12ce 100644 --- a/terraform/eus/dev/backend_asa/main.tf +++ b/terraform/eus/dev/backend_asa/main.tf @@ -67,6 +67,10 @@ resource "azurerm_container_app" "backend" { } } -output "domain" { +output "fe_domain" { value = trimsuffix(data.azurerm_storage_account.static_fe.primary_web_endpoint, "/") -} \ No newline at end of file +} + +output "be_domain" { + value = trimsuffix(azurerm_container_app.backend.latest_revision_fqdn, "/") +} diff --git a/terraform/eus/dev/frontend_asa/context.tf b/terraform/eus/dev/frontend_asa/context.tf index 65c1890b96..bd02713f92 100644 --- a/terraform/eus/dev/frontend_asa/context.tf +++ b/terraform/eus/dev/frontend_asa/context.tf @@ -9,3 +9,9 @@ data "azurerm_container_app_environment" "aca_env" { name = module.ctx.labels.core.resourceNames["azurerm_container_app_environment"] resource_group_name = module.ctx.resource_group_name } + +data "azurerm_storage_account" "static_fe" { + name = module.ctx.labels.sfe.resourceNames["azurerm_storage_account"] + resource_group_name = module.ctx.resource_group_name + +} diff --git a/terraform/eus/dev/frontend_asa/main.tf b/terraform/eus/dev/frontend_asa/main.tf index 99cb7c506b..56301db88e 100644 --- a/terraform/eus/dev/frontend_asa/main.tf +++ b/terraform/eus/dev/frontend_asa/main.tf @@ -53,3 +53,7 @@ resource "azurerm_storage_blob" "site" { content_type = local.content_types[lower(regex("\\.[^.]+$", basename(each.value.filename)))] content_md5 = each.value.content_md5 } + +output "domain" { + value = trimsuffix(data.azurerm_storage_account.static_fe.primary_web_endpoint, "/") +} From 69d25e52f684e5ebe36c5d6d8c6cce4afa820eaf Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 16:58:09 -0500 Subject: [PATCH 104/202] Update index.html --- frontend/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/index.html b/frontend/index.html index 448a9f731a..5010e8a46b 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -37,4 +37,3 @@ > - From af7df9c789dcd959b1906d97685c4952f3e019dd Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 16:58:40 -0500 Subject: [PATCH 105/202] Update Dockerfile.ops-api --- backend/Dockerfile.ops-api | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index 8b4c73c874..940c414f35 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -22,4 +22,3 @@ ENV FLASK_APP=ops_api.ops ENV FLASK_DEBUG=true CMD ["python", "-m", "gunicorn", "-b", ":8080", "ops_api.ops:create_app()"] -## From 684b4a48e301d4cfeb2fd0d68e9f39af39866356 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 17:09:59 -0500 Subject: [PATCH 106/202] chore: cleaned up --- .github/workflows/dev_backend_pr.yml | 6 ------ .github/workflows/dev_backend_pr_merge.yml | 10 ---------- 2 files changed, 16 deletions(-) diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index 2aaedeb5fa..2be1c7cd79 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -44,12 +44,6 @@ jobs: steps: - uses: actions/checkout@v3 - # - name: Download Backend Artifacts - # uses: actions/download-artifact@v2 - # with: - # name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} - # path: ${{ env.WORKING_DIR }}/build - - name: Terraform Plan uses: ./.github/actions/tf-plan with: diff --git a/.github/workflows/dev_backend_pr_merge.yml b/.github/workflows/dev_backend_pr_merge.yml index 197fefa67e..ea40f69004 100644 --- a/.github/workflows/dev_backend_pr_merge.yml +++ b/.github/workflows/dev_backend_pr_merge.yml @@ -27,16 +27,6 @@ jobs: steps: - uses: actions/checkout@v3 - # - name: Load Archived build - # id: download-plan - # uses: dawidd6/action-download-artifact@v2 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # workflow: ${{ env.ENVIRONMENT }}_pr.yml - # pr: ${{ github.event.pull_request.number }} - # name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} - # path: ${{ env.WORKING_DIR }}/build - - name: Terraform Apply uses: ./.github/actions/tf-apply with: From 90273e70f611a03fd6c35269999fd7614b4e5939 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Fri, 15 Dec 2023 17:12:56 -0500 Subject: [PATCH 107/202] chore: made plan optional --- .github/actions/tf-apply/action.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index e8d9daa557..097801e3f0 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -53,6 +53,7 @@ runs: - name: Download Plan id: download-plan + if: ${{ inputs.plan_workflow_file != '' }} uses: dawidd6/action-download-artifact@v2 with: github_token: ${{ inputs.github_token }} @@ -61,6 +62,20 @@ runs: name: ${{ inputs.pr_id }}-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<> $GITHUB_OUTPUT + # terraform apply -input=false -no-color tfplan >> $GITHUB_OUTPUT + # echo 'EOF' >> $GITHUB_OUTPUT + - name: Terraform Apply id: apply working-directory: ${{ inputs.terraform_directory }} @@ -72,10 +87,9 @@ runs: ARM_TENANT_ID: ${{ inputs.azure_tenant_id }} run: | echo 'apply<> $GITHUB_OUTPUT - terraform apply -input=false -no-color tfplan >> $GITHUB_OUTPUT + terraform apply -auto-approve -input=false -no-color tfplan >> $GITHUB_OUTPUT echo 'EOF' >> $GITHUB_OUTPUT - - name: Comment Apply id: comment-apply uses: peter-evans/create-or-update-comment@v2 From 726d56027a60ec1abb69c94498c5b4c68a81e63a Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Fri, 15 Dec 2023 17:15:30 -0500 Subject: [PATCH 108/202] Update Dockerfile.ops-api --- backend/Dockerfile.ops-api | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index 940c414f35..de9745bc97 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -22,3 +22,4 @@ ENV FLASK_APP=ops_api.ops ENV FLASK_DEBUG=true CMD ["python", "-m", "gunicorn", "-b", ":8080", "ops_api.ops:create_app()"] +## From d2a32a7e4326efa6062feea37cb7c206e1ba6970 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 09:28:58 -0500 Subject: [PATCH 109/202] chore: Updated to allow var input on apply --- .github/actions/tf-apply/action.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 097801e3f0..88498ab34d 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -26,6 +26,9 @@ inputs: pr_id: description: 'Pull request ID' required: true + 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: true @@ -33,6 +36,22 @@ inputs: runs: using: "composite" steps: + - 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@v2 with: From c19a4e4b481e9be033bef9a1c8001d6001e490ad Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 09:36:38 -0500 Subject: [PATCH 110/202] chore: Moving build to terraform for context --- .../eus/dev/frontend_asa/build_bun/context.tf | 17 ++++++++++++++ .../eus/dev/frontend_asa/build_bun/main.tf | 22 +++++++++++++++++++ .../dev/frontend_asa/build_bun/providers.tf | 3 +++ .../dev/frontend_asa/build_bun/terraform.tf | 15 +++++++++++++ .../dev/frontend_asa/build_bun/variables.tf | 17 ++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 terraform/eus/dev/frontend_asa/build_bun/context.tf create mode 100644 terraform/eus/dev/frontend_asa/build_bun/main.tf create mode 100644 terraform/eus/dev/frontend_asa/build_bun/providers.tf create mode 100644 terraform/eus/dev/frontend_asa/build_bun/terraform.tf create mode 100644 terraform/eus/dev/frontend_asa/build_bun/variables.tf diff --git a/terraform/eus/dev/frontend_asa/build_bun/context.tf b/terraform/eus/dev/frontend_asa/build_bun/context.tf new file mode 100644 index 0000000000..bd02713f92 --- /dev/null +++ b/terraform/eus/dev/frontend_asa/build_bun/context.tf @@ -0,0 +1,17 @@ +module "ctx" { + source = "git::https://github.com/HHS/OPRE-OPS.git//terraform/global/context?ref=tf-global-context-v0.0.2" + environment = var.environment + custom_workload = "be4s" + +} + +data "azurerm_container_app_environment" "aca_env" { + name = module.ctx.labels.core.resourceNames["azurerm_container_app_environment"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_storage_account" "static_fe" { + name = module.ctx.labels.sfe.resourceNames["azurerm_storage_account"] + resource_group_name = module.ctx.resource_group_name + +} diff --git a/terraform/eus/dev/frontend_asa/build_bun/main.tf b/terraform/eus/dev/frontend_asa/build_bun/main.tf new file mode 100644 index 0000000000..0af35cae56 --- /dev/null +++ b/terraform/eus/dev/frontend_asa/build_bun/main.tf @@ -0,0 +1,22 @@ +## Build the react app +resource "null_resource" "build" { + triggers = { + backend_domain = "https://${module.ctx.labels.sbe.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" + commit = var.commit_hash + } + + provisioner "local-exec" { + + working_dir = var.frontend_dir + command = "bun run build" + + environment = { + REACT_APP_BACKEND_DOMAIN = self.triggers.backend_domain + VITE_BACKEND_DOMAIN = self.triggers.backend_domain + } + } +} + +# output "domain" { +# value = trimsuffix(data.azurerm_storage_account.static_fe.primary_web_endpoint, "/") +# } diff --git a/terraform/eus/dev/frontend_asa/build_bun/providers.tf b/terraform/eus/dev/frontend_asa/build_bun/providers.tf new file mode 100644 index 0000000000..ab91b24812 --- /dev/null +++ b/terraform/eus/dev/frontend_asa/build_bun/providers.tf @@ -0,0 +1,3 @@ +provider "azurerm" { + features {} +} diff --git a/terraform/eus/dev/frontend_asa/build_bun/terraform.tf b/terraform/eus/dev/frontend_asa/build_bun/terraform.tf new file mode 100644 index 0000000000..512b23f676 --- /dev/null +++ b/terraform/eus/dev/frontend_asa/build_bun/terraform.tf @@ -0,0 +1,15 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "3.79.0" + } + } + + backend "azurerm" { + resource_group_name = "opre-ops-dev-eus-tf-rg" + storage_account_name = "opreopsdeveustfst" + container_name = "opre-ops-dev-eus-tf-sc" + key = "ops-fe-static-deployment.tfstate" + } +} diff --git a/terraform/eus/dev/frontend_asa/build_bun/variables.tf b/terraform/eus/dev/frontend_asa/build_bun/variables.tf new file mode 100644 index 0000000000..3c34374bb0 --- /dev/null +++ b/terraform/eus/dev/frontend_asa/build_bun/variables.tf @@ -0,0 +1,17 @@ +variable "commit_hash" { + type = string + description = "Git Commit Hash to which this is built to" + default = "hmm" +} + +variable "frontend_dir" { + type = string + description = "Relative path to frontend app directory" + default = "../../../../frontend" +} + +variable "environment" { + description = "Environment tag for the resources" + type = string + default = "dev" +} From f2418f8dd8dd46d16a20fb2257a42303242f3564 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 09:37:07 -0500 Subject: [PATCH 111/202] chore: Updated workflow to use terraform --- .github/workflows/dev_frontend_pr.yml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index ea7c21448c..53eb0ac439 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -28,9 +28,26 @@ jobs: working-directory: ${{ env.WORKING_DIR }} run: bun install - - name: Build Frontend - working-directory: ${{ env.WORKING_DIR }} - run: bun run build + # - name: Build Frontend + # working-directory: ${{ env.WORKING_DIR }} + # run: bun run build + + - name: Terraform Apply + uses: ./.github/actions/tf-apply + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa/build_bun" + 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 }}", + "commit_hash": "${{ github.event.pull_request.number }}" + } - name: Archive Artifacts uses: actions/upload-artifact@v2 @@ -52,7 +69,7 @@ jobs: with: name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} path: ${{ env.WORKING_DIR }}/build - + - name: Terraform Plan uses: ./.github/actions/tf-plan with: From 74a1aa9e9c73074621d1b3cae05639995472696a Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 09:41:14 -0500 Subject: [PATCH 112/202] chore: Removed restraint on planfile --- .github/actions/tf-apply/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 88498ab34d..bb55c27afb 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -31,7 +31,7 @@ inputs: required: false plan_workflow_file: description: 'Filename of workflow containing the tf plan artifact.' - required: true + required: false runs: using: "composite" @@ -51,7 +51,7 @@ runs: shell: bash env: INPUT_TF_VARS: ${{ inputs.tf_vars }} - + - name: Setup Terraform uses: hashicorp/setup-terraform@v2 with: From 89cbb95aee1815ee29d17a5eb03a64a5b0fa72d0 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 09:46:22 -0500 Subject: [PATCH 113/202] chore: Added conditional for the plan --- .github/actions/tf-apply/action.yaml | 7 ++++++- .github/workflows/dev_frontend_pr.yml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index bb55c27afb..a03f6d554a 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -106,9 +106,14 @@ runs: ARM_TENANT_ID: ${{ inputs.azure_tenant_id }} run: | echo 'apply<> $GITHUB_OUTPUT - terraform apply -auto-approve -input=false -no-color tfplan >> $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 uses: peter-evans/create-or-update-comment@v2 diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index 53eb0ac439..318c69f741 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -32,7 +32,7 @@ jobs: # working-directory: ${{ env.WORKING_DIR }} # run: bun run build - - name: Terraform Apply + - name: Build Bun uses: ./.github/actions/tf-apply with: terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa/build_bun" From b4ef6b2d2a97e5723b9dae0dc0be23cafa72f30a Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 10:11:41 -0500 Subject: [PATCH 114/202] chore: Giving it a non-default dir path --- .github/workflows/dev_frontend_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index 318c69f741..b1e6426d41 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -47,6 +47,7 @@ jobs: { "environment": "${{ env.ENVIRONMENT }}", "commit_hash": "${{ github.event.pull_request.number }}" + "frontend_dir": "../../../../../frontend" } - name: Archive Artifacts From dce60d6df9a01bf51b78d4772c98d25db39a596c Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 10:15:21 -0500 Subject: [PATCH 115/202] chore: Forgot ',' --- .github/workflows/dev_frontend_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index b1e6426d41..057d2dc252 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -46,7 +46,7 @@ jobs: tf_vars: | { "environment": "${{ env.ENVIRONMENT }}", - "commit_hash": "${{ github.event.pull_request.number }}" + "commit_hash": "${{ github.event.pull_request.number }}", "frontend_dir": "../../../../../frontend" } From d2f14907b67793916dcc8b48f241fec715fc2cf0 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 10:17:38 -0500 Subject: [PATCH 116/202] chore: Needs permissions --- .github/workflows/dev_frontend_pr.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index 057d2dc252..edf07d8a83 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -15,6 +15,8 @@ env: jobs: build: + permissions: + pull-requests: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 2ffac5ed0ba42e572660be9440369cca837db232 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 10:19:18 -0500 Subject: [PATCH 117/202] chore: Updated state file names --- terraform/eus/dev/frontend_asa/build_bun/terraform.tf | 2 +- terraform/eus/dev/frontend_asa/terraform.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/eus/dev/frontend_asa/build_bun/terraform.tf b/terraform/eus/dev/frontend_asa/build_bun/terraform.tf index 512b23f676..58f1a8b79e 100644 --- a/terraform/eus/dev/frontend_asa/build_bun/terraform.tf +++ b/terraform/eus/dev/frontend_asa/build_bun/terraform.tf @@ -10,6 +10,6 @@ terraform { resource_group_name = "opre-ops-dev-eus-tf-rg" storage_account_name = "opreopsdeveustfst" container_name = "opre-ops-dev-eus-tf-sc" - key = "ops-fe-static-deployment.tfstate" + key = "ops-fe-bun-build-deployment.tfstate" } } diff --git a/terraform/eus/dev/frontend_asa/terraform.tf b/terraform/eus/dev/frontend_asa/terraform.tf index 512b23f676..98e5a0719f 100644 --- a/terraform/eus/dev/frontend_asa/terraform.tf +++ b/terraform/eus/dev/frontend_asa/terraform.tf @@ -10,6 +10,6 @@ terraform { resource_group_name = "opre-ops-dev-eus-tf-rg" storage_account_name = "opreopsdeveustfst" container_name = "opre-ops-dev-eus-tf-sc" - key = "ops-fe-static-deployment.tfstate" + key = "ops-fe-asa-deployment.tfstate" } } From 2a83b4aac658b2e3142aeee70696d6154f2e7a99 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 18 Dec 2023 10:20:26 -0500 Subject: [PATCH 118/202] chore: Test TF Bun Build --- frontend/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index da1ede0d77..668246e0a3 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,3 +10,4 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] +# Comment From 6303a4febfbdd5600c5baae7fa7e50f6e95a6100 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 18 Dec 2023 10:29:36 -0500 Subject: [PATCH 119/202] chore: Pulled latest main for testing. --- frontend/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index ea0162f2b5..13cec8f11c 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -10,4 +10,3 @@ RUN bun install COPY --chown=app:app ./ /home/app/ CMD ["bun", "start"] -# Comment From e466c3ac3b077afe2acebc0cea748ffe9e7de76d Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Mon, 18 Dec 2023 13:05:14 -0500 Subject: [PATCH 120/202] chore: fix gunicorn worker pid --- backend/Dockerfile.ops-api | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index de9745bc97..e94314b57c 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -21,5 +21,5 @@ ENV PYTHONUNBUFFERED=1 ENV FLASK_APP=ops_api.ops ENV FLASK_DEBUG=true -CMD ["python", "-m", "gunicorn", "-b", ":8080", "ops_api.ops:create_app()"] -## +CMD ["python", "-m", "gunicorn", "--timeout", "1000", "--workers", "1", "--threads", "4", "-b", ":8080", "ops_api.ops:create_app()"] +## --timeout 1000 --workers 1 --threads 4 From b862302c4580ae411028471261a475852d13bba5 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:07:30 -0500 Subject: [PATCH 121/202] chore: Created optional PR comment --- .github/actions/tf-apply/action.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index a03f6d554a..ffd993a04c 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -25,7 +25,7 @@ inputs: required: true pr_id: description: 'Pull request ID' - required: true + required: false tf_vars: description: 'A map of variable inputs for Terraform' required: false @@ -116,6 +116,7 @@ runs: - name: Comment Apply id: comment-apply + ${{ inputs.pr_id != '' }} uses: peter-evans/create-or-update-comment@v2 with: token: ${{ inputs.github_token }} From df62714f65b477fb8f8850b9fa8d88910f8efe9a Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:08:16 -0500 Subject: [PATCH 122/202] chore: add tf for data-tools deploy --- terraform/eus/dev/data-tools/context.tf | 24 +++++++++ terraform/eus/dev/data-tools/main.tf | 50 +++++++++++++++++++ terraform/eus/dev/data-tools/providers.tf | 3 ++ .../eus/dev/data-tools/service-connector.tf | 0 terraform/eus/dev/data-tools/terraform.tf | 15 ++++++ terraform/eus/dev/data-tools/variables.tf | 42 ++++++++++++++++ 6 files changed, 134 insertions(+) create mode 100644 terraform/eus/dev/data-tools/context.tf create mode 100644 terraform/eus/dev/data-tools/main.tf create mode 100644 terraform/eus/dev/data-tools/providers.tf create mode 100644 terraform/eus/dev/data-tools/service-connector.tf create mode 100644 terraform/eus/dev/data-tools/terraform.tf create mode 100644 terraform/eus/dev/data-tools/variables.tf diff --git a/terraform/eus/dev/data-tools/context.tf b/terraform/eus/dev/data-tools/context.tf new file mode 100644 index 0000000000..57ff705afd --- /dev/null +++ b/terraform/eus/dev/data-tools/context.tf @@ -0,0 +1,24 @@ +module "ctx" { + source = "../../../global/context" + environment = var.environment +} + +data "azurerm_container_app_environment" "aca_env" { + name = module.ctx.labels.core.resourceNames["azurerm_container_app_environment"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_postgresql_flexible_server" "ops_dbs" { + name = module.ctx.labels.db.resourceNames["azurerm_postgresql_flexible_server"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_key_vault" "vault" { + name = module.ctx.labels.core.resourceNames["azurerm_key_vault"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_key_vault_secret" "ops-pw" { + name = "ops-role-password" + key_vault_id = data.azurerm_key_vault.vault.id +} \ No newline at end of file diff --git a/terraform/eus/dev/data-tools/main.tf b/terraform/eus/dev/data-tools/main.tf new file mode 100644 index 0000000000..300f7bf521 --- /dev/null +++ b/terraform/eus/dev/data-tools/main.tf @@ -0,0 +1,50 @@ +resource "azurerm_container_app" "data-tools" { + name = module.ctx.labels.dt.resourceNames["azurerm_container_app"] + container_app_environment_id = data.azurerm_container_app_environment.aca_env.id + resource_group_name = module.ctx.resource_group_name + revision_mode = "Single" + + template { + revision_suffix = substr(var.container_tag, 0, 8) + + container { + name = var.container_name + image = "${var.container_image}:${var.container_tag}" + cpu = var.cpu + memory = var.memory + env { + name = "ENV" + value = "azure" + } + env { + name = "PGUSER" + value = "ops" // data.azurerm_postgresql_flexible_server.ops_dbs.administrator_login + } + env { + name = "PGPASSWORD" + secret_name = "pgpassword" + } + env { + name = "PGHOST" + value = data.azurerm_postgresql_flexible_server.ops_dbs.fqdn + } + env { + name = "PGPORT" + value = 5432 + } + env { + name = "PGDATABASE" + value = "postgres" //"test-ops-db" + } + command = [ + "bash", + "-c", + "python ./data_tools/src/import_static_data/load_db.py && DATA=./data_tools/data/portfolio_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/funding_partner_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/funding_source_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/research_project_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/can_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/user_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/agreements_and_blin_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/team_leader_data.json5 python ./data_tools/src/import_static_data/import_data.py" + ] + } + } + + secret { + name = "pgpassword" + value = data.azurerm_key_vault_secret.ops-pw.value +} \ No newline at end of file diff --git a/terraform/eus/dev/data-tools/providers.tf b/terraform/eus/dev/data-tools/providers.tf new file mode 100644 index 0000000000..ab91b24812 --- /dev/null +++ b/terraform/eus/dev/data-tools/providers.tf @@ -0,0 +1,3 @@ +provider "azurerm" { + features {} +} diff --git a/terraform/eus/dev/data-tools/service-connector.tf b/terraform/eus/dev/data-tools/service-connector.tf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/terraform/eus/dev/data-tools/terraform.tf b/terraform/eus/dev/data-tools/terraform.tf new file mode 100644 index 0000000000..e3008c8ea3 --- /dev/null +++ b/terraform/eus/dev/data-tools/terraform.tf @@ -0,0 +1,15 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "3.79.0" + } + } + + backend "azurerm" { + resource_group_name = "opre-ops-dev-eus-tf-rg" + storage_account_name = "opreopsdeveustfst" + container_name = "opre-ops-dev-eus-tf-sc" + key = "ops-dt.tfstate" + } +} diff --git a/terraform/eus/dev/data-tools/variables.tf b/terraform/eus/dev/data-tools/variables.tf new file mode 100644 index 0000000000..2dacce5e7c --- /dev/null +++ b/terraform/eus/dev/data-tools/variables.tf @@ -0,0 +1,42 @@ +variable "environment" { + description = "Environment tag for the resources" + type = string + default = "dev" +} + +### Container Details +variable "container_name" { + description = "Name of the container" + type = string + default = "ops-data-tools" +} + +variable "container_image" { + description = "Container image" + type = string + default = "ghcr.io/hhs/opre-ops/ops-data-tools" +} + +variable "container_tag" { + description = "Container image tag" + type = string + default = "53d9d2e1f056cb9eb5e6116a3928d62562077b41" +} + +variable "cpu" { + description = "CPU requirements. This has specific ration with memory... (beta)" + type = number + default = 0.25 +} + +variable "memory" { + description = "Memory requirements. This has specific ration with cpu... (beta)" + type = string + default = "0.5Gi" +} + +variable "port" { + description = "Port for application" + type = number + default = 8080 +} \ No newline at end of file From 59caa515c1c8f3bb0f12875b6a534a65fef15da3 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:08:50 -0500 Subject: [PATCH 123/202] chore: Add config for data-tools --- backend/data_tools/environment/azure.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 backend/data_tools/environment/azure.py diff --git a/backend/data_tools/environment/azure.py b/backend/data_tools/environment/azure.py new file mode 100644 index 0000000000..7424db15d1 --- /dev/null +++ b/backend/data_tools/environment/azure.py @@ -0,0 +1,25 @@ +import os +import urllib.parse + +from data_tools.environment.common import DataToolsConfig + +class AzureConfig(DataToolsConfig): + @property + def db_connection_string(self) -> str: + db_username = os.getenv("PGUSER") + db_password = urllib.parse.quote_plus(os.getenv("PGPASSWORD")) + db_host = os.getenv("PGHOST") + db_port = os.getenv("PGPORT") + db_name = os.getenv("PGDATABASE") + return ( + f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" + # "postgresql://ops:ops@localhost:5432/postgres" # pragma: allowlist secret + ) + + @property + def opre_excel_connection_string(self) -> str: + return "" + + @property + def verbosity(self) -> bool: + return True From 54ffc9222af8308ba694e80d3dc56d018ca85698 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:09:13 -0500 Subject: [PATCH 124/202] chore: add data-tools deploy --- .github/workflows/dev_data_tools_deploy.yml | 59 +++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/dev_data_tools_deploy.yml diff --git a/.github/workflows/dev_data_tools_deploy.yml b/.github/workflows/dev_data_tools_deploy.yml new file mode 100644 index 0000000000..c463704aef --- /dev/null +++ b/.github/workflows/dev_data_tools_deploy.yml @@ -0,0 +1,59 @@ +name: Dev BE Data-tools Deploy + +on: + workflow_dispatch: + # pull_request: + # branches: + # - development + # 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.data-tools" + +jobs: + build: + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Build and publish the Docker image for ${{ github.repository }} + uses: macbre/push-to-ghcr@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-deploy: + needs: build + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Deploy + uses: ./.github/actions/tf-apply + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/data-tools" + 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 }} + tf_vars: | + { + "environment": "${{ env.ENVIRONMENT }}", + "container_tag": "${{ github.sha }}" + } From 9dc0fcbc091b8872ef9f03f87fa58c2f98c7b5b8 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:11:45 -0500 Subject: [PATCH 125/202] chore: kicking off action --- .github/workflows/dev_data_tools_deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/dev_data_tools_deploy.yml b/.github/workflows/dev_data_tools_deploy.yml index c463704aef..1d9f8d0cab 100644 --- a/.github/workflows/dev_data_tools_deploy.yml +++ b/.github/workflows/dev_data_tools_deploy.yml @@ -2,6 +2,9 @@ name: Dev BE Data-tools Deploy on: workflow_dispatch: + push: + branches: + - development # pull_request: # branches: # - development From 9d621274fd97a6515253c492dd82741b84be57c5 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:15:37 -0500 Subject: [PATCH 126/202] chore: fixed typo --- .github/actions/tf-apply/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index ffd993a04c..9aec4a926c 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -116,7 +116,7 @@ runs: - name: Comment Apply id: comment-apply - ${{ inputs.pr_id != '' }} + if: ${{ inputs.pr_id != '' }} uses: peter-evans/create-or-update-comment@v2 with: token: ${{ inputs.github_token }} From 7e620a916d1b04c8233d892f49a23411ab6ac93c Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:16:00 -0500 Subject: [PATCH 127/202] chore: removed push --- .github/workflows/dev_data_tools_deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev_data_tools_deploy.yml b/.github/workflows/dev_data_tools_deploy.yml index 1d9f8d0cab..64a8bfd544 100644 --- a/.github/workflows/dev_data_tools_deploy.yml +++ b/.github/workflows/dev_data_tools_deploy.yml @@ -2,9 +2,9 @@ name: Dev BE Data-tools Deploy on: workflow_dispatch: - push: - branches: - - development + # push: + # branches: + # - development # pull_request: # branches: # - development From 08cc728f8270ee07b03ccf31249e0817ae6c7c3e Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:23:47 -0500 Subject: [PATCH 128/202] chore: a few fixes --- terraform/eus/dev/data-tools/context.tf | 2 +- terraform/eus/dev/data-tools/main.tf | 18 ++++++++++-------- terraform/eus/dev/data-tools/variables.tf | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/terraform/eus/dev/data-tools/context.tf b/terraform/eus/dev/data-tools/context.tf index 57ff705afd..6199fd8ad9 100644 --- a/terraform/eus/dev/data-tools/context.tf +++ b/terraform/eus/dev/data-tools/context.tf @@ -19,6 +19,6 @@ data "azurerm_key_vault" "vault" { } data "azurerm_key_vault_secret" "ops-pw" { - name = "ops-role-password" + name = "ops-role-password" key_vault_id = data.azurerm_key_vault.vault.id } \ No newline at end of file diff --git a/terraform/eus/dev/data-tools/main.tf b/terraform/eus/dev/data-tools/main.tf index 300f7bf521..ca28cf54f8 100644 --- a/terraform/eus/dev/data-tools/main.tf +++ b/terraform/eus/dev/data-tools/main.tf @@ -1,39 +1,40 @@ resource "azurerm_container_app" "data-tools" { name = module.ctx.labels.dt.resourceNames["azurerm_container_app"] container_app_environment_id = data.azurerm_container_app_environment.aca_env.id - resource_group_name = module.ctx.resource_group_name + resource_group_name = module.ctx.resource_group_name revision_mode = "Single" template { revision_suffix = substr(var.container_tag, 0, 8) - + min_replicas = 1 + max_replicas = 1 container { name = var.container_name image = "${var.container_image}:${var.container_tag}" cpu = var.cpu memory = var.memory env { - name = "ENV" + name = "ENV" value = "azure" } env { - name = "PGUSER" + name = "PGUSER" value = "ops" // data.azurerm_postgresql_flexible_server.ops_dbs.administrator_login } env { - name = "PGPASSWORD" + name = "PGPASSWORD" secret_name = "pgpassword" } env { - name = "PGHOST" + name = "PGHOST" value = data.azurerm_postgresql_flexible_server.ops_dbs.fqdn } env { - name = "PGPORT" + name = "PGPORT" value = 5432 } env { - name = "PGDATABASE" + name = "PGDATABASE" value = "postgres" //"test-ops-db" } command = [ @@ -47,4 +48,5 @@ resource "azurerm_container_app" "data-tools" { secret { name = "pgpassword" value = data.azurerm_key_vault_secret.ops-pw.value + } } \ No newline at end of file diff --git a/terraform/eus/dev/data-tools/variables.tf b/terraform/eus/dev/data-tools/variables.tf index 2dacce5e7c..0098e74246 100644 --- a/terraform/eus/dev/data-tools/variables.tf +++ b/terraform/eus/dev/data-tools/variables.tf @@ -20,7 +20,7 @@ variable "container_image" { variable "container_tag" { description = "Container image tag" type = string - default = "53d9d2e1f056cb9eb5e6116a3928d62562077b41" + default = "6c735f7ef57670e69b236dd248952dab8fdab0fa" } variable "cpu" { From 1535f8adc949fa90b1fe33d520384a8d81389cd3 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:31:42 -0500 Subject: [PATCH 129/202] chore: typo --- .github/workflows/dev_backend_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index 2be1c7cd79..87caf80d1f 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -29,7 +29,7 @@ jobs: - name: Build and publish the Docker image for ${{ github.repository }} uses: macbre/push-to-ghcr@v13 with: - image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} # it will be lowercased internally + image_name: ${{ github.repository }}/ops-data-tools # 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 }} From b71875ced74a7abb5a43037657df7cd50f561b20 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 15:37:22 -0500 Subject: [PATCH 130/202] chore: fixed wrong file --- .github/workflows/dev_backend_pr.yml | 2 +- .github/workflows/dev_data_tools_deploy.yml | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index 87caf80d1f..2be1c7cd79 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -29,7 +29,7 @@ jobs: - name: Build and publish the Docker image for ${{ github.repository }} uses: macbre/push-to-ghcr@v13 with: - image_name: ${{ github.repository }}/ops-data-tools # it will be lowercased internally + 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 }} diff --git a/.github/workflows/dev_data_tools_deploy.yml b/.github/workflows/dev_data_tools_deploy.yml index 64a8bfd544..d5430bca3d 100644 --- a/.github/workflows/dev_data_tools_deploy.yml +++ b/.github/workflows/dev_data_tools_deploy.yml @@ -2,16 +2,6 @@ name: Dev BE Data-tools Deploy on: workflow_dispatch: - # push: - # branches: - # - development - # pull_request: - # branches: - # - development - # paths: - # - backend/models/** - # - backend/ops_api/** - # - backend/Dockerfile.ops-api env: TERRAFORM_VERSION: "1.5.7" @@ -32,7 +22,7 @@ jobs: - name: Build and publish the Docker image for ${{ github.repository }} uses: macbre/push-to-ghcr@v13 with: - image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} # it will be lowercased internally + image_name: ${{ github.repository }}/ops-data-tools # 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 }} From 3dbd108ae575a9292913f256cc3ce56ee3e080fa Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 16:01:03 -0500 Subject: [PATCH 131/202] chore: import azure config --- backend/data_tools/src/import_static_data/import_data.py | 3 +++ backend/data_tools/src/import_static_data/load_db.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/backend/data_tools/src/import_static_data/import_data.py b/backend/data_tools/src/import_static_data/import_data.py index 2a0ea4810f..6cd6d755fe 100644 --- a/backend/data_tools/src/import_static_data/import_data.py +++ b/backend/data_tools/src/import_static_data/import_data.py @@ -3,6 +3,7 @@ import json5 import sqlalchemy.engine +from data_tools.environment.azure import AzureConfig from data_tools.environment.cloudgov import CloudGovConfig from data_tools.environment.common import DataToolsConfig from data_tools.environment.dev import DevConfig @@ -86,6 +87,8 @@ def init_db( def get_config(environment_name: Optional[str] = None) -> DataToolsConfig: config: DataToolsConfig match environment_name: + case "azure": + config = AzureConfig() case "cloudgov": config = CloudGovConfig() case "local": diff --git a/backend/data_tools/src/import_static_data/load_db.py b/backend/data_tools/src/import_static_data/load_db.py index 50beef46fb..42b53fe313 100644 --- a/backend/data_tools/src/import_static_data/load_db.py +++ b/backend/data_tools/src/import_static_data/load_db.py @@ -2,6 +2,7 @@ from typing import Optional import sqlalchemy.engine +from data_tools.environment.azure import AzureConfig from data_tools.environment.cloudgov import CloudGovConfig from data_tools.environment.common import DataToolsConfig from data_tools.environment.dev import DevConfig @@ -32,6 +33,8 @@ def init_db( def get_config(environment_name: Optional[str] = None) -> DataToolsConfig: config: DataToolsConfig match environment_name: + case "azure": + config = AzureConfig() case "cloudgov": config = CloudGovConfig() case "local": From 118b2835d37dbac932745377e1340498aafc8af1 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 16:37:35 -0500 Subject: [PATCH 132/202] chore: updated python import command --- terraform/eus/dev/data-tools/main.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/eus/dev/data-tools/main.tf b/terraform/eus/dev/data-tools/main.tf index ca28cf54f8..c8dc5470da 100644 --- a/terraform/eus/dev/data-tools/main.tf +++ b/terraform/eus/dev/data-tools/main.tf @@ -40,7 +40,8 @@ resource "azurerm_container_app" "data-tools" { command = [ "bash", "-c", - "python ./data_tools/src/import_static_data/load_db.py && DATA=./data_tools/data/portfolio_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/funding_partner_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/funding_source_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/research_project_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/can_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/user_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/agreements_and_blin_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/team_leader_data.json5 python ./data_tools/src/import_static_data/import_data.py" + "python ./data_tools/src/import_static_data/load_db.py && DATA=./data_tools/data/user_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/vendor_and_contact_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/portfolio_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/funding_partner_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/funding_source_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/research_project_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/can_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/first_contract_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/agreements_and_blin_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/workflow_data.json5 python ./data_tools/src/import_static_data/import_data.py" + //"python ./data_tools/src/import_static_data/load_db.py && DATA=./data_tools/data/portfolio_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/funding_partner_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/funding_source_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/research_project_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/can_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/user_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/agreements_and_blin_data.json5 python ./data_tools/src/import_static_data/import_data.py && DATA=./data_tools/data/team_leader_data.json5 python ./data_tools/src/import_static_data/import_data.py" ] } } From 5d8ea88890aecd1338d9e33e63b105c720bad5b0 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Mon, 18 Dec 2023 16:47:26 -0500 Subject: [PATCH 133/202] chore: put the min to 0 --- terraform/eus/dev/data-tools/main.tf | 2 +- terraform/eus/dev/data-tools/variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/eus/dev/data-tools/main.tf b/terraform/eus/dev/data-tools/main.tf index c8dc5470da..3232a76e5c 100644 --- a/terraform/eus/dev/data-tools/main.tf +++ b/terraform/eus/dev/data-tools/main.tf @@ -6,7 +6,7 @@ resource "azurerm_container_app" "data-tools" { template { revision_suffix = substr(var.container_tag, 0, 8) - min_replicas = 1 + min_replicas = 0 max_replicas = 1 container { name = var.container_name diff --git a/terraform/eus/dev/data-tools/variables.tf b/terraform/eus/dev/data-tools/variables.tf index 0098e74246..ead416074e 100644 --- a/terraform/eus/dev/data-tools/variables.tf +++ b/terraform/eus/dev/data-tools/variables.tf @@ -20,7 +20,7 @@ variable "container_image" { variable "container_tag" { description = "Container image tag" type = string - default = "6c735f7ef57670e69b236dd248952dab8fdab0fa" + default = "118b2835d37dbac932745377e1340498aafc8af1" } variable "cpu" { From aa366e917d1cfa3f65a68731a871e767ca8acfe7 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 10:22:45 -0500 Subject: [PATCH 134/202] chore: Added runtime-env-config setup --- frontend/.env.example | 1 + frontend/Dockerfile.azure | 41 +++++++++++++++++++++++++++++++++ frontend/index.html | 1 + frontend/index.js | 20 ++++++++++++++++ frontend/src/api/opsAPI.js | 4 +++- frontend/src/helpers/backend.js | 4 +++- frontend/src/helpers/mocks.js | 4 +++- 7 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 frontend/.env.example create mode 100644 frontend/Dockerfile.azure create mode 100644 frontend/index.js diff --git a/frontend/.env.example b/frontend/.env.example new file mode 100644 index 0000000000..9eacdb108e --- /dev/null +++ b/frontend/.env.example @@ -0,0 +1 @@ +REACT_APP_BACKEND_DOMAIN=https://api.ops.com \ No newline at end of file diff --git a/frontend/Dockerfile.azure b/frontend/Dockerfile.azure new file mode 100644 index 0000000000..c857457691 --- /dev/null +++ b/frontend/Dockerfile.azure @@ -0,0 +1,41 @@ +FROM oven/bun:1.0.15 as build + +WORKDIR /home/bun/app + +# Copy only the package files first to leverage Docker cache +COPY package.json bun.lockb ./ + +# Install dependencies +RUN bun install --frozen-lockfile + +# Copy the rest of the application files +COPY . . + +# Build the application +RUN bun run build + +# ---- Release Stage ---- +FROM oven/bun:1 as release + +WORKDIR /home/bun/app + +# Copy built artifacts from the build stage +COPY --from=build /home/bun/app/index.js . +COPY --from=build /home/bun/app/build . +COPY --from=build /home/bun/app/.env.example .env + +# Allow bun user to write runtime-config script to app dir +RUN chown -R bun:bun . + +# Set the user and expose the necessary port +USER bun + +# Install the runtime script cli package +RUN bun install -g runtime-env-cra + +# Expose port +EXPOSE 3000/tcp + +# Entry point to run the application +ENTRYPOINT ["/bin/sh", "-c", "bun run ~/.bun/bin/runtime-env-cra && bun run index.js"] + diff --git a/frontend/index.html b/frontend/index.html index 5010e8a46b..4491c506a1 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -27,6 +27,7 @@ href="/manifest.json" /> OPRE OPS + diff --git a/frontend/index.js b/frontend/index.js new file mode 100644 index 0000000000..d941353860 --- /dev/null +++ b/frontend/index.js @@ -0,0 +1,20 @@ +const BASE_PATH = "./"; + +Bun.serve({ + port: 3000, + async fetch(req) { + const url = new URL(req.url); + let filePath = BASE_PATH + url.pathname; + + // If the request is for "/", serve the "index.html" file + if (url.pathname === "/") { + filePath = BASE_PATH + "/index.html"; + } + + const file = Bun.file(filePath); + return new Response(file); + }, + error() { + return new Response(null, { status: 404 }); + }, +}); diff --git a/frontend/src/api/opsAPI.js b/frontend/src/api/opsAPI.js index fa9e52c1a8..26bd4de5db 100644 --- a/frontend/src/api/opsAPI.js +++ b/frontend/src/api/opsAPI.js @@ -1,7 +1,9 @@ import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react"; import { getAccessToken } from "../components/Auth/auth"; -const BACKEND_DOMAIN = import.meta.env.VITE_BACKEND_DOMAIN; +// const BACKEND_DOMAIN = import.meta.env.VITE_BACKEND_DOMAIN; +// Adding optional runtime config. +const BACKEND_DOMAIN = window.__RUNTIME_CONFIG__?.REACT_APP_BACKEND_DOMAIN || import.meta.env.VITE_BACKEND_DOMAIN; export const opsApi = createApi({ reducerPath: "opsApi", diff --git a/frontend/src/helpers/backend.js b/frontend/src/helpers/backend.js index c67331135d..406f4786fa 100644 --- a/frontend/src/helpers/backend.js +++ b/frontend/src/helpers/backend.js @@ -1,7 +1,9 @@ import axios from "axios"; import { getAccessToken, getRefreshToken } from "../components/Auth/auth"; -const BACKEND_DOMAIN = import.meta.env.VITE_BACKEND_DOMAIN; +// const BACKEND_DOMAIN = import.meta.env.VITE_BACKEND_DOMAIN; +// Adding optional runtime config. +const BACKEND_DOMAIN = window.__RUNTIME_CONFIG__?.REACT_APP_BACKEND_DOMAIN || import.meta.env.VITE_BACKEND_DOMAIN; export const callBackend = async (urlPath, action, requestBody, queryParams, useRefresh = false) => { console.debug( diff --git a/frontend/src/helpers/mocks.js b/frontend/src/helpers/mocks.js index e36c2ece65..29ce19306d 100644 --- a/frontend/src/helpers/mocks.js +++ b/frontend/src/helpers/mocks.js @@ -1,7 +1,9 @@ import { rest } from "msw"; import { setupServer } from "msw/node"; -const BACKEND_DOMAIN = import.meta.env.VITE_BACKEND_DOMAIN; +// const BACKEND_DOMAIN = import.meta.env.VITE_BACKEND_DOMAIN; +// Adding optional runtime config. +const BACKEND_DOMAIN = window.__RUNTIME_CONFIG__?.REACT_APP_BACKEND_DOMAIN || import.meta.env.VITE_BACKEND_DOMAIN; export const handlers = [ rest.get(`${BACKEND_DOMAIN}/api/v1/agreements/`, (req, res, ctx) => { From 0df9337f0a756cfa21c1ca0f1896a36419488cd8 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 12:19:32 -0500 Subject: [PATCH 135/202] chore: Changed to alpine image --- frontend/Dockerfile.azure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/Dockerfile.azure b/frontend/Dockerfile.azure index c857457691..75c34a88f1 100644 --- a/frontend/Dockerfile.azure +++ b/frontend/Dockerfile.azure @@ -1,4 +1,4 @@ -FROM oven/bun:1.0.15 as build +FROM oven/bun:1.0.15-alpine as build WORKDIR /home/bun/app @@ -15,7 +15,7 @@ COPY . . RUN bun run build # ---- Release Stage ---- -FROM oven/bun:1 as release +FROM oven/bun:1-alpine as release WORKDIR /home/bun/app From e3697627b41b6fbb80da4415565bf88aa645c4fe Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 12:39:23 -0500 Subject: [PATCH 136/202] chore: set workflows for deployments --- .github/workflows/dev_backend_asa_pr.yml | 62 +++++++++++++ .../workflows/dev_backend_asa_pr_merge.yml | 41 +++++++++ .github/workflows/dev_backend_pr.yml | 2 +- .github/workflows/dev_backend_pr_merge.yml | 2 +- .github/workflows/dev_frontend_asa_pr.yml | 91 +++++++++++++++++++ .../workflows/dev_frontend_asa_pr_merge.yml | 48 ++++++++++ .github/workflows/dev_frontend_pr.yml | 48 +++------- .github/workflows/dev_frontend_pr_merge.yml | 12 +-- 8 files changed, 256 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/dev_backend_asa_pr.yml create mode 100644 .github/workflows/dev_backend_asa_pr_merge.yml create mode 100644 .github/workflows/dev_frontend_asa_pr.yml create mode 100644 .github/workflows/dev_frontend_asa_pr_merge.yml diff --git a/.github/workflows/dev_backend_asa_pr.yml b/.github/workflows/dev_backend_asa_pr.yml new file mode 100644 index 0000000000..4016ccf1e4 --- /dev/null +++ b/.github/workflows/dev_backend_asa_pr.yml @@ -0,0 +1,62 @@ +name: Dev BE ASA Pull Request + +on: + workflow_dispatch: + pull_request: + branches: + - development + 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@v2 + + - name: Build and publish the Docker image for ${{ github.repository }} + uses: macbre/push-to-ghcr@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-deploy: + needs: build + permissions: + pull-requests: write + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - 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 }}" + } diff --git a/.github/workflows/dev_backend_asa_pr_merge.yml b/.github/workflows/dev_backend_asa_pr_merge.yml new file mode 100644 index 0000000000..636f4baf99 --- /dev/null +++ b/.github/workflows/dev_backend_asa_pr_merge.yml @@ -0,0 +1,41 @@ +name: Dev BE ASA Pull Request Merged + +on: + workflow_dispatch: + pull_request: + types: + - closed + branches: + - development + 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@v3 + + - 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 diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index 2be1c7cd79..7ad2ea1a1f 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -47,7 +47,7 @@ jobs: - name: Terraform Plan uses: ./.github/actions/tf-plan with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa" + 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 }} diff --git a/.github/workflows/dev_backend_pr_merge.yml b/.github/workflows/dev_backend_pr_merge.yml index ea40f69004..a51f1a9c5c 100644 --- a/.github/workflows/dev_backend_pr_merge.yml +++ b/.github/workflows/dev_backend_pr_merge.yml @@ -30,7 +30,7 @@ jobs: - name: Terraform Apply uses: ./.github/actions/tf-apply with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa" + 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 }} diff --git a/.github/workflows/dev_frontend_asa_pr.yml b/.github/workflows/dev_frontend_asa_pr.yml new file mode 100644 index 0000000000..18529f565d --- /dev/null +++ b/.github/workflows/dev_frontend_asa_pr.yml @@ -0,0 +1,91 @@ +name: Dev FE ASA Pull Request + +on: + pull_request: + branches: + - development + paths: + - 'frontend/**' + +env: + TERRAFORM_VERSION: "1.5.7" + TF_IN_AUTOMATION: "True" + ENVIRONMENT: "dev" + WORKING_DIR: "frontend" + +jobs: + build: + permissions: + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install dependencies + working-directory: ${{ env.WORKING_DIR }} + run: bun install + + # - name: Build Frontend + # working-directory: ${{ env.WORKING_DIR }} + # run: bun run build + + - name: Build Bun + uses: ./.github/actions/tf-apply + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa/build_bun" + 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 }}", + "commit_hash": "${{ github.event.pull_request.number }}", + "frontend_dir": "../../../../../frontend" + } + + - name: Archive Artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} + path: ${{ env.WORKING_DIR }}/build + + plan-deploy: + needs: build + permissions: + pull-requests: write + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Download Frontend Artifacts + uses: actions/download-artifact@v2 + with: + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} + path: ${{ env.WORKING_DIR }}/build + + - name: Terraform Plan + uses: ./.github/actions/tf-plan + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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 }}", + "commit_hash": "${{ github.event.pull_request.number }}" + } diff --git a/.github/workflows/dev_frontend_asa_pr_merge.yml b/.github/workflows/dev_frontend_asa_pr_merge.yml new file mode 100644 index 0000000000..3daf3d6eb9 --- /dev/null +++ b/.github/workflows/dev_frontend_asa_pr_merge.yml @@ -0,0 +1,48 @@ +name: Dev FE ASA Pull Request Merged + +on: + pull_request: + types: + - closed + branches: + - development + paths: + - 'frontend/**' + +env: + TERRAFORM_VERSION: "1.5.7" + TF_IN_AUTOMATION: "True" + ENVIRONMENT: "dev" + WORKING_DIR: "frontend" + +jobs: + apply-deploy: + permissions: + pull-requests: write + runs-on: ubuntu-latest + if: ${{ github.event.pull_request.merged }} + steps: + - uses: actions/checkout@v3 + + - name: Load Archived build + id: download-plan + uses: dawidd6/action-download-artifact@v2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml + pr: ${{ github.event.pull_request.number }} + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} + path: ${{ env.WORKING_DIR }}/build + + - 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 diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index edf07d8a83..617d061b7d 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -12,51 +12,25 @@ env: TF_IN_AUTOMATION: "True" ENVIRONMENT: "dev" WORKING_DIR: "frontend" + DOCKER_FILE: "Dockerfile.azure" jobs: build: permissions: - pull-requests: write + contents: read + packages: write runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - - name: Setup Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: latest - - - name: Install dependencies - working-directory: ${{ env.WORKING_DIR }} - run: bun install - - # - name: Build Frontend - # working-directory: ${{ env.WORKING_DIR }} - # run: bun run build - - name: Build Bun - uses: ./.github/actions/tf-apply + - name: Build and publish the Docker image for ${{ github.repository }} + uses: macbre/push-to-ghcr@v13 with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa/build_bun" - 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 }} + image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} # it will be lowercased internally github_token: ${{ secrets.GITHUB_TOKEN }} - pr_id: ${{ github.event.pull_request.number }} - tf_vars: | - { - "environment": "${{ env.ENVIRONMENT }}", - "commit_hash": "${{ github.event.pull_request.number }}", - "frontend_dir": "../../../../../frontend" - } - - - name: Archive Artifacts - uses: actions/upload-artifact@v2 - with: - name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} - path: ${{ env.WORKING_DIR }}/build + context: ${{ github.workspace }}/${{ env.WORKING_DIR }} + dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DOCKER_FILE }} + image_tag: ${{ github.sha }} plan-deploy: needs: build @@ -76,7 +50,7 @@ jobs: - name: Terraform Plan uses: ./.github/actions/tf-plan with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_asa" + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend" terraform_version: ${{ env.TERRAFORM_VERSION }} azure_client_id: ${{ secrets.ARM_CLIENT_ID }} azure_client_secret: ${{ secrets.ARM_CLIENT_SECRET }} @@ -87,5 +61,5 @@ jobs: tf_vars: | { "environment": "${{ env.ENVIRONMENT }}", - "commit_hash": "${{ github.event.pull_request.number }}" + "container_tag": "${{ github.sha }}" } diff --git a/.github/workflows/dev_frontend_pr_merge.yml b/.github/workflows/dev_frontend_pr_merge.yml index 98fa38d441..5b21679f31 100644 --- a/.github/workflows/dev_frontend_pr_merge.yml +++ b/.github/workflows/dev_frontend_pr_merge.yml @@ -24,20 +24,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Load Archived build - id: download-plan - uses: dawidd6/action-download-artifact@v2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml - pr: ${{ github.event.pull_request.number }} - name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} - path: ${{ env.WORKING_DIR }}/build - - name: Terraform Apply uses: ./.github/actions/tf-apply with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa" + 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 }} From af0bd2cd756855a62593ab69be56b7e4f37d67fc Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 12:39:55 -0500 Subject: [PATCH 137/202] chore: Updated output --- terraform/eus/dev/backend_asa/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/eus/dev/backend_asa/main.tf b/terraform/eus/dev/backend_asa/main.tf index 5ba8bc12ce..90fdacfe86 100644 --- a/terraform/eus/dev/backend_asa/main.tf +++ b/terraform/eus/dev/backend_asa/main.tf @@ -72,5 +72,5 @@ output "fe_domain" { } output "be_domain" { - value = trimsuffix(azurerm_container_app.backend.latest_revision_fqdn, "/") + value = "https://${module.ctx.labels.be.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" } From 4376bd0a762ae3518ae1fc4947450fc40225772d Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 12:40:23 -0500 Subject: [PATCH 138/202] chore: Added container only deployments --- terraform/eus/dev/backend/context.tf | 29 ++++++++++ terraform/eus/dev/backend/main.tf | 77 +++++++++++++++++++++++++ terraform/eus/dev/backend/providers.tf | 3 + terraform/eus/dev/backend/terraform.tf | 15 +++++ terraform/eus/dev/backend/variables.tf | 61 ++++++++++++++++++++ terraform/eus/dev/frontend/context.tf | 9 +++ terraform/eus/dev/frontend/main.tf | 31 ++++++++++ terraform/eus/dev/frontend/providers.tf | 3 + terraform/eus/dev/frontend/terraform.tf | 15 +++++ terraform/eus/dev/frontend/variables.tf | 61 ++++++++++++++++++++ 10 files changed, 304 insertions(+) create mode 100644 terraform/eus/dev/backend/context.tf create mode 100644 terraform/eus/dev/backend/main.tf create mode 100644 terraform/eus/dev/backend/providers.tf create mode 100644 terraform/eus/dev/backend/terraform.tf create mode 100644 terraform/eus/dev/backend/variables.tf create mode 100644 terraform/eus/dev/frontend/context.tf create mode 100644 terraform/eus/dev/frontend/main.tf create mode 100644 terraform/eus/dev/frontend/providers.tf create mode 100644 terraform/eus/dev/frontend/terraform.tf create mode 100644 terraform/eus/dev/frontend/variables.tf diff --git a/terraform/eus/dev/backend/context.tf b/terraform/eus/dev/backend/context.tf new file mode 100644 index 0000000000..dceca45654 --- /dev/null +++ b/terraform/eus/dev/backend/context.tf @@ -0,0 +1,29 @@ +module "ctx" { + source = "../../../global/context" + environment = var.environment +} + +data "azurerm_container_app_environment" "aca_env" { + name = module.ctx.labels.core.resourceNames["azurerm_container_app_environment"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_postgresql_flexible_server" "ops_dbs" { + name = module.ctx.labels.db.resourceNames["azurerm_postgresql_flexible_server"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_key_vault" "vault" { + name = module.ctx.labels.core.resourceNames["azurerm_key_vault"] + resource_group_name = module.ctx.resource_group_name +} + +data "azurerm_key_vault_secret" "ops-pw" { + name = "ops-role-password" + key_vault_id = data.azurerm_key_vault.vault.id +} + +data "azurerm_key_vault_secret" "ops-jwt-private-key" { + name = "ops-jwt-private-key" + key_vault_id = data.azurerm_key_vault.vault.id +} \ No newline at end of file diff --git a/terraform/eus/dev/backend/main.tf b/terraform/eus/dev/backend/main.tf new file mode 100644 index 0000000000..f8de0ff757 --- /dev/null +++ b/terraform/eus/dev/backend/main.tf @@ -0,0 +1,77 @@ + + +resource "azurerm_container_app" "backend" { + name = module.ctx.labels.be.resourceNames["azurerm_container_app"] + container_app_environment_id = data.azurerm_container_app_environment.aca_env.id + resource_group_name = module.ctx.resource_group_name + revision_mode = "Multiple" + + template { + revision_suffix = substr(var.container_tag, 0, 8) + min_replicas = 1 + container { + name = var.container_name + image = "${var.container_image}:${var.container_tag}" + cpu = var.cpu + memory = var.memory + env { + name = "OPS_CONFIG" + value = "environment/azure/dev.py" + } + env { + name = "PGUSER" + value = "ops" + } + env { + name = "PGPASSWORD" + secret_name = "pgpassword" + } + env { + name = "PGHOST" + value = data.azurerm_postgresql_flexible_server.ops_dbs.fqdn + } + env { + name = "PGPORT" + value = 5432 + } + env { + name = "PGDATABASE" + value = "postgres" + } + env { + name = "JWT_PRIVATE_KEY" + secret_name = "jwt-private-key" + } + env { + name = "OPS_FRONTEND_URL" + value = "https://${module.ctx.labels.fe.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" + } + } + } + + ingress { + external_enabled = true + target_port = var.port + traffic_weight { + percentage = 100 + latest_revision = true + } + } + secret { + name = "pgpassword" + value = data.azurerm_key_vault_secret.ops-pw.value + } + secret { + name = "jwt-private-key" + value = data.azurerm_key_vault_secret.ops-jwt-private-key.value + } +} + +output "fe_domain" { + value = "https://${module.ctx.labels.fe.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" +} + +output "be_domain" { + value = "https://${module.ctx.labels.be.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" +} + diff --git a/terraform/eus/dev/backend/providers.tf b/terraform/eus/dev/backend/providers.tf new file mode 100644 index 0000000000..ab91b24812 --- /dev/null +++ b/terraform/eus/dev/backend/providers.tf @@ -0,0 +1,3 @@ +provider "azurerm" { + features {} +} diff --git a/terraform/eus/dev/backend/terraform.tf b/terraform/eus/dev/backend/terraform.tf new file mode 100644 index 0000000000..b69390f6e4 --- /dev/null +++ b/terraform/eus/dev/backend/terraform.tf @@ -0,0 +1,15 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "3.79.0" + } + } + + backend "azurerm" { + resource_group_name = "opre-ops-dev-eus-tf-rg" + storage_account_name = "opreopsdeveustfst" + container_name = "opre-ops-dev-eus-tf-sc" + key = "ops-be-deployment.tfstate" + } +} diff --git a/terraform/eus/dev/backend/variables.tf b/terraform/eus/dev/backend/variables.tf new file mode 100644 index 0000000000..78345f89d3 --- /dev/null +++ b/terraform/eus/dev/backend/variables.tf @@ -0,0 +1,61 @@ +variable "owner" { + description = "Name of the owner of the workload and resources" + type = string + default = "OPRE" +} + +variable "project" { + description = "Project name that resources fall under" + type = string + default = "ops" +} + +variable "environment" { + description = "Environment tag for the resources" + type = string + default = "dev" +} + +variable "location" { + description = "Azure location for the resources" + type = string + default = "eastus" +} + +### Container Details + +variable "container_name" { + description = "Name of the container" + type = string + default = "ops-backend" +} + +variable "container_image" { + description = "Container image" + type = string + default = "ghcr.io/hhs/opre-ops/ops-backend" +} + +variable "container_tag" { + description = "Container image tag" + type = string + default = "764bc3296bcdc1abeac2b230088857a54bf4c84e" +} + +variable "cpu" { + description = "CPU requirements. This has specific ration with memory... (beta)" + type = number + default = 0.25 +} + +variable "memory" { + description = "Memory requirements. This has specific ration with cpu... (beta)" + type = string + default = "0.5Gi" +} + +variable "port" { + description = "Port for application" + type = number + default = 8080 +} \ No newline at end of file diff --git a/terraform/eus/dev/frontend/context.tf b/terraform/eus/dev/frontend/context.tf new file mode 100644 index 0000000000..ad9a89e2a8 --- /dev/null +++ b/terraform/eus/dev/frontend/context.tf @@ -0,0 +1,9 @@ +module "ctx" { + source = "../../../global/context" + environment = var.environment +} + +data "azurerm_container_app_environment" "aca_env" { + name = module.ctx.labels.core.resourceNames["azurerm_container_app_environment"] + resource_group_name = module.ctx.resource_group_name +} diff --git a/terraform/eus/dev/frontend/main.tf b/terraform/eus/dev/frontend/main.tf new file mode 100644 index 0000000000..c0b00299bd --- /dev/null +++ b/terraform/eus/dev/frontend/main.tf @@ -0,0 +1,31 @@ +resource "azurerm_container_app" "frontend" { + name = module.ctx.labels.fe.resourceNames["azurerm_container_app"] + container_app_environment_id = data.azurerm_container_app_environment.aca_env.id + resource_group_name = module.ctx.resource_group_name + revision_mode = "Multiple" + + template { + revision_suffix = substr(var.container_tag, 0, 8) + min_replicas = 1 + container { + name = var.container_name + image = "${var.container_image}:${var.container_tag}" + cpu = var.cpu + memory = var.memory + + env { + name = "REACT_APP_BACKEND_DOMAIN" + value = "https://${module.ctx.labels.be.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" + } + } + } + + ingress { + external_enabled = true + target_port = var.port + traffic_weight { + percentage = 100 + latest_revision = true + } + } +} diff --git a/terraform/eus/dev/frontend/providers.tf b/terraform/eus/dev/frontend/providers.tf new file mode 100644 index 0000000000..ab91b24812 --- /dev/null +++ b/terraform/eus/dev/frontend/providers.tf @@ -0,0 +1,3 @@ +provider "azurerm" { + features {} +} diff --git a/terraform/eus/dev/frontend/terraform.tf b/terraform/eus/dev/frontend/terraform.tf new file mode 100644 index 0000000000..b6b7f45e2b --- /dev/null +++ b/terraform/eus/dev/frontend/terraform.tf @@ -0,0 +1,15 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "3.79.0" + } + } + + backend "azurerm" { + resource_group_name = "opre-ops-dev-eus-tf-rg" + storage_account_name = "opreopsdeveustfst" + container_name = "opre-ops-dev-eus-tf-sc" + key = "ops-fe-deployment.tfstate" + } +} diff --git a/terraform/eus/dev/frontend/variables.tf b/terraform/eus/dev/frontend/variables.tf new file mode 100644 index 0000000000..66fb24f540 --- /dev/null +++ b/terraform/eus/dev/frontend/variables.tf @@ -0,0 +1,61 @@ +variable "owner" { + description = "Name of the owner of the workload and resources" + type = string + default = "OPRE" +} + +variable "project" { + description = "Project name that resources fall under" + type = string + default = "ops" +} + +variable "environment" { + description = "Environment tag for the resources" + type = string + default = "dev" +} + +variable "location" { + description = "Azure location for the resources" + type = string + default = "eastus" +} + +### Container Details + +variable "container_name" { + description = "Name of the container" + type = string + default = "ops-frontend" +} + +variable "container_image" { + description = "Container image" + type = string + default = "ghcr.io/hhs/opre-ops/ops-frontend" +} + +variable "container_tag" { + description = "Container image tag" + type = string + default = "a6c6948ff0cc6ac68d9aba32059b14e61e924640" +} + +variable "cpu" { + description = "CPU requirements. This has specific ration with memory... (beta)" + type = number + default = 0.25 +} + +variable "memory" { + description = "Memory requirements. This has specific ration with cpu... (beta)" + type = string + default = "0.5Gi" +} + +variable "port" { + description = "Port for application" + type = number + default = 80 +} \ No newline at end of file From 069e7ab592ffa1ab2208206c5d6b8bfbfebd33d4 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Wed, 20 Dec 2023 12:43:51 -0500 Subject: [PATCH 139/202] chore: Added comment --- backend/Dockerfile.ops-api | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index e94314b57c..532c220b12 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -21,5 +21,6 @@ ENV PYTHONUNBUFFERED=1 ENV FLASK_APP=ops_api.ops ENV FLASK_DEBUG=true +## This is to attempt fixing the worker issues CMD ["python", "-m", "gunicorn", "--timeout", "1000", "--workers", "1", "--threads", "4", "-b", ":8080", "ops_api.ops:create_app()"] ## --timeout 1000 --workers 1 --threads 4 From 264fa8436db0bc3796333f16ff3b1487cab6140c Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 12:58:41 -0500 Subject: [PATCH 140/202] chore: Minor Fixes --- .github/actions/tf-apply/action.yaml | 2 +- .github/actions/tf-plan/action.yaml | 2 +- .github/workflows/dev_backend_asa_pr_merge.yml | 2 +- .github/workflows/dev_frontend_asa_pr_merge.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 9aec4a926c..c6066ac42a 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -122,7 +122,7 @@ runs: token: ${{ inputs.github_token }} issue-number: ${{ inputs.pr_id }} body: | - Terraform Apply: + Terraform Apply for for ${{ inputs.terraform_directory }}: ``` ${{ steps.apply.outputs.apply }} diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index 10e1931480..f576ed67ea 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -95,7 +95,7 @@ runs: token: ${{ inputs.github_token }} issue-number: ${{ inputs.pr_id }} body: | - Terraform Plan: + Terraform Plan for ${{ inputs.terraform_directory }}: ``` ${{ steps.plan.outputs.plan }} diff --git a/.github/workflows/dev_backend_asa_pr_merge.yml b/.github/workflows/dev_backend_asa_pr_merge.yml index 636f4baf99..7290387bda 100644 --- a/.github/workflows/dev_backend_asa_pr_merge.yml +++ b/.github/workflows/dev_backend_asa_pr_merge.yml @@ -38,4 +38,4 @@ jobs: 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 + plan_workflow_file: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_asa_pr.yml diff --git a/.github/workflows/dev_frontend_asa_pr_merge.yml b/.github/workflows/dev_frontend_asa_pr_merge.yml index 3daf3d6eb9..bccfd659f9 100644 --- a/.github/workflows/dev_frontend_asa_pr_merge.yml +++ b/.github/workflows/dev_frontend_asa_pr_merge.yml @@ -45,4 +45,4 @@ jobs: 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 + plan_workflow_file: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_asa_pr.yml From 52b9f7547eb5b8c950abf95018a469ac36cc4fe9 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Wed, 20 Dec 2023 13:00:05 -0500 Subject: [PATCH 141/202] Update Dockerfile.ops-api --- backend/Dockerfile.ops-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index 532c220b12..bb59e730d7 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -21,6 +21,6 @@ ENV PYTHONUNBUFFERED=1 ENV FLASK_APP=ops_api.ops ENV FLASK_DEBUG=true -## This is to attempt fixing the worker issues +## This is to attempt fixing the worker issues -- CMD ["python", "-m", "gunicorn", "--timeout", "1000", "--workers", "1", "--threads", "4", "-b", ":8080", "ops_api.ops:create_app()"] ## --timeout 1000 --workers 1 --threads 4 From 4a07c379d0d46593b0a4b9e21c7ef27e4919e771 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Wed, 20 Dec 2023 13:06:55 -0500 Subject: [PATCH 142/202] Update Dockerfile.azure --- frontend/Dockerfile.azure | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/Dockerfile.azure b/frontend/Dockerfile.azure index 75c34a88f1..7e2fb0beda 100644 --- a/frontend/Dockerfile.azure +++ b/frontend/Dockerfile.azure @@ -1,3 +1,4 @@ +# ---- Build Stage ---- FROM oven/bun:1.0.15-alpine as build WORKDIR /home/bun/app From ab121b05c1dcc9ebb64a1e1c2f0dbdc511d84e2d Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 13:10:51 -0500 Subject: [PATCH 143/202] chore: no artifacts to download --- .github/workflows/dev_frontend_pr.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index 617d061b7d..159b4fce95 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -40,12 +40,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - - name: Download Frontend Artifacts - uses: actions/download-artifact@v2 - with: - name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} - path: ${{ env.WORKING_DIR }}/build - name: Terraform Plan uses: ./.github/actions/tf-plan From 4163d5dedaf1695327b8263ba7f9f502abe21c15 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 13:20:06 -0500 Subject: [PATCH 144/202] chore: Always trigger build --- terraform/eus/dev/frontend_asa/build_bun/main.tf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/terraform/eus/dev/frontend_asa/build_bun/main.tf b/terraform/eus/dev/frontend_asa/build_bun/main.tf index 0af35cae56..daf71ebb30 100644 --- a/terraform/eus/dev/frontend_asa/build_bun/main.tf +++ b/terraform/eus/dev/frontend_asa/build_bun/main.tf @@ -3,6 +3,7 @@ resource "null_resource" "build" { triggers = { backend_domain = "https://${module.ctx.labels.sbe.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" commit = var.commit_hash + always_build = timestamp() } provisioner "local-exec" { @@ -16,7 +17,3 @@ resource "null_resource" "build" { } } } - -# output "domain" { -# value = trimsuffix(data.azurerm_storage_account.static_fe.primary_web_endpoint, "/") -# } From 999db4aee46d9a876b44e6c763efeafe0c80f633 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 13:27:21 -0500 Subject: [PATCH 145/202] chore: Output FE Domain --- terraform/eus/dev/frontend/main.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terraform/eus/dev/frontend/main.tf b/terraform/eus/dev/frontend/main.tf index c0b00299bd..5f2fb80bb9 100644 --- a/terraform/eus/dev/frontend/main.tf +++ b/terraform/eus/dev/frontend/main.tf @@ -29,3 +29,7 @@ resource "azurerm_container_app" "frontend" { } } } + +output "domain" { + value = "https://${module.ctx.labels.fe.resourceNames["azurerm_container_app"]}.${data.azurerm_container_app_environment.aca_env.default_domain}" +} \ No newline at end of file From 570821b86d78c4bcc936723dc365026178dd3c98 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 13:29:35 -0500 Subject: [PATCH 146/202] chore: fixed typo --- .github/workflows/dev_frontend_asa_pr_merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_frontend_asa_pr_merge.yml b/.github/workflows/dev_frontend_asa_pr_merge.yml index bccfd659f9..f098b4a05a 100644 --- a/.github/workflows/dev_frontend_asa_pr_merge.yml +++ b/.github/workflows/dev_frontend_asa_pr_merge.yml @@ -29,7 +29,7 @@ jobs: uses: dawidd6/action-download-artifact@v2 with: github_token: ${{ secrets.GITHUB_TOKEN }} - workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml + workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_asa_pr.yml pr: ${{ github.event.pull_request.number }} name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} path: ${{ env.WORKING_DIR }}/build From efb02545c5dd3f349944972f4466b29e372e132e Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Wed, 20 Dec 2023 13:31:11 -0500 Subject: [PATCH 147/202] chore: Comment index --- frontend/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/index.js b/frontend/index.js index d941353860..c92307885f 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -1,3 +1,4 @@ +// Temporary server for Azure Dev const BASE_PATH = "./"; Bun.serve({ From e10b7822c7758e73dafd13e63fac2456821e2527 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 20 Dec 2023 15:21:33 -0500 Subject: [PATCH 148/202] chore: added error path --- frontend/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/index.js b/frontend/index.js index d941353860..4141d76723 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -15,6 +15,9 @@ Bun.serve({ return new Response(file); }, error() { - return new Response(null, { status: 404 }); + let filePath = BASE_PATH + "/index.html"; + const file = Bun.file(filePath); + return new Response(file); + // return new Response(null, { status: 404 }); }, }); From 6bb99a3411dcffa72f3631e3807f9191c04f5747 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 26 Dec 2023 10:21:49 -0500 Subject: [PATCH 149/202] chore: Changed all actions to commit hash vs. versions --- .github/workflows/dev_backend_asa_pr.yml | 6 +++--- .github/workflows/dev_backend_asa_pr_merge.yml | 2 +- .github/workflows/dev_backend_pr.yml | 6 +++--- .github/workflows/dev_backend_pr_merge.yml | 2 +- .github/workflows/dev_data_tools_deploy.yml | 6 +++--- .github/workflows/dev_frontend_asa_pr.yml | 8 ++++---- .github/workflows/dev_frontend_asa_pr_merge.yml | 4 ++-- .github/workflows/dev_frontend_pr.yml | 6 +++--- .github/workflows/dev_frontend_pr_merge.yml | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/dev_backend_asa_pr.yml b/.github/workflows/dev_backend_asa_pr.yml index 4016ccf1e4..67ad950e95 100644 --- a/.github/workflows/dev_backend_asa_pr.yml +++ b/.github/workflows/dev_backend_asa_pr.yml @@ -24,10 +24,10 @@ jobs: packages: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Build and publish the Docker image for ${{ github.repository }} - uses: macbre/push-to-ghcr@v13 + uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b #v13 with: image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} # it will be lowercased internally github_token: ${{ secrets.GITHUB_TOKEN }} @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Terraform Plan uses: ./.github/actions/tf-plan diff --git a/.github/workflows/dev_backend_asa_pr_merge.yml b/.github/workflows/dev_backend_asa_pr_merge.yml index 7290387bda..99a18c8cc1 100644 --- a/.github/workflows/dev_backend_asa_pr_merge.yml +++ b/.github/workflows/dev_backend_asa_pr_merge.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.pull_request.merged }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Terraform Apply uses: ./.github/actions/tf-apply diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index 7ad2ea1a1f..f5d00ba75f 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -24,10 +24,10 @@ jobs: packages: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Build and publish the Docker image for ${{ github.repository }} - uses: macbre/push-to-ghcr@v13 + uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b #v13 with: image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} # it will be lowercased internally github_token: ${{ secrets.GITHUB_TOKEN }} @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Terraform Plan uses: ./.github/actions/tf-plan diff --git a/.github/workflows/dev_backend_pr_merge.yml b/.github/workflows/dev_backend_pr_merge.yml index a51f1a9c5c..3ab31683a2 100644 --- a/.github/workflows/dev_backend_pr_merge.yml +++ b/.github/workflows/dev_backend_pr_merge.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.pull_request.merged }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Terraform Apply uses: ./.github/actions/tf-apply diff --git a/.github/workflows/dev_data_tools_deploy.yml b/.github/workflows/dev_data_tools_deploy.yml index d5430bca3d..24816aa33a 100644 --- a/.github/workflows/dev_data_tools_deploy.yml +++ b/.github/workflows/dev_data_tools_deploy.yml @@ -17,10 +17,10 @@ jobs: packages: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Build and publish the Docker image for ${{ github.repository }} - uses: macbre/push-to-ghcr@v13 + uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b #v13 with: image_name: ${{ github.repository }}/ops-data-tools # it will be lowercased internally github_token: ${{ secrets.GITHUB_TOKEN }} @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Deploy uses: ./.github/actions/tf-apply diff --git a/.github/workflows/dev_frontend_asa_pr.yml b/.github/workflows/dev_frontend_asa_pr.yml index 18529f565d..d4cc055f4c 100644 --- a/.github/workflows/dev_frontend_asa_pr.yml +++ b/.github/workflows/dev_frontend_asa_pr.yml @@ -19,7 +19,7 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Setup Bun uses: oven-sh/setup-bun@v1 @@ -53,7 +53,7 @@ jobs: } - name: Archive Artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0 with: name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} path: ${{ env.WORKING_DIR }}/build @@ -65,10 +65,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Download Frontend Artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 #v4.1 with: name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} path: ${{ env.WORKING_DIR }}/build diff --git a/.github/workflows/dev_frontend_asa_pr_merge.yml b/.github/workflows/dev_frontend_asa_pr_merge.yml index f098b4a05a..34fd95fe67 100644 --- a/.github/workflows/dev_frontend_asa_pr_merge.yml +++ b/.github/workflows/dev_frontend_asa_pr_merge.yml @@ -22,11 +22,11 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.pull_request.merged }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Load Archived build id: download-plan - uses: dawidd6/action-download-artifact@v2 + uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d #v3.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_asa_pr.yml diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index 159b4fce95..2ae613b029 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -21,10 +21,10 @@ jobs: packages: write runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Build and publish the Docker image for ${{ github.repository }} - uses: macbre/push-to-ghcr@v13 + uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b #v13 with: image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} # it will be lowercased internally github_token: ${{ secrets.GITHUB_TOKEN }} @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Terraform Plan uses: ./.github/actions/tf-plan diff --git a/.github/workflows/dev_frontend_pr_merge.yml b/.github/workflows/dev_frontend_pr_merge.yml index 5b21679f31..6df666af40 100644 --- a/.github/workflows/dev_frontend_pr_merge.yml +++ b/.github/workflows/dev_frontend_pr_merge.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.pull_request.merged }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Terraform Apply uses: ./.github/actions/tf-apply From 59f676e69c38b9e094bada31f35cba56cbcd084f Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 26 Dec 2023 10:23:29 -0500 Subject: [PATCH 150/202] chore: cleared whitespace --- frontend/Dockerfile.azure | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/Dockerfile.azure b/frontend/Dockerfile.azure index 7e2fb0beda..fe1a0fb051 100644 --- a/frontend/Dockerfile.azure +++ b/frontend/Dockerfile.azure @@ -39,4 +39,3 @@ EXPOSE 3000/tcp # Entry point to run the application ENTRYPOINT ["/bin/sh", "-c", "bun run ~/.bun/bin/runtime-env-cra && bun run index.js"] - From 345a86ad82ffe1ce7467b1c93e73d4192e9c91bb Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Tue, 26 Dec 2023 10:27:09 -0500 Subject: [PATCH 151/202] chore: Typo in hash --- .github/workflows/dev_backend_asa_pr.yml | 2 +- .github/workflows/dev_backend_pr.yml | 2 +- .github/workflows/dev_data_tools_deploy.yml | 2 +- .github/workflows/dev_frontend_pr.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev_backend_asa_pr.yml b/.github/workflows/dev_backend_asa_pr.yml index 67ad950e95..d570e0d8ee 100644 --- a/.github/workflows/dev_backend_asa_pr.yml +++ b/.github/workflows/dev_backend_asa_pr.yml @@ -27,7 +27,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Build and publish the Docker image for ${{ github.repository }} - uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b #v13 + 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 }} diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index f5d00ba75f..a245516b85 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -27,7 +27,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Build and publish the Docker image for ${{ github.repository }} - uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b #v13 + 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 }} diff --git a/.github/workflows/dev_data_tools_deploy.yml b/.github/workflows/dev_data_tools_deploy.yml index 24816aa33a..a0b3236a5c 100644 --- a/.github/workflows/dev_data_tools_deploy.yml +++ b/.github/workflows/dev_data_tools_deploy.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Build and publish the Docker image for ${{ github.repository }} - uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b #v13 + uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b4d44 #v13 with: image_name: ${{ github.repository }}/ops-data-tools # it will be lowercased internally github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index 2ae613b029..c99ba50686 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Build and publish the Docker image for ${{ github.repository }} - uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b #v13 + 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 }} From 20a2f2a38b7fe760826a5758e40dbe38013bed18 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 26 Dec 2023 11:11:03 -0500 Subject: [PATCH 152/202] chore: Verifying action changes --- backend/Dockerfile.ops-api | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index bb59e730d7..532c220b12 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -21,6 +21,6 @@ ENV PYTHONUNBUFFERED=1 ENV FLASK_APP=ops_api.ops ENV FLASK_DEBUG=true -## This is to attempt fixing the worker issues -- +## This is to attempt fixing the worker issues CMD ["python", "-m", "gunicorn", "--timeout", "1000", "--workers", "1", "--threads", "4", "-b", ":8080", "ops_api.ops:create_app()"] ## --timeout 1000 --workers 1 --threads 4 From 35cc6c0fb277444316c6863da77f7d99e3f3a7fd Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 16:19:18 -0500 Subject: [PATCH 153/202] chore: test a combined workflow --- .github/workflows/combined_workflow.yml | 76 +++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/combined_workflow.yml diff --git a/.github/workflows/combined_workflow.yml b/.github/workflows/combined_workflow.yml new file mode 100644 index 0000000000..4411cda4e3 --- /dev/null +++ b/.github/workflows/combined_workflow.yml @@ -0,0 +1,76 @@ +name: Dev BE Combined Pull Request Workflow + +on: + workflow_dispatch: + pull_request: + branches: + - development + 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-and-deploy: + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + + - name: Build and publish the Docker image + uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b4d44 #v13 + with: + image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} + github_token: ${{ secrets.GITHUB_TOKEN }} + context: ${{ github.workspace }}/${{ env.WORKING_DIR }} + dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DOCKER_FILE }} + image_tag: ${{ github.sha }} + + - 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 }}" + } + + apply-deploy: + permissions: + pull-requests: write + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged + steps: + - name: Checkout code + 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 }}_asa_pr.yml From bb4f7a71839d934b85fd18f45385e50c3fe203ba Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Wed, 27 Dec 2023 16:22:35 -0500 Subject: [PATCH 154/202] Update Dockerfile.ops-api --- backend/Dockerfile.ops-api | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index 532c220b12..f3761ff219 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -24,3 +24,4 @@ ENV FLASK_DEBUG=true ## This is to attempt fixing the worker issues CMD ["python", "-m", "gunicorn", "--timeout", "1000", "--workers", "1", "--threads", "4", "-b", ":8080", "ops_api.ops:create_app()"] ## --timeout 1000 --workers 1 --threads 4 + From 67f865f33c952b4f9a4c4c4bc9d782ba12dcae68 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 16:30:49 -0500 Subject: [PATCH 155/202] chore: Skipped the apply, trying something different --- .github/workflows/combined_workflow.yml | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/.github/workflows/combined_workflow.yml b/.github/workflows/combined_workflow.yml index 4411cda4e3..9b5e89a9cc 100644 --- a/.github/workflows/combined_workflow.yml +++ b/.github/workflows/combined_workflow.yml @@ -1,4 +1,4 @@ -name: Dev BE Combined Pull Request Workflow +name: Dev BE ASA Pull Request on: workflow_dispatch: @@ -18,11 +18,12 @@ env: DOCKER_FILE: "Dockerfile.ops-api" jobs: - build-and-deploy: + build: permissions: contents: read packages: write runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.action == 'opened') steps: - name: Checkout code uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 @@ -36,28 +37,11 @@ jobs: dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DOCKER_FILE }} image_tag: ${{ github.sha }} - - 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 }}" - } - apply-deploy: permissions: pull-requests: write runs-on: ubuntu-latest - if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged) steps: - name: Checkout code uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 From d37f0f3d5553f18988af554a1c4fc32bc64479cf Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Wed, 27 Dec 2023 16:32:36 -0500 Subject: [PATCH 156/202] Update Dockerfile.ops-api --- backend/Dockerfile.ops-api | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index f3761ff219..532c220b12 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -24,4 +24,3 @@ ENV FLASK_DEBUG=true ## This is to attempt fixing the worker issues CMD ["python", "-m", "gunicorn", "--timeout", "1000", "--workers", "1", "--threads", "4", "-b", ":8080", "ops_api.ops:create_app()"] ## --timeout 1000 --workers 1 --threads 4 - From 7d1f133c3e037ff4ee8bfb30df9f8b7ec1c2c4b7 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 16:41:19 -0500 Subject: [PATCH 157/202] chore: deleted the combined... not working --- .github/workflows/combined_workflow.yml | 60 ------------------------- 1 file changed, 60 deletions(-) delete mode 100644 .github/workflows/combined_workflow.yml diff --git a/.github/workflows/combined_workflow.yml b/.github/workflows/combined_workflow.yml deleted file mode 100644 index 9b5e89a9cc..0000000000 --- a/.github/workflows/combined_workflow.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Dev BE ASA Pull Request - -on: - workflow_dispatch: - pull_request: - branches: - - development - 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 - if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.action == 'opened') - steps: - - name: Checkout code - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - - - name: Build and publish the Docker image - uses: macbre/push-to-ghcr@0f6c180522d02d9e608096c4dcf3b691193b4d44 #v13 - with: - image_name: ${{ github.repository }}/ops-${{ env.WORKING_DIR }} - github_token: ${{ secrets.GITHUB_TOKEN }} - context: ${{ github.workspace }}/${{ env.WORKING_DIR }} - dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DOCKER_FILE }} - image_tag: ${{ github.sha }} - - apply-deploy: - permissions: - pull-requests: write - runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged) - steps: - - name: Checkout code - 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 }}_asa_pr.yml From 9674752c5ad22d4f7c06633046abfd6e09d84b4e Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 19:58:11 -0500 Subject: [PATCH 158/202] chore: test matrix idea --- .github/actions/test_matrix/action.yaml | 63 +++++++++++++++++++++++++ .github/workflows/test_matrix.yml | 35 ++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 .github/actions/test_matrix/action.yaml create mode 100644 .github/workflows/test_matrix.yml diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml new file mode 100644 index 0000000000..8c02069891 --- /dev/null +++ b/.github/actions/test_matrix/action.yaml @@ -0,0 +1,63 @@ +name: 'Build Matrix' + +description: 'Builds components based on matrix configuration' + +inputs: + event: # Event type (e.g., push, pull_request) + required: true + +runs: + using: 'composite' + steps: + - name: Check Event Type + id: check-event + run: | + if [ "${{ inputs.event }}" != "push" ] && [ "${{ inputs.event }}" != "pull_request" ]; then + echo "Invalid event type. Only 'push' and 'pull_request' are supported." + exit 1 + fi + + - name: Set Matrix Outputs + id: set-matrix + run: | + components=() + paths=() + docker_files=() + working_dirs=() + image_names=() + + # Check if it's a pull request and get changed files + if [ "${{ inputs.event }}" == "pull_request" ]; then + files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) + else + files=$(git diff --name-only HEAD^ HEAD) + fi + + # Function to add a component + add_component() { + components+=("$1") + paths+=("$2") + docker_files+=("$3") + working_dirs+=("$4") + image_names+=("$5") + } + + # Check if paths of each component are in the changed files + if echo "$files" | grep -qE '^backend/'; then + add_component "Backend" "backend/models/** backend/ops_api/** backend/Dockerfile.ops-api" "Dockerfile.ops-api" "backend" "ops-backend" + fi + + if echo "$files" | grep -qE '^backend/data-tools/'; then + add_component "Data-Tools" "backend/data-tools/** backend/Dockerfile.data-tools" "Dockerfile.data-tools" "backend" "ops-data-tools" + fi + + if echo "$files" | grep -qE '^frontend/'; then + add_component "Frontend" "frontend/** frontend/Dockerfile.azure" "Dockerfile.azure" "frontend" "ops-frontend" + fi + + # Set matrix outputs + echo "::set-output name=matrix::[${components[@]}]" + echo "::set-output name=paths::[${paths[@]}]" + echo "::set-output name=docker_file::[${docker_files[@]}]" + echo "::set-output name=working_dir::[${working_dirs[@]}]" + echo "::set-output name=image_name::[${image_names[@]}]" diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml new file mode 100644 index 0000000000..5c79c9373a --- /dev/null +++ b/.github/workflows/test_matrix.yml @@ -0,0 +1,35 @@ +name: Build Components + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + event: ["push", "pull_request"] + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set Matrix and Build + id: set-matrix + uses: ./.github/actions/test_matrix + with: + event: ${{ matrix.event }} + + - name: Use Matrix in Another Step + run: | + echo "Component: ${{ matrix.component }}" + echo "Paths: ${{ matrix.paths }}" + echo "Dockerfile: ${{ matrix.docker_file }}" + echo "Working Directory: ${{ matrix.working_dir }}" + echo "Image Name: ${{ matrix.image_name }}" From 30320c11c5486af0f31dae5f2a3bfc32e806fb50 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Wed, 27 Dec 2023 21:14:13 -0500 Subject: [PATCH 159/202] Update index.js --- frontend/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/index.js b/frontend/index.js index 17abbdc008..018e5d161e 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -16,6 +16,7 @@ Bun.serve({ return new Response(file); }, error() { + // If error, route to index.html let filePath = BASE_PATH + "/index.html"; const file = Bun.file(filePath); return new Response(file); From 11936aab314c58015e9fb8a64a8048ed761179ad Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Wed, 27 Dec 2023 21:16:09 -0500 Subject: [PATCH 160/202] Update test_matrix.yml --- .github/workflows/test_matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index 5c79c9373a..df2a170756 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -3,10 +3,10 @@ name: Build Components on: push: branches: - - main + - development pull_request: branches: - - main + - development jobs: build: From 955437c0d560dd54b0e3d2c31bb1ab863655c1a3 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 21:20:02 -0500 Subject: [PATCH 161/202] chore: added shell --- .github/actions/test_matrix/action.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 8c02069891..928ab72f8b 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -16,6 +16,7 @@ runs: echo "Invalid event type. Only 'push' and 'pull_request' are supported." exit 1 fi + shell: bash - name: Set Matrix Outputs id: set-matrix @@ -61,3 +62,4 @@ runs: echo "::set-output name=docker_file::[${docker_files[@]}]" echo "::set-output name=working_dir::[${working_dirs[@]}]" echo "::set-output name=image_name::[${image_names[@]}]" + shell: bash From d06fe6a924657b950bd48540be64eb1f27410884 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 21:26:35 -0500 Subject: [PATCH 162/202] chore: diff change --- .github/actions/test_matrix/action.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 928ab72f8b..6911504a3f 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -27,11 +27,11 @@ runs: working_dirs=() image_names=() - # Check if it's a pull request and get changed files if [ "${{ inputs.event }}" == "pull_request" ]; then - files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }}) + base_ref=$(git rev-parse ${{ github.event.before }}) + files=$(git diff --name-only $base_ref ${{ github.sha }}) else - files=$(git diff --name-only HEAD^ HEAD) + files=$(git diff --name-only ${{ github.sha }}^ ${{ github.sha }}) fi # Function to add a component From 16a2784f54c605d1f71f1cd93760714381c7f110 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 21:30:59 -0500 Subject: [PATCH 163/202] chore: diff change --- .github/actions/test_matrix/action.yaml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 6911504a3f..b217d69b88 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -27,11 +27,16 @@ runs: working_dirs=() image_names=() - if [ "${{ inputs.event }}" == "pull_request" ]; then - base_ref=$(git rev-parse ${{ github.event.before }}) - files=$(git diff --name-only $base_ref ${{ github.sha }}) + if [ "$GITHUB_BASE_REF" ]; then + # Pull Request + git fetch origin $GITHUB_BASE_REF --depth=1 + export DIFF=$(git diff --name-only origin/$GITHUB_BASE_REF $GITHUB_SHA) + echo "Diff between origin/$GITHUB_BASE_REF and $GITHUB_SHA" else - files=$(git diff --name-only ${{ github.sha }}^ ${{ github.sha }}) + # Push + git fetch origin ${{ github.event.before }} --depth=1 + export DIFF=$(git diff --name-only ${{ github.event.before }} $GITHUB_SHA) + echo "Diff between ${{ github.event.before }} and $GITHUB_SHA" fi # Function to add a component From 5e675781e47121ee744fb8d1654aa2ff41fa5372 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 21:34:56 -0500 Subject: [PATCH 164/202] chore: fix no output --- .github/actions/test_matrix/action.yaml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index b217d69b88..6eefbd806c 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -21,12 +21,6 @@ runs: - name: Set Matrix Outputs id: set-matrix run: | - components=() - paths=() - docker_files=() - working_dirs=() - image_names=() - if [ "$GITHUB_BASE_REF" ]; then # Pull Request git fetch origin $GITHUB_BASE_REF --depth=1 @@ -39,6 +33,12 @@ runs: echo "Diff between ${{ github.event.before }} and $GITHUB_SHA" fi + components=() + paths=() + docker_files=() + working_dirs=() + image_names=() + # Function to add a component add_component() { components+=("$1") @@ -49,15 +49,15 @@ runs: } # Check if paths of each component are in the changed files - if echo "$files" | grep -qE '^backend/'; then + if echo "$DIFF" | grep -qE '^backend/'; then add_component "Backend" "backend/models/** backend/ops_api/** backend/Dockerfile.ops-api" "Dockerfile.ops-api" "backend" "ops-backend" fi - if echo "$files" | grep -qE '^backend/data-tools/'; then + if echo "$DIFF" | grep -qE '^backend/data-tools/'; then add_component "Data-Tools" "backend/data-tools/** backend/Dockerfile.data-tools" "Dockerfile.data-tools" "backend" "ops-data-tools" fi - if echo "$files" | grep -qE '^frontend/'; then + if echo "$DIFF" | grep -qE '^frontend/'; then add_component "Frontend" "frontend/** frontend/Dockerfile.azure" "Dockerfile.azure" "frontend" "ops-frontend" fi @@ -67,4 +67,5 @@ runs: echo "::set-output name=docker_file::[${docker_files[@]}]" echo "::set-output name=working_dir::[${working_dirs[@]}]" echo "::set-output name=image_name::[${image_names[@]}]" + shell: bash From 995d7597fe6806771368122d025d5afeccc9e20c Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 21:40:18 -0500 Subject: [PATCH 165/202] chore: add debug --- .github/actions/test_matrix/action.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 6eefbd806c..17ea9420c2 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -61,6 +61,10 @@ runs: add_component "Frontend" "frontend/** frontend/Dockerfile.azure" "Dockerfile.azure" "frontend" "ops-frontend" fi + # Debug statements + echo "DEBUG: DIFF variable content:" + echo "$DIFF" + # Set matrix outputs echo "::set-output name=matrix::[${components[@]}]" echo "::set-output name=paths::[${paths[@]}]" From d88614f1131db604d6b749194777385f61cb013b Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 21:45:28 -0500 Subject: [PATCH 166/202] chore: path fix --- .github/actions/test_matrix/action.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 17ea9420c2..75b5488973 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -49,15 +49,15 @@ runs: } # Check if paths of each component are in the changed files - if echo "$DIFF" | grep -qE '^backend/'; then + if echo "$DIFF" | grep -qE 'backend/models/|backend/ops_api/|backend/Dockerfile.ops-api'; then add_component "Backend" "backend/models/** backend/ops_api/** backend/Dockerfile.ops-api" "Dockerfile.ops-api" "backend" "ops-backend" fi - if echo "$DIFF" | grep -qE '^backend/data-tools/'; then + if echo "$DIFF" | grep -qE 'backend/data-tools/|backend/Dockerfile.data-tools'; then add_component "Data-Tools" "backend/data-tools/** backend/Dockerfile.data-tools" "Dockerfile.data-tools" "backend" "ops-data-tools" fi - if echo "$DIFF" | grep -qE '^frontend/'; then + if echo "$DIFF" | grep -qE 'frontend/|frontend/Dockerfile.azure'; then add_component "Frontend" "frontend/** frontend/Dockerfile.azure" "Dockerfile.azure" "frontend" "ops-frontend" fi From 7302c828cec852813e9a8fb2f9083fb9cb9e3a2f Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 21:49:55 -0500 Subject: [PATCH 167/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 75b5488973..a5e3275227 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -50,21 +50,37 @@ runs: # Check if paths of each component are in the changed files if echo "$DIFF" | grep -qE 'backend/models/|backend/ops_api/|backend/Dockerfile.ops-api'; then + echo "DEBUG: Detected changes for Backend" add_component "Backend" "backend/models/** backend/ops_api/** backend/Dockerfile.ops-api" "Dockerfile.ops-api" "backend" "ops-backend" + else + echo "DEBUG: No changes detected for Backend" fi if echo "$DIFF" | grep -qE 'backend/data-tools/|backend/Dockerfile.data-tools'; then + echo "DEBUG: Detected changes for Data-Tools" add_component "Data-Tools" "backend/data-tools/** backend/Dockerfile.data-tools" "Dockerfile.data-tools" "backend" "ops-data-tools" + else + echo "DEBUG: No changes detected for Data-Tools" fi if echo "$DIFF" | grep -qE 'frontend/|frontend/Dockerfile.azure'; then + echo "DEBUG: Detected changes for Frontend" add_component "Frontend" "frontend/** frontend/Dockerfile.azure" "Dockerfile.azure" "frontend" "ops-frontend" + else + echo "DEBUG: No changes detected for Frontend" fi # Debug statements echo "DEBUG: DIFF variable content:" echo "$DIFF" + # Debug statements for matrix components + echo "DEBUG: Components: ${components[@]}" + echo "DEBUG: Paths: ${paths[@]}" + echo "DEBUG: Docker Files: ${docker_files[@]}" + echo "DEBUG: Working Directories: ${working_dirs[@]}" + echo "DEBUG: Image Names: ${image_names[@]}" + # Set matrix outputs echo "::set-output name=matrix::[${components[@]}]" echo "::set-output name=paths::[${paths[@]}]" From d20f8219d0d91d906746e13c8708f46c758e290c Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 21:53:15 -0500 Subject: [PATCH 168/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index a5e3275227..a00b613559 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -82,10 +82,7 @@ runs: echo "DEBUG: Image Names: ${image_names[@]}" # Set matrix outputs - echo "::set-output name=matrix::[${components[@]}]" - echo "::set-output name=paths::[${paths[@]}]" - echo "::set-output name=docker_file::[${docker_files[@]}]" - echo "::set-output name=working_dir::[${working_dirs[@]}]" - echo "::set-output name=image_name::[${image_names[@]}]" + echo "matrix=${components[@]}::paths=${paths[@]}::docker_file=${docker_files[@]}::working_dir=${working_dirs[@]}::image_name=${image_names[@]}" >> $GITHUB_ENV + shell: bash From e43c3acdb61c9172e4b6045f9cae06d442cca34f Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 22:02:58 -0500 Subject: [PATCH 169/202] chore: more debugging --- .github/workflows/test_matrix.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index df2a170756..9017d54cb7 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -26,10 +26,16 @@ jobs: with: event: ${{ matrix.event }} - - name: Use Matrix in Another Step - run: | - echo "Component: ${{ matrix.component }}" + use-matrix: + needs: set-matrix + runs-on: ubuntu-latest + strategy: + matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}} + steps: + - name: Use matrix + run: | + echo "Component: ${{ matrix }}" echo "Paths: ${{ matrix.paths }}" echo "Dockerfile: ${{ matrix.docker_file }}" echo "Working Directory: ${{ matrix.working_dir }}" - echo "Image Name: ${{ matrix.image_name }}" + echo "Image Name: ${{ matrix.image_name }}" \ No newline at end of file From fe5fe43facf8c7f43baff58f45036e235259dd02 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 22:03:23 -0500 Subject: [PATCH 170/202] chore: more debugging --- .github/workflows/test_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index 9017d54cb7..f7d25987f6 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -33,7 +33,7 @@ jobs: matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}} steps: - name: Use matrix - run: | + run: | echo "Component: ${{ matrix }}" echo "Paths: ${{ matrix.paths }}" echo "Dockerfile: ${{ matrix.docker_file }}" From 51f0274f356f962a1ffa2b17500f104bb6c9ee2a Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 22:05:31 -0500 Subject: [PATCH 171/202] chore: more debugging --- .github/workflows/test_matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index f7d25987f6..1a75d47c39 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -9,7 +9,7 @@ on: - development jobs: - build: + set-matrix: runs-on: ubuntu-latest strategy: From c69fb54b2c742f5277182dc76cc151d7f669a32e Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 22:12:41 -0500 Subject: [PATCH 172/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 4 ++-- .github/workflows/test_matrix.yml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index a00b613559..005e3984c5 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -81,8 +81,8 @@ runs: echo "DEBUG: Working Directories: ${working_dirs[@]}" echo "DEBUG: Image Names: ${image_names[@]}" - # Set matrix outputs - echo "matrix=${components[@]}::paths=${paths[@]}::docker_file=${docker_files[@]}::working_dir=${working_dirs[@]}::image_name=${image_names[@]}" >> $GITHUB_ENV + # Set matrix outputs as JSON + echo "::set-output name=matrix::$(echo "{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" | jq -c)" shell: bash diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index 1a75d47c39..39b4c44e7f 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -34,8 +34,8 @@ jobs: steps: - name: Use matrix run: | - echo "Component: ${{ matrix }}" + echo "Component: ${{ matrix.components }}" echo "Paths: ${{ matrix.paths }}" - echo "Dockerfile: ${{ matrix.docker_file }}" - echo "Working Directory: ${{ matrix.working_dir }}" - echo "Image Name: ${{ matrix.image_name }}" \ No newline at end of file + echo "Dockerfile: ${{ matrix.docker_files }}" + echo "Working Directory: ${{ matrix.working_dirs }}" + echo "Image Name: ${{ matrix.image_names }}" From 5492beeb639c95389484cffabe61c959026ec93e Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 22:16:50 -0500 Subject: [PATCH 173/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 005e3984c5..86476080c1 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -82,7 +82,7 @@ runs: echo "DEBUG: Image Names: ${image_names[@]}" # Set matrix outputs as JSON - echo "::set-output name=matrix::$(echo "{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" | jq -c)" + echo "::set-output name=matrix::$(echo "{\"matrix\": {\"components\":${components[@]/#/\"},\"paths\":${paths[@]/#/\"},\"docker_files\":${docker_files[@]/#/\"},\"working_dirs\":${working_dirs[@]/#/\"},\"image_names\":${image_names[@]/#/\"}}}" | jq -c)" shell: bash From c3533bd0d25e78e6d3f09e4f213cdda206ff0494 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 22:24:35 -0500 Subject: [PATCH 174/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 86476080c1..91e4690181 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -82,7 +82,12 @@ runs: echo "DEBUG: Image Names: ${image_names[@]}" # Set matrix outputs as JSON - echo "::set-output name=matrix::$(echo "{\"matrix\": {\"components\":${components[@]/#/\"},\"paths\":${paths[@]/#/\"},\"docker_files\":${docker_files[@]/#/\"},\"working_dirs\":${working_dirs[@]/#/\"},\"image_names\":${image_names[@]/#/\"}}}" | jq -c)" + echo "::set-output name=matrix::$(jq -n --argjson components "${components[@]}" \ + --argjson paths "${paths[@]}" \ + --argjson docker_files "${docker_files[@]}" \ + --argjson working_dirs "${working_dirs[@]}" \ + --argjson image_names "${image_names[@]}" \ + '{matrix: {components: $components, paths: $paths, docker_files: $docker_files, working_dirs: $working_dirs, image_names: $image_names}}')" shell: bash From 71464ef21f641332292275f3811d99ffb1a35b4f Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 22:26:18 -0500 Subject: [PATCH 175/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 91e4690181..eac771b67d 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -82,12 +82,8 @@ runs: echo "DEBUG: Image Names: ${image_names[@]}" # Set matrix outputs as JSON - echo "::set-output name=matrix::$(jq -n --argjson components "${components[@]}" \ - --argjson paths "${paths[@]}" \ - --argjson docker_files "${docker_files[@]}" \ - --argjson working_dirs "${working_dirs[@]}" \ - --argjson image_names "${image_names[@]}" \ - '{matrix: {components: $components, paths: $paths, docker_files: $docker_files, working_dirs: $working_dirs, image_names: $image_names}}')" + # Set matrix outputs as JSON + echo "::set-output name=matrix::$(echo "{\"matrix\": {\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}}" | tr -d '\n' | tr -d ' ')" shell: bash From 713760d267bae18b4fdda469b4f5f8bb9bbac854 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 22:30:51 -0500 Subject: [PATCH 176/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index eac771b67d..bd3de4e2c9 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -83,7 +83,7 @@ runs: # Set matrix outputs as JSON # Set matrix outputs as JSON - echo "::set-output name=matrix::$(echo "{\"matrix\": {\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}}" | tr -d '\n' | tr -d ' ')" + echo "::set-output name=matrix::$(echo "{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" | jq -c)" shell: bash From ffb068a1721df68534808f082e1a28f9728de140 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 22:34:30 -0500 Subject: [PATCH 177/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index bd3de4e2c9..005e3984c5 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -81,7 +81,6 @@ runs: echo "DEBUG: Working Directories: ${working_dirs[@]}" echo "DEBUG: Image Names: ${image_names[@]}" - # Set matrix outputs as JSON # Set matrix outputs as JSON echo "::set-output name=matrix::$(echo "{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" | jq -c)" From 5151e05878a227afc598b00748e799418f80e833 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 23:15:21 -0500 Subject: [PATCH 178/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 005e3984c5..510ba3d331 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -82,7 +82,7 @@ runs: echo "DEBUG: Image Names: ${image_names[@]}" # Set matrix outputs as JSON - echo "::set-output name=matrix::$(echo "{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" | jq -c)" + echo "matrix=$(echo "{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" | jq -c)" >> $GITHUB_OUTPUT shell: bash From 5912d3d06f1068a607f7a6fdb3f32b070e24ac63 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 23:17:09 -0500 Subject: [PATCH 179/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 510ba3d331..c08890a6ef 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -82,7 +82,8 @@ runs: echo "DEBUG: Image Names: ${image_names[@]}" # Set matrix outputs as JSON - echo "matrix=$(echo "{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" | jq -c)" >> $GITHUB_OUTPUT + matrix_json="{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" + echo "matrix=$(echo "$matrix_json" | jq -c)" >> $GITHUB_OUTPUT shell: bash From 9f7cc34880eb223239898d22d9ae49b06ba3fca5 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 23:18:49 -0500 Subject: [PATCH 180/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index c08890a6ef..90f3582b40 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -82,7 +82,7 @@ runs: echo "DEBUG: Image Names: ${image_names[@]}" # Set matrix outputs as JSON - matrix_json="{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" + matrix_json="{\"components\":\"${components[@]}\",\"paths\":\"${paths[@]}\",\"docker_files\":\"${docker_files[@]}\",\"working_dirs\":\"${working_dirs[@]}\",\"image_names\":\"${image_names[@]}\"}" echo "matrix=$(echo "$matrix_json" | jq -c)" >> $GITHUB_OUTPUT From 097acaa5d0c98f626644fa1649a25b7f941e3878 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 23:27:12 -0500 Subject: [PATCH 181/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 5 +++++ .github/workflows/test_matrix.yml | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 90f3582b40..348fbe42b5 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -6,6 +6,11 @@ inputs: event: # Event type (e.g., push, pull_request) required: true +outputs: + matrix: + description: "Matrix" + value: ${{ steps.set-matrix.outputs.matrix }} + runs: using: 'composite' steps: diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index 39b4c44e7f..5b46c94eb7 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -34,8 +34,15 @@ jobs: steps: - name: Use matrix run: | - echo "Component: ${{ matrix.components }}" - echo "Paths: ${{ matrix.paths }}" - echo "Dockerfile: ${{ matrix.docker_files }}" - echo "Working Directory: ${{ matrix.working_dirs }}" - echo "Image Name: ${{ matrix.image_names }}" + matrix="${{ needs.set-matrix.outputs.matrix }}" + components=$(echo "$matrix" | jq -r '.components | join(",")') + paths=$(echo "$matrix" | jq -r '.paths | join(",")') + docker_files=$(echo "$matrix" | jq -r '.docker_files | join(",")') + working_dirs=$(echo "$matrix" | jq -r '.working_dirs | join(",")') + image_names=$(echo "$matrix" | jq -r '.image_names | join(",")') + + echo "Component: $components" + echo "Paths: $paths" + echo "Dockerfile: $docker_files" + echo "Working Directory: $working_dirs" + echo "Image Name: $image_names" \ No newline at end of file From 972f1d95ad9919b586aa4fa5cb27a3536ff0975f Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 23:33:52 -0500 Subject: [PATCH 182/202] chore: more debugging --- .github/workflows/test_matrix.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index 5b46c94eb7..51c55e8b56 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -34,15 +34,14 @@ jobs: steps: - name: Use matrix run: | - matrix="${{ needs.set-matrix.outputs.matrix }}" - components=$(echo "$matrix" | jq -r '.components | join(",")') - paths=$(echo "$matrix" | jq -r '.paths | join(",")') - docker_files=$(echo "$matrix" | jq -r '.docker_files | join(",")') - working_dirs=$(echo "$matrix" | jq -r '.working_dirs | join(",")') - image_names=$(echo "$matrix" | jq -r '.image_names | join(",")') + matrix="${{ matrix }}" + paths="${{ matrix.paths }}" + docker_files="${{ matrix.docker_files }}" + working_dirs="${{ matrix.working_dirs }}" + image_names="${{ matrix.image_names }}" - echo "Component: $components" + echo "Component: $matrix" echo "Paths: $paths" echo "Dockerfile: $docker_files" echo "Working Directory: $working_dirs" - echo "Image Name: $image_names" \ No newline at end of file + echo "Image Name: $image_names" From 48a6c783f734e001d267ed0aa52ce59a1f19a38c Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 23:38:18 -0500 Subject: [PATCH 183/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 348fbe42b5..204bdb05c9 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -87,8 +87,9 @@ runs: echo "DEBUG: Image Names: ${image_names[@]}" # Set matrix outputs as JSON - matrix_json="{\"components\":\"${components[@]}\",\"paths\":\"${paths[@]}\",\"docker_files\":\"${docker_files[@]}\",\"working_dirs\":\"${working_dirs[@]}\",\"image_names\":\"${image_names[@]}\"}" - echo "matrix=$(echo "$matrix_json" | jq -c)" >> $GITHUB_OUTPUT + matrix_json="{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" + echo "DEBUG: Raw matrix output: $matrix_json" + echo "::set-output name=matrix::$(echo "$matrix_json" | jq -c)" shell: bash From 781c24bbcb4d6f0ab7ade2e2286f07a727cf8e9a Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 23:40:17 -0500 Subject: [PATCH 184/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 204bdb05c9..875cca0371 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -87,7 +87,7 @@ runs: echo "DEBUG: Image Names: ${image_names[@]}" # Set matrix outputs as JSON - matrix_json="{\"components\":${components[@]},\"paths\":${paths[@]},\"docker_files\":${docker_files[@]},\"working_dirs\":${working_dirs[@]},\"image_names\":${image_names[@]}}" + matrix_json="{\"components\":\"${components[@]}\",\"paths\":\"${paths[@]}\",\"docker_files\":\"${docker_files[@]}\",\"working_dirs\":\"${working_dirs[@]}\",\"image_names\":\"${image_names[@]}\"}" echo "DEBUG: Raw matrix output: $matrix_json" echo "::set-output name=matrix::$(echo "$matrix_json" | jq -c)" From f2b64436d56305f67152081058e7c8d89aa291bc Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 23:43:56 -0500 Subject: [PATCH 185/202] chore: more debugging --- .github/workflows/test_matrix.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index 51c55e8b56..5ab75d362e 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -39,9 +39,10 @@ jobs: docker_files="${{ matrix.docker_files }}" working_dirs="${{ matrix.working_dirs }}" image_names="${{ matrix.image_names }}" - + echo "Component: $matrix" echo "Paths: $paths" echo "Dockerfile: $docker_files" echo "Working Directory: $working_dirs" echo "Image Name: $image_names" + \ No newline at end of file From bb7df22d85aca3f56f115bd45fc6690d8443de5a Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Wed, 27 Dec 2023 23:51:33 -0500 Subject: [PATCH 186/202] chore: more debugging --- .github/actions/test_matrix/action.yaml | 8 +++-- .github/workflows/test_matrix.yml | 40 ++++++++++++++++++------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml index 875cca0371..5ba7e093e6 100644 --- a/.github/actions/test_matrix/action.yaml +++ b/.github/actions/test_matrix/action.yaml @@ -86,10 +86,12 @@ runs: echo "DEBUG: Working Directories: ${working_dirs[@]}" echo "DEBUG: Image Names: ${image_names[@]}" + # # Set matrix outputs as JSON + # matrix_json="{\"components\":\"${components[@]}\",\"paths\":\"${paths[@]}\",\"docker_files\":\"${docker_files[@]}\",\"working_dirs\":\"${working_dirs[@]}\",\"image_names\":\"${image_names[@]}\"}" + # echo "DEBUG: Raw matrix output: $matrix_json" + # echo "::set-output name=matrix::$(echo "$matrix_json" | jq -c)" # Set matrix outputs as JSON - matrix_json="{\"components\":\"${components[@]}\",\"paths\":\"${paths[@]}\",\"docker_files\":\"${docker_files[@]}\",\"working_dirs\":\"${working_dirs[@]}\",\"image_names\":\"${image_names[@]}\"}" - echo "DEBUG: Raw matrix output: $matrix_json" - echo "::set-output name=matrix::$(echo "$matrix_json" | jq -c)" + echo "matrix=${components[@]}::${paths[@]}::${docker_files[@]}::${working_dirs[@]}::${image_names[@]}" >> $GITHUB_ENV shell: bash diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index 5ab75d362e..3d54140490 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -26,23 +26,43 @@ jobs: with: event: ${{ matrix.event }} + # use-matrix: + # needs: set-matrix + # runs-on: ubuntu-latest + # strategy: + # matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}} + # steps: + # - name: Use matrix + # run: | + # matrix="${{ matrix }}" + # paths="${{ matrix.paths }}" + # docker_files="${{ matrix.docker_files }}" + # working_dirs="${{ matrix.working_dirs }}" + # image_names="${{ matrix.image_names }}" + + # echo "Component: $matrix" + # echo "Paths: $paths" + # echo "Dockerfile: $docker_files" + # echo "Working Directory: $working_dirs" + # echo "Image Name: $image_names" + use-matrix: needs: set-matrix runs-on: ubuntu-latest - strategy: - matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}} steps: - name: Use matrix run: | - matrix="${{ matrix }}" - paths="${{ matrix.paths }}" - docker_files="${{ matrix.docker_files }}" - working_dirs="${{ matrix.working_dirs }}" - image_names="${{ matrix.image_names }}" + matrix="${{ needs.set-matrix.outputs.matrix }}" + IFS='::' read -ra matrix_values <<< "$matrix" + + components="${matrix_values[0]}" + paths="${matrix_values[1]}" + docker_files="${matrix_values[2]}" + working_dirs="${matrix_values[3]}" + image_names="${matrix_values[4]}" - echo "Component: $matrix" + echo "Component: $components" echo "Paths: $paths" echo "Dockerfile: $docker_files" echo "Working Directory: $working_dirs" - echo "Image Name: $image_names" - \ No newline at end of file + echo "Image Name: $image_names" \ No newline at end of file From 1231483399a3b873f5b56de6506a5e08574f8a55 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 00:19:15 -0500 Subject: [PATCH 187/202] chore: cleanup --- .github/workflows/dev_backend_asa_pr.yml | 110 ++++++++--------- .../workflows/dev_backend_asa_pr_merge.yml | 74 +++++------ .github/workflows/dev_backend_pr.yml | 28 ++++- .github/workflows/dev_backend_pr_merge.yml | 21 ++++ .github/workflows/test_matrix.yml | 116 +++++++++--------- 5 files changed, 198 insertions(+), 151 deletions(-) diff --git a/.github/workflows/dev_backend_asa_pr.yml b/.github/workflows/dev_backend_asa_pr.yml index d570e0d8ee..ce1eb9b01e 100644 --- a/.github/workflows/dev_backend_asa_pr.yml +++ b/.github/workflows/dev_backend_asa_pr.yml @@ -1,62 +1,62 @@ -name: Dev BE ASA Pull Request +# name: Dev BE ASA Pull Request -on: - workflow_dispatch: - pull_request: - branches: - - development - paths: - - backend/models/** - - backend/ops_api/** - - backend/Dockerfile.ops-api +# on: +# workflow_dispatch: +# pull_request: +# branches: +# - development +# 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" +# 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 +# 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 }} +# - 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-deploy: - needs: build - permissions: - pull-requests: write +# plan-deploy: +# needs: build +# permissions: +# pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 +# 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 }}" - } +# - 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 }}" +# } diff --git a/.github/workflows/dev_backend_asa_pr_merge.yml b/.github/workflows/dev_backend_asa_pr_merge.yml index 99a18c8cc1..62cb59ed79 100644 --- a/.github/workflows/dev_backend_asa_pr_merge.yml +++ b/.github/workflows/dev_backend_asa_pr_merge.yml @@ -1,41 +1,41 @@ -name: Dev BE ASA Pull Request Merged +# name: Dev BE ASA Pull Request Merged -on: - workflow_dispatch: - pull_request: - types: - - closed - branches: - - development - paths: - - backend/models/** - - backend/ops_api/** - - backend/Dockerfile.ops-api +# on: +# workflow_dispatch: +# pull_request: +# types: +# - closed +# branches: +# - development +# 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" +# 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 +# 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 }}_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 }}_asa_pr.yml +# - 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 }}_asa_pr.yml diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index a245516b85..24c9c8bb28 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -35,7 +35,7 @@ jobs: dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DOCKER_FILE }} image_tag: ${{ github.sha }} - plan-deploy: + plan-backend-deploy: needs: build permissions: pull-requests: write @@ -60,3 +60,29 @@ jobs: "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 }}" + } \ No newline at end of file diff --git a/.github/workflows/dev_backend_pr_merge.yml b/.github/workflows/dev_backend_pr_merge.yml index 3ab31683a2..9123fb5873 100644 --- a/.github/workflows/dev_backend_pr_merge.yml +++ b/.github/workflows/dev_backend_pr_merge.yml @@ -39,3 +39,24 @@ jobs: 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 }}_asa_pr.yml diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml index 3d54140490..23ed80e683 100644 --- a/.github/workflows/test_matrix.yml +++ b/.github/workflows/test_matrix.yml @@ -1,68 +1,68 @@ -name: Build Components +# name: Build Components -on: - push: - branches: - - development - pull_request: - branches: - - development +# on: +# push: +# branches: +# - development +# pull_request: +# branches: +# - development -jobs: - set-matrix: - runs-on: ubuntu-latest +# jobs: +# set-matrix: +# runs-on: ubuntu-latest - strategy: - matrix: - event: ["push", "pull_request"] +# strategy: +# matrix: +# event: ["push", "pull_request"] - steps: - - name: Checkout Repository - uses: actions/checkout@v2 +# steps: +# - name: Checkout Repository +# uses: actions/checkout@v2 - - name: Set Matrix and Build - id: set-matrix - uses: ./.github/actions/test_matrix - with: - event: ${{ matrix.event }} +# - name: Set Matrix and Build +# id: set-matrix +# uses: ./.github/actions/test_matrix +# with: +# event: ${{ matrix.event }} - # use-matrix: - # needs: set-matrix - # runs-on: ubuntu-latest - # strategy: - # matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}} - # steps: - # - name: Use matrix - # run: | - # matrix="${{ matrix }}" - # paths="${{ matrix.paths }}" - # docker_files="${{ matrix.docker_files }}" - # working_dirs="${{ matrix.working_dirs }}" - # image_names="${{ matrix.image_names }}" +# # use-matrix: +# # needs: set-matrix +# # runs-on: ubuntu-latest +# # strategy: +# # matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}} +# # steps: +# # - name: Use matrix +# # run: | +# # matrix="${{ matrix }}" +# # paths="${{ matrix.paths }}" +# # docker_files="${{ matrix.docker_files }}" +# # working_dirs="${{ matrix.working_dirs }}" +# # image_names="${{ matrix.image_names }}" - # echo "Component: $matrix" - # echo "Paths: $paths" - # echo "Dockerfile: $docker_files" - # echo "Working Directory: $working_dirs" - # echo "Image Name: $image_names" +# # echo "Component: $matrix" +# # echo "Paths: $paths" +# # echo "Dockerfile: $docker_files" +# # echo "Working Directory: $working_dirs" +# # echo "Image Name: $image_names" - use-matrix: - needs: set-matrix - runs-on: ubuntu-latest - steps: - - name: Use matrix - run: | - matrix="${{ needs.set-matrix.outputs.matrix }}" - IFS='::' read -ra matrix_values <<< "$matrix" +# use-matrix: +# needs: set-matrix +# runs-on: ubuntu-latest +# steps: +# - name: Use matrix +# run: | +# matrix="${{ needs.set-matrix.outputs.matrix }}" +# IFS='::' read -ra matrix_values <<< "$matrix" - components="${matrix_values[0]}" - paths="${matrix_values[1]}" - docker_files="${matrix_values[2]}" - working_dirs="${matrix_values[3]}" - image_names="${matrix_values[4]}" +# components="${matrix_values[0]}" +# paths="${matrix_values[1]}" +# docker_files="${matrix_values[2]}" +# working_dirs="${matrix_values[3]}" +# image_names="${matrix_values[4]}" - echo "Component: $components" - echo "Paths: $paths" - echo "Dockerfile: $docker_files" - echo "Working Directory: $working_dirs" - echo "Image Name: $image_names" \ No newline at end of file +# echo "Component: $components" +# echo "Paths: $paths" +# echo "Dockerfile: $docker_files" +# echo "Working Directory: $working_dirs" +# echo "Image Name: $image_names" \ No newline at end of file From 79ed595f2b77bbc7936937d47f1a0bae370a9d4f Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 28 Dec 2023 00:21:39 -0500 Subject: [PATCH 188/202] Update Dockerfile.ops-api --- backend/Dockerfile.ops-api | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index 532c220b12..6d27dc4af9 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -24,3 +24,4 @@ ENV FLASK_DEBUG=true ## This is to attempt fixing the worker issues CMD ["python", "-m", "gunicorn", "--timeout", "1000", "--workers", "1", "--threads", "4", "-b", ":8080", "ops_api.ops:create_app()"] ## --timeout 1000 --workers 1 --threads 4 +# From fc8477bcd7cb42490ae8658a5c66072da99cf921 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 00:31:46 -0500 Subject: [PATCH 189/202] chore: cleanup --- .github/workflows/dev_backend_pr_merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_backend_pr_merge.yml b/.github/workflows/dev_backend_pr_merge.yml index 9123fb5873..a440be8f15 100644 --- a/.github/workflows/dev_backend_pr_merge.yml +++ b/.github/workflows/dev_backend_pr_merge.yml @@ -59,4 +59,4 @@ jobs: 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 }}_asa_pr.yml + plan_workflow_file: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml From 7a49471e460817039675e50ca55189e42cf16abc Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 09:50:56 -0500 Subject: [PATCH 190/202] chore: consolidating builds --- .github/actions/tf-apply/action.yaml | 2 +- .github/actions/tf-plan/action.yaml | 2 +- .github/workflows/dev_frontend_asa_pr.yml | 158 +++++++++--------- .../workflows/dev_frontend_asa_pr_merge.yml | 86 +++++----- .github/workflows/dev_frontend_pr.yml | 72 ++++++++ .github/workflows/dev_frontend_pr_merge.yml | 31 ++++ 6 files changed, 227 insertions(+), 124 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index c6066ac42a..54125dc616 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -78,7 +78,7 @@ runs: github_token: ${{ inputs.github_token }} workflow: ${{ inputs.plan_workflow_file }} pr: ${{ inputs.pr_id }} - name: ${{ inputs.pr_id }}-tf-plan + name: ${{ inputs.terraform_directory }}/${{ inputs.pr_id }}-tf-plan path: ${{ inputs.terraform_directory }} # - name: Terraform Apply diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index f576ed67ea..cfe6a74ad3 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -85,7 +85,7 @@ runs: id: save-artifact uses: actions/upload-artifact@v3 with: - name: ${{ inputs.pr_id }}-tf-plan + name: ${{ inputs.terraform_directory }}/${{ inputs.pr_id }}-tf-plan path: ${{ inputs.terraform_directory }}/tfplan - name: Comment Plan diff --git a/.github/workflows/dev_frontend_asa_pr.yml b/.github/workflows/dev_frontend_asa_pr.yml index d4cc055f4c..52f30e1076 100644 --- a/.github/workflows/dev_frontend_asa_pr.yml +++ b/.github/workflows/dev_frontend_asa_pr.yml @@ -1,91 +1,91 @@ -name: Dev FE ASA Pull Request +# name: Dev FE ASA Pull Request -on: - pull_request: - branches: - - development - paths: - - 'frontend/**' +# on: +# pull_request: +# branches: +# - development +# paths: +# - 'frontend/**' -env: - TERRAFORM_VERSION: "1.5.7" - TF_IN_AUTOMATION: "True" - ENVIRONMENT: "dev" - WORKING_DIR: "frontend" +# env: +# TERRAFORM_VERSION: "1.5.7" +# TF_IN_AUTOMATION: "True" +# ENVIRONMENT: "dev" +# WORKING_DIR: "frontend" -jobs: - build: - permissions: - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 +# jobs: +# build: +# permissions: +# pull-requests: write +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - - name: Setup Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: latest +# - name: Setup Bun +# uses: oven-sh/setup-bun@v1 +# with: +# bun-version: latest - - name: Install dependencies - working-directory: ${{ env.WORKING_DIR }} - run: bun install +# - name: Install dependencies +# working-directory: ${{ env.WORKING_DIR }} +# run: bun install - # - name: Build Frontend - # working-directory: ${{ env.WORKING_DIR }} - # run: bun run build +# # - name: Build Frontend +# # working-directory: ${{ env.WORKING_DIR }} +# # run: bun run build - - name: Build Bun - uses: ./.github/actions/tf-apply - with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa/build_bun" - 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 }}", - "commit_hash": "${{ github.event.pull_request.number }}", - "frontend_dir": "../../../../../frontend" - } +# - name: Build Bun +# uses: ./.github/actions/tf-apply +# with: +# terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa/build_bun" +# 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 }}", +# "commit_hash": "${{ github.event.pull_request.number }}", +# "frontend_dir": "../../../../../frontend" +# } - - name: Archive Artifacts - uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0 - with: - name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} - path: ${{ env.WORKING_DIR }}/build +# - name: Archive Artifacts +# uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0 +# with: +# name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} +# path: ${{ env.WORKING_DIR }}/build - plan-deploy: - needs: build - permissions: - pull-requests: write +# plan-deploy: +# needs: build +# permissions: +# pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - - name: Download Frontend Artifacts - uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 #v4.1 - with: - name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} - path: ${{ env.WORKING_DIR }}/build +# - name: Download Frontend Artifacts +# uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 #v4.1 +# with: +# name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} +# path: ${{ env.WORKING_DIR }}/build - - name: Terraform Plan - uses: ./.github/actions/tf-plan - with: - terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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 }}", - "commit_hash": "${{ github.event.pull_request.number }}" - } +# - name: Terraform Plan +# uses: ./.github/actions/tf-plan +# with: +# terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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 }}", +# "commit_hash": "${{ github.event.pull_request.number }}" +# } diff --git a/.github/workflows/dev_frontend_asa_pr_merge.yml b/.github/workflows/dev_frontend_asa_pr_merge.yml index 34fd95fe67..4d43180787 100644 --- a/.github/workflows/dev_frontend_asa_pr_merge.yml +++ b/.github/workflows/dev_frontend_asa_pr_merge.yml @@ -1,48 +1,48 @@ -name: Dev FE ASA Pull Request Merged +# name: Dev FE ASA Pull Request Merged -on: - pull_request: - types: - - closed - branches: - - development - paths: - - 'frontend/**' +# on: +# pull_request: +# types: +# - closed +# branches: +# - development +# paths: +# - 'frontend/**' -env: - TERRAFORM_VERSION: "1.5.7" - TF_IN_AUTOMATION: "True" - ENVIRONMENT: "dev" - WORKING_DIR: "frontend" +# env: +# TERRAFORM_VERSION: "1.5.7" +# TF_IN_AUTOMATION: "True" +# ENVIRONMENT: "dev" +# WORKING_DIR: "frontend" -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 +# 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: Load Archived build - id: download-plan - uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d #v3.0.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_asa_pr.yml - pr: ${{ github.event.pull_request.number }} - name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} - path: ${{ env.WORKING_DIR }}/build +# - name: Load Archived build +# id: download-plan +# uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d #v3.0.0 +# with: +# github_token: ${{ secrets.GITHUB_TOKEN }} +# workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_asa_pr.yml +# pr: ${{ github.event.pull_request.number }} +# name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} +# path: ${{ env.WORKING_DIR }}/build - - 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 }}_asa_pr.yml +# - 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 }}_asa_pr.yml diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index c99ba50686..632d5846b6 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -32,6 +32,46 @@ jobs: dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DOCKER_FILE }} image_tag: ${{ github.sha }} + build-asa: + permissions: + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + + - name: Install dependencies + working-directory: ${{ env.WORKING_DIR }} + run: bun install + + - name: Build Bun + uses: ./.github/actions/tf-apply + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa/build_bun" + 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 }}", + "commit_hash": "${{ github.event.pull_request.number }}", + "frontend_dir": "../../../../../frontend" + } + + - name: Archive Artifacts + uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0 + with: + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} + path: ${{ env.WORKING_DIR }}/build + plan-deploy: needs: build permissions: @@ -57,3 +97,35 @@ jobs: "environment": "${{ env.ENVIRONMENT }}", "container_tag": "${{ github.sha }}" } + + plan-asa-deploy: + needs: build-asa + permissions: + pull-requests: write + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 + + - name: Download Frontend Artifacts + uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 #v4.1 + with: + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} + path: ${{ env.WORKING_DIR }}/build + + - name: Terraform Plan + uses: ./.github/actions/tf-plan + with: + terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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 }}", + "commit_hash": "${{ github.event.pull_request.number }}" + } \ No newline at end of file diff --git a/.github/workflows/dev_frontend_pr_merge.yml b/.github/workflows/dev_frontend_pr_merge.yml index 6df666af40..fcdb6a6d94 100644 --- a/.github/workflows/dev_frontend_pr_merge.yml +++ b/.github/workflows/dev_frontend_pr_merge.yml @@ -36,3 +36,34 @@ jobs: 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: Load Archived build + id: download-plan + uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d #v3.0.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml + pr: ${{ github.event.pull_request.number }} + name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} + path: ${{ env.WORKING_DIR }}/build + + - 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 }}_asa_pr.yml From 6284bb63381777801d4c1d29e1024d1372cdbc14 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 10:04:09 -0500 Subject: [PATCH 191/202] chore: giving work dir specific names --- .github/actions/tf-apply/action.yaml | 9 ++++++++- .github/actions/tf-plan/action.yaml | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 54125dc616..7b898b01c3 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -36,6 +36,13 @@ inputs: 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 "Last directory name is: $last_dir" + shell: bash + - name: Set Terraform Variables run: | if [[ -n "${INPUT_TF_VARS}" ]]; then @@ -78,7 +85,7 @@ runs: github_token: ${{ inputs.github_token }} workflow: ${{ inputs.plan_workflow_file }} pr: ${{ inputs.pr_id }} - name: ${{ inputs.terraform_directory }}/${{ inputs.pr_id }}-tf-plan + name: ${{ inputs.pr_id }}-${{ steps.get-tf-dir.outputs.tf-dir }}-tf-plan path: ${{ inputs.terraform_directory }} # - name: Terraform Apply diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index cfe6a74ad3..b72283a098 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -33,6 +33,13 @@ inputs: 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 "Last directory name is: $last_dir" + shell: bash + - name: Set Terraform Variables run: | if [[ -n "${INPUT_TF_VARS}" ]]; then @@ -85,7 +92,7 @@ runs: id: save-artifact uses: actions/upload-artifact@v3 with: - name: ${{ inputs.terraform_directory }}/${{ inputs.pr_id }}-tf-plan + name: ${{ inputs.pr_id }}-${{ steps.get-tf-dir.outputs.tf-dir }}-tf-plan path: ${{ inputs.terraform_directory }}/tfplan - name: Comment Plan From 7ff6927d3e3586495284fc2c52385b9e5a9a49fe Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 10:07:38 -0500 Subject: [PATCH 192/202] chore: indentation issues --- .github/actions/tf-apply/action.yaml | 10 +++++----- .github/actions/tf-plan/action.yaml | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 7b898b01c3..172fa0036a 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -37,12 +37,12 @@ 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 "Last directory name is: $last_dir" + id: get-tf-dir + run: | + tf-dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) + echo "Last directory name is: $last_dir" shell: bash - + - name: Set Terraform Variables run: | if [[ -n "${INPUT_TF_VARS}" ]]; then diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index b72283a098..77994e8de4 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -34,10 +34,10 @@ 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 "Last directory name is: $last_dir" + id: get-tf-dir + run: | + tf-dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) + echo "Last directory name is: $last_dir" shell: bash - name: Set Terraform Variables From 161473cb8216ccd20dce9f43d69f1813b6d69454 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 10:15:20 -0500 Subject: [PATCH 193/202] chore: cleanup --- .github/actions/tf-apply/action.yaml | 6 +++--- .github/actions/tf-plan/action.yaml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 172fa0036a..0aba8149fc 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -39,8 +39,8 @@ runs: - name: Get last directory name id: get-tf-dir run: | - tf-dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) - echo "Last directory name is: $last_dir" + tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) + echo "Last directory name is: $tf_dir" shell: bash - name: Set Terraform Variables @@ -85,7 +85,7 @@ runs: 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 + name: ${{ inputs.pr_id }}-${{ steps.get-tf-dir.outputs.tf_dir }}-tf-plan path: ${{ inputs.terraform_directory }} # - name: Terraform Apply diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index 77994e8de4..4fc380576d 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -36,8 +36,8 @@ runs: - name: Get last directory name id: get-tf-dir run: | - tf-dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) - echo "Last directory name is: $last_dir" + tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) + echo "Last directory name is: $tf_dir" shell: bash - name: Set Terraform Variables @@ -92,7 +92,7 @@ runs: id: save-artifact uses: actions/upload-artifact@v3 with: - name: ${{ inputs.pr_id }}-${{ steps.get-tf-dir.outputs.tf-dir }}-tf-plan + name: ${{ inputs.pr_id }}-${{ steps.get-tf-dir.outputs.tf_dir }}-tf-plan path: ${{ inputs.terraform_directory }}/tfplan - name: Comment Plan From 0e1efca37e6e62a31c9c8566c3e05bc6ff24a670 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 10:22:57 -0500 Subject: [PATCH 194/202] chore: set to output --- .github/actions/tf-apply/action.yaml | 3 +-- .github/actions/tf-plan/action.yaml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 0aba8149fc..a4d37b46b5 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -39,8 +39,7 @@ runs: - name: Get last directory name id: get-tf-dir run: | - tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) - echo "Last directory name is: $tf_dir" + tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) >> $GITHUB_OUTPUT shell: bash - name: Set Terraform Variables diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index 4fc380576d..b82c2c1924 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -36,8 +36,7 @@ runs: - name: Get last directory name id: get-tf-dir run: | - tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) - echo "Last directory name is: $tf_dir" + tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) >> $GITHUB_OUTPUT shell: bash - name: Set Terraform Variables From 523d834f269ca426ed3a009c9531bc1b52f0b3f9 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 10:36:55 -0500 Subject: [PATCH 195/202] chore: trying to get output --- .github/actions/tf-apply/action.yaml | 3 ++- .github/actions/tf-plan/action.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index a4d37b46b5..182c905e7b 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -39,7 +39,8 @@ runs: - name: Get last directory name id: get-tf-dir run: | - tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) >> $GITHUB_OUTPUT + tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) + echo "tf_dir=$tf_dir" >> $GITHUB_OUTPUT shell: bash - name: Set Terraform Variables diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index b82c2c1924..1312555920 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -36,7 +36,8 @@ runs: - name: Get last directory name id: get-tf-dir run: | - tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) >> $GITHUB_OUTPUT + tf_dir=$(echo ${{ inputs.terraform_directory }} | rev | cut -d'/' -f1 | rev) + echo "tf_dir=$tf_dir" >> $GITHUB_OUTPUT shell: bash - name: Set Terraform Variables From 8126fa3acc6ccd688c6622e449ea76b40377538a Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 10:43:31 -0500 Subject: [PATCH 196/202] chore: typo --- .github/workflows/dev_frontend_pr_merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev_frontend_pr_merge.yml b/.github/workflows/dev_frontend_pr_merge.yml index fcdb6a6d94..56df01e253 100644 --- a/.github/workflows/dev_frontend_pr_merge.yml +++ b/.github/workflows/dev_frontend_pr_merge.yml @@ -66,4 +66,4 @@ jobs: 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 }}_asa_pr.yml + plan_workflow_file: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_pr.yml From 4e4fe09c204cc5763482ed6a56aa1169fb1ddab4 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 28 Dec 2023 10:49:43 -0500 Subject: [PATCH 197/202] chore: cleanup --- .github/actions/test_matrix/action.yaml | 97 ------------------- .github/workflows/dev_backend_asa_pr.yml | 62 ------------ .../workflows/dev_backend_asa_pr_merge.yml | 41 -------- .github/workflows/dev_frontend_asa_pr.yml | 91 ----------------- .../workflows/dev_frontend_asa_pr_merge.yml | 48 --------- .github/workflows/test_matrix.yml | 68 ------------- 6 files changed, 407 deletions(-) delete mode 100644 .github/actions/test_matrix/action.yaml delete mode 100644 .github/workflows/dev_backend_asa_pr.yml delete mode 100644 .github/workflows/dev_backend_asa_pr_merge.yml delete mode 100644 .github/workflows/dev_frontend_asa_pr.yml delete mode 100644 .github/workflows/dev_frontend_asa_pr_merge.yml delete mode 100644 .github/workflows/test_matrix.yml diff --git a/.github/actions/test_matrix/action.yaml b/.github/actions/test_matrix/action.yaml deleted file mode 100644 index 5ba7e093e6..0000000000 --- a/.github/actions/test_matrix/action.yaml +++ /dev/null @@ -1,97 +0,0 @@ -name: 'Build Matrix' - -description: 'Builds components based on matrix configuration' - -inputs: - event: # Event type (e.g., push, pull_request) - required: true - -outputs: - matrix: - description: "Matrix" - value: ${{ steps.set-matrix.outputs.matrix }} - -runs: - using: 'composite' - steps: - - name: Check Event Type - id: check-event - run: | - if [ "${{ inputs.event }}" != "push" ] && [ "${{ inputs.event }}" != "pull_request" ]; then - echo "Invalid event type. Only 'push' and 'pull_request' are supported." - exit 1 - fi - shell: bash - - - name: Set Matrix Outputs - id: set-matrix - run: | - if [ "$GITHUB_BASE_REF" ]; then - # Pull Request - git fetch origin $GITHUB_BASE_REF --depth=1 - export DIFF=$(git diff --name-only origin/$GITHUB_BASE_REF $GITHUB_SHA) - echo "Diff between origin/$GITHUB_BASE_REF and $GITHUB_SHA" - else - # Push - git fetch origin ${{ github.event.before }} --depth=1 - export DIFF=$(git diff --name-only ${{ github.event.before }} $GITHUB_SHA) - echo "Diff between ${{ github.event.before }} and $GITHUB_SHA" - fi - - components=() - paths=() - docker_files=() - working_dirs=() - image_names=() - - # Function to add a component - add_component() { - components+=("$1") - paths+=("$2") - docker_files+=("$3") - working_dirs+=("$4") - image_names+=("$5") - } - - # Check if paths of each component are in the changed files - if echo "$DIFF" | grep -qE 'backend/models/|backend/ops_api/|backend/Dockerfile.ops-api'; then - echo "DEBUG: Detected changes for Backend" - add_component "Backend" "backend/models/** backend/ops_api/** backend/Dockerfile.ops-api" "Dockerfile.ops-api" "backend" "ops-backend" - else - echo "DEBUG: No changes detected for Backend" - fi - - if echo "$DIFF" | grep -qE 'backend/data-tools/|backend/Dockerfile.data-tools'; then - echo "DEBUG: Detected changes for Data-Tools" - add_component "Data-Tools" "backend/data-tools/** backend/Dockerfile.data-tools" "Dockerfile.data-tools" "backend" "ops-data-tools" - else - echo "DEBUG: No changes detected for Data-Tools" - fi - - if echo "$DIFF" | grep -qE 'frontend/|frontend/Dockerfile.azure'; then - echo "DEBUG: Detected changes for Frontend" - add_component "Frontend" "frontend/** frontend/Dockerfile.azure" "Dockerfile.azure" "frontend" "ops-frontend" - else - echo "DEBUG: No changes detected for Frontend" - fi - - # Debug statements - echo "DEBUG: DIFF variable content:" - echo "$DIFF" - - # Debug statements for matrix components - echo "DEBUG: Components: ${components[@]}" - echo "DEBUG: Paths: ${paths[@]}" - echo "DEBUG: Docker Files: ${docker_files[@]}" - echo "DEBUG: Working Directories: ${working_dirs[@]}" - echo "DEBUG: Image Names: ${image_names[@]}" - - # # Set matrix outputs as JSON - # matrix_json="{\"components\":\"${components[@]}\",\"paths\":\"${paths[@]}\",\"docker_files\":\"${docker_files[@]}\",\"working_dirs\":\"${working_dirs[@]}\",\"image_names\":\"${image_names[@]}\"}" - # echo "DEBUG: Raw matrix output: $matrix_json" - # echo "::set-output name=matrix::$(echo "$matrix_json" | jq -c)" - # Set matrix outputs as JSON - echo "matrix=${components[@]}::${paths[@]}::${docker_files[@]}::${working_dirs[@]}::${image_names[@]}" >> $GITHUB_ENV - - - shell: bash diff --git a/.github/workflows/dev_backend_asa_pr.yml b/.github/workflows/dev_backend_asa_pr.yml deleted file mode 100644 index ce1eb9b01e..0000000000 --- a/.github/workflows/dev_backend_asa_pr.yml +++ /dev/null @@ -1,62 +0,0 @@ -# name: Dev BE ASA Pull Request - -# on: -# workflow_dispatch: -# pull_request: -# branches: -# - development -# 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-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 }}" -# } diff --git a/.github/workflows/dev_backend_asa_pr_merge.yml b/.github/workflows/dev_backend_asa_pr_merge.yml deleted file mode 100644 index 62cb59ed79..0000000000 --- a/.github/workflows/dev_backend_asa_pr_merge.yml +++ /dev/null @@ -1,41 +0,0 @@ -# name: Dev BE ASA Pull Request Merged - -# on: -# workflow_dispatch: -# pull_request: -# types: -# - closed -# branches: -# - development -# 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 }}_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 }}_asa_pr.yml diff --git a/.github/workflows/dev_frontend_asa_pr.yml b/.github/workflows/dev_frontend_asa_pr.yml deleted file mode 100644 index 52f30e1076..0000000000 --- a/.github/workflows/dev_frontend_asa_pr.yml +++ /dev/null @@ -1,91 +0,0 @@ -# name: Dev FE ASA Pull Request - -# on: -# pull_request: -# branches: -# - development -# paths: -# - 'frontend/**' - -# env: -# TERRAFORM_VERSION: "1.5.7" -# TF_IN_AUTOMATION: "True" -# ENVIRONMENT: "dev" -# WORKING_DIR: "frontend" - -# jobs: -# build: -# permissions: -# pull-requests: write -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - -# - name: Setup Bun -# uses: oven-sh/setup-bun@v1 -# with: -# bun-version: latest - -# - name: Install dependencies -# working-directory: ${{ env.WORKING_DIR }} -# run: bun install - -# # - name: Build Frontend -# # working-directory: ${{ env.WORKING_DIR }} -# # run: bun run build - -# - name: Build Bun -# uses: ./.github/actions/tf-apply -# with: -# terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/${{ env.WORKING_DIR }}_asa/build_bun" -# 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 }}", -# "commit_hash": "${{ github.event.pull_request.number }}", -# "frontend_dir": "../../../../../frontend" -# } - -# - name: Archive Artifacts -# uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4.0.0 -# with: -# name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} -# path: ${{ env.WORKING_DIR }}/build - -# plan-deploy: -# needs: build -# permissions: -# pull-requests: write - -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - -# - name: Download Frontend Artifacts -# uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 #v4.1 -# with: -# name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} -# path: ${{ env.WORKING_DIR }}/build - -# - name: Terraform Plan -# uses: ./.github/actions/tf-plan -# with: -# terraform_directory: "terraform/eus/${{ env.ENVIRONMENT }}/frontend_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 }}", -# "commit_hash": "${{ github.event.pull_request.number }}" -# } diff --git a/.github/workflows/dev_frontend_asa_pr_merge.yml b/.github/workflows/dev_frontend_asa_pr_merge.yml deleted file mode 100644 index 4d43180787..0000000000 --- a/.github/workflows/dev_frontend_asa_pr_merge.yml +++ /dev/null @@ -1,48 +0,0 @@ -# name: Dev FE ASA Pull Request Merged - -# on: -# pull_request: -# types: -# - closed -# branches: -# - development -# paths: -# - 'frontend/**' - -# env: -# TERRAFORM_VERSION: "1.5.7" -# TF_IN_AUTOMATION: "True" -# ENVIRONMENT: "dev" -# WORKING_DIR: "frontend" - -# 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: Load Archived build -# id: download-plan -# uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d #v3.0.0 -# with: -# github_token: ${{ secrets.GITHUB_TOKEN }} -# workflow: ${{ env.ENVIRONMENT }}_${{ env.WORKING_DIR }}_asa_pr.yml -# pr: ${{ github.event.pull_request.number }} -# name: ${{ env.WORKING_DIR }}-${{ env.ENVIRONMENT }}-build-${{ github.event.pull_request.number }} -# path: ${{ env.WORKING_DIR }}/build - -# - 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 }}_asa_pr.yml diff --git a/.github/workflows/test_matrix.yml b/.github/workflows/test_matrix.yml deleted file mode 100644 index 23ed80e683..0000000000 --- a/.github/workflows/test_matrix.yml +++ /dev/null @@ -1,68 +0,0 @@ -# name: Build Components - -# on: -# push: -# branches: -# - development -# pull_request: -# branches: -# - development - -# jobs: -# set-matrix: -# runs-on: ubuntu-latest - -# strategy: -# matrix: -# event: ["push", "pull_request"] - -# steps: -# - name: Checkout Repository -# uses: actions/checkout@v2 - -# - name: Set Matrix and Build -# id: set-matrix -# uses: ./.github/actions/test_matrix -# with: -# event: ${{ matrix.event }} - -# # use-matrix: -# # needs: set-matrix -# # runs-on: ubuntu-latest -# # strategy: -# # matrix: ${{fromJson(needs.set-matrix.outputs.matrix)}} -# # steps: -# # - name: Use matrix -# # run: | -# # matrix="${{ matrix }}" -# # paths="${{ matrix.paths }}" -# # docker_files="${{ matrix.docker_files }}" -# # working_dirs="${{ matrix.working_dirs }}" -# # image_names="${{ matrix.image_names }}" - -# # echo "Component: $matrix" -# # echo "Paths: $paths" -# # echo "Dockerfile: $docker_files" -# # echo "Working Directory: $working_dirs" -# # echo "Image Name: $image_names" - -# use-matrix: -# needs: set-matrix -# runs-on: ubuntu-latest -# steps: -# - name: Use matrix -# run: | -# matrix="${{ needs.set-matrix.outputs.matrix }}" -# IFS='::' read -ra matrix_values <<< "$matrix" - -# components="${matrix_values[0]}" -# paths="${matrix_values[1]}" -# docker_files="${matrix_values[2]}" -# working_dirs="${matrix_values[3]}" -# image_names="${matrix_values[4]}" - -# echo "Component: $components" -# echo "Paths: $paths" -# echo "Dockerfile: $docker_files" -# echo "Working Directory: $working_dirs" -# echo "Image Name: $image_names" \ No newline at end of file From 583e3b1b32a9e20b4c69fcc60ca0eb705826c246 Mon Sep 17 00:00:00 2001 From: Christopher Lindsay Date: Thu, 28 Dec 2023 11:06:42 -0500 Subject: [PATCH 198/202] chore: cleanup version locks --- .github/actions/tf-apply/action.yaml | 23 ++++------------------- .github/actions/tf-plan/action.yaml | 6 +++--- .github/workflows/dev_frontend_pr.yml | 4 ++-- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/.github/actions/tf-apply/action.yaml b/.github/actions/tf-apply/action.yaml index 182c905e7b..b73dd4c3c5 100644 --- a/.github/actions/tf-apply/action.yaml +++ b/.github/actions/tf-apply/action.yaml @@ -60,7 +60,7 @@ runs: INPUT_TF_VARS: ${{ inputs.tf_vars }} - name: Setup Terraform - uses: hashicorp/setup-terraform@v2 + uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 #v3.0.0 with: terraform_version: ${{ inputs.terraform_version }} terraform_wrapper: false @@ -80,7 +80,7 @@ runs: - name: Download Plan id: download-plan if: ${{ inputs.plan_workflow_file != '' }} - uses: dawidd6/action-download-artifact@v2 + uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d #v3.0.0 with: github_token: ${{ inputs.github_token }} workflow: ${{ inputs.plan_workflow_file }} @@ -88,20 +88,6 @@ runs: 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<> $GITHUB_OUTPUT - # terraform apply -input=false -no-color tfplan >> $GITHUB_OUTPUT - # echo 'EOF' >> $GITHUB_OUTPUT - - name: Terraform Apply id: apply working-directory: ${{ inputs.terraform_directory }} @@ -120,11 +106,10 @@ runs: fi echo 'EOF' >> $GITHUB_OUTPUT - - name: Comment Apply id: comment-apply if: ${{ inputs.pr_id != '' }} - uses: peter-evans/create-or-update-comment@v2 + uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 #v3.1.0 with: token: ${{ inputs.github_token }} issue-number: ${{ inputs.pr_id }} @@ -133,4 +118,4 @@ runs: ``` ${{ steps.apply.outputs.apply }} - ``` \ No newline at end of file + ``` diff --git a/.github/actions/tf-plan/action.yaml b/.github/actions/tf-plan/action.yaml index 1312555920..e97980d6aa 100644 --- a/.github/actions/tf-plan/action.yaml +++ b/.github/actions/tf-plan/action.yaml @@ -57,7 +57,7 @@ runs: INPUT_TF_VARS: ${{ inputs.tf_vars }} - name: Setup Terraform - uses: hashicorp/setup-terraform@v2 + uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 #v3.0.0 with: terraform_version: ${{ inputs.terraform_version }} terraform_wrapper: false @@ -90,14 +90,14 @@ runs: - name: Save Artifact id: save-artifact - uses: actions/upload-artifact@v3 + 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@v2 + uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 #v3.1.0 with: token: ${{ inputs.github_token }} issue-number: ${{ inputs.pr_id }} diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index 632d5846b6..f1da601eb4 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -40,9 +40,9 @@ jobs: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 - name: Setup Bun - uses: oven-sh/setup-bun@v1 + uses: oven-sh/setup-bun@9b21598af8d4dfc302e5a30250007de0fda92acc #v1.1.1 with: - bun-version: latest + bun-version: 1.0.15 - name: Install dependencies working-directory: ${{ env.WORKING_DIR }} From 06e20e94a8220a840472d26a1008c0d4077c61ba Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 28 Dec 2023 11:08:46 -0500 Subject: [PATCH 199/202] Update index.js --- frontend/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/index.js b/frontend/index.js index 018e5d161e..e701866392 100644 --- a/frontend/index.js +++ b/frontend/index.js @@ -20,6 +20,5 @@ Bun.serve({ let filePath = BASE_PATH + "/index.html"; const file = Bun.file(filePath); return new Response(file); - // return new Response(null, { status: 404 }); }, }); From 0244b2f5e50999a006c6604f1929e6e302972f27 Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Thu, 28 Dec 2023 11:12:03 -0500 Subject: [PATCH 200/202] Update Dockerfile.ops-api --- backend/Dockerfile.ops-api | 1 - 1 file changed, 1 deletion(-) diff --git a/backend/Dockerfile.ops-api b/backend/Dockerfile.ops-api index 6d27dc4af9..532c220b12 100644 --- a/backend/Dockerfile.ops-api +++ b/backend/Dockerfile.ops-api @@ -24,4 +24,3 @@ ENV FLASK_DEBUG=true ## This is to attempt fixing the worker issues CMD ["python", "-m", "gunicorn", "--timeout", "1000", "--workers", "1", "--threads", "4", "-b", ":8080", "ops_api.ops:create_app()"] ## --timeout 1000 --workers 1 --threads 4 -# From 3b315da7eee3cafd72eb0c8364504a68df11402b Mon Sep 17 00:00:00 2001 From: Chris Lindsay Date: Tue, 2 Jan 2024 16:52:49 -0500 Subject: [PATCH 201/202] chore: set branch trigger --- .github/workflows/dev_backend_pr.yml | 2 +- .github/workflows/dev_backend_pr_merge.yml | 2 +- .github/workflows/dev_frontend_pr.yml | 2 +- .github/workflows/dev_frontend_pr_merge.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dev_backend_pr.yml b/.github/workflows/dev_backend_pr.yml index 24c9c8bb28..48064195c7 100644 --- a/.github/workflows/dev_backend_pr.yml +++ b/.github/workflows/dev_backend_pr.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: pull_request: branches: - - development + - main paths: - backend/models/** - backend/ops_api/** diff --git a/.github/workflows/dev_backend_pr_merge.yml b/.github/workflows/dev_backend_pr_merge.yml index a440be8f15..ff404b6eb5 100644 --- a/.github/workflows/dev_backend_pr_merge.yml +++ b/.github/workflows/dev_backend_pr_merge.yml @@ -6,7 +6,7 @@ on: types: - closed branches: - - development + - main paths: - backend/models/** - backend/ops_api/** diff --git a/.github/workflows/dev_frontend_pr.yml b/.github/workflows/dev_frontend_pr.yml index f1da601eb4..c8492eb4a3 100644 --- a/.github/workflows/dev_frontend_pr.yml +++ b/.github/workflows/dev_frontend_pr.yml @@ -3,7 +3,7 @@ name: Dev FE Pull Request on: pull_request: branches: - - development + - main paths: - 'frontend/**' diff --git a/.github/workflows/dev_frontend_pr_merge.yml b/.github/workflows/dev_frontend_pr_merge.yml index 56df01e253..6c7fc2fbab 100644 --- a/.github/workflows/dev_frontend_pr_merge.yml +++ b/.github/workflows/dev_frontend_pr_merge.yml @@ -5,7 +5,7 @@ on: types: - closed branches: - - development + - main paths: - 'frontend/**' From 3c5b2cef66deefff55464b0b8fa2095d9f07b039 Mon Sep 17 00:00:00 2001 From: Tim Donaworth Date: Wed, 3 Jan 2024 15:46:43 -0500 Subject: [PATCH 202/202] linting --- backend/ops_api/ops/environment/azure/dev.py | 4 +++- backend/ops_api/ops/environment/azure/prod.py | 4 +++- backend/ops_api/ops/environment/azure/staging.py | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/ops_api/ops/environment/azure/dev.py b/backend/ops_api/ops/environment/azure/dev.py index 6881d005ee..078646bf9d 100644 --- a/backend/ops_api/ops/environment/azure/dev.py +++ b/backend/ops_api/ops/environment/azure/dev.py @@ -13,7 +13,9 @@ OPS_FRONTEND_URL = os.getenv("OPS_FRONTEND_URL") -SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" # noqa: B950 +SQLALCHEMY_DATABASE_URI = ( + f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" # noqa: B950 +) AUTHLIB_OAUTH_CLIENTS = { "logingov": { diff --git a/backend/ops_api/ops/environment/azure/prod.py b/backend/ops_api/ops/environment/azure/prod.py index 96954739c8..a65e386d3b 100644 --- a/backend/ops_api/ops/environment/azure/prod.py +++ b/backend/ops_api/ops/environment/azure/prod.py @@ -11,4 +11,6 @@ db_port = os.getenv("PGPORT") db_name = os.getenv("PGDATABASE") -SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" # noqa: B950 +SQLALCHEMY_DATABASE_URI = ( + f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" # noqa: B950 +) diff --git a/backend/ops_api/ops/environment/azure/staging.py b/backend/ops_api/ops/environment/azure/staging.py index 347ab39e6f..708be11b4c 100644 --- a/backend/ops_api/ops/environment/azure/staging.py +++ b/backend/ops_api/ops/environment/azure/staging.py @@ -11,4 +11,6 @@ db_port = os.getenv("PGPORT") db_name = os.getenv("PGDATABASE") -SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" # noqa: B950 +SQLALCHEMY_DATABASE_URI = ( + f"postgresql+psycopg2://{db_username}:{db_password}@{db_host}:{db_port}/{db_name}" # noqa: B950 +)