From 7c41d514fb55e20b3f7a7e20e850d8c8e33acdfe Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Fri, 3 Nov 2023 20:57:19 +0000 Subject: [PATCH 1/7] feat(restart): define YAML pipeline template restarting app services --- terraform/pipeline/restart.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 terraform/pipeline/restart.yml diff --git a/terraform/pipeline/restart.yml b/terraform/pipeline/restart.yml new file mode 100644 index 00000000..cc9113a9 --- /dev/null +++ b/terraform/pipeline/restart.yml @@ -0,0 +1,29 @@ +parameters: + - name: variable_file + type: string + +stages: + - stage: Restart app services + variables: + - template: ${{ parameters.variable_file }} + jobs: + - job: Restart app services + steps: + - task: AzureAppServiceManage@0 + displayName: 'Restart Azure App Service: dev' + inputs: + azureSubscription: deployer + Action: 'Restart Azure App Service' + WebAppName: '$(TF_VAR_AGENCY_CARD)-eligibility-server-dev' + - task: AzureAppServiceManage@0 + displayName: 'Restart Azure App Service: test' + inputs: + azureSubscription: deployer + Action: 'Restart Azure App Service' + WebAppName: '$(TF_VAR_AGENCY_CARD)-eligibility-server-test' + - task: AzureAppServiceManage@0 + displayName: 'Restart Azure App Service: prod' + inputs: + azureSubscription: deployer + Action: 'Restart Azure App Service' + WebAppName: '$(TF_VAR_AGENCY_CARD)-eligibility-server-prod' From 3a825c42e47fec4da01a7d8909092d788cc51c91 Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Fri, 3 Nov 2023 21:13:26 +0000 Subject: [PATCH 2/7] feat: add restart pipeline for MST --- terraform/mst/azure-restart.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 terraform/mst/azure-restart.yml diff --git a/terraform/mst/azure-restart.yml b/terraform/mst/azure-restart.yml new file mode 100644 index 00000000..cbfb55dd --- /dev/null +++ b/terraform/mst/azure-restart.yml @@ -0,0 +1,13 @@ +schedules: + - cron: 0 10 * * * # timezone is UTC + displayName: "Restart app services nightly" + always: true + +pool: + vmImage: ubuntu-latest + +stages: + - template: ../pipeline/restart.yml + parameters: + # path is relative to the template path (see line above) + variable_file: ../mst/azure-vars.yml From 1e2fbbc626de63ee38a1b991cc79a11e7e485015 Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Fri, 3 Nov 2023 21:13:57 +0000 Subject: [PATCH 3/7] feat: add restart pipeline for SBMTD --- terraform/sbmtd/azure-restart.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 terraform/sbmtd/azure-restart.yml diff --git a/terraform/sbmtd/azure-restart.yml b/terraform/sbmtd/azure-restart.yml new file mode 100644 index 00000000..bdd44eae --- /dev/null +++ b/terraform/sbmtd/azure-restart.yml @@ -0,0 +1,13 @@ +schedules: + - cron: 0 10 * * * # timezone is UTC + displayName: "Restart app services nightly" + always: true + +pool: + vmImage: ubuntu-latest + +stages: + - template: ../pipeline/restart.yml + parameters: + # path is relative to the template path (see line above) + variable_file: ../sbmtd/azure-vars.yml From 994e99da31841cbf132bb476628d6c172dc05309 Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Fri, 3 Nov 2023 21:22:12 +0000 Subject: [PATCH 4/7] refactor: schedule triggers require branch filters --- terraform/mst/azure-restart.yml | 3 +++ terraform/sbmtd/azure-restart.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/terraform/mst/azure-restart.yml b/terraform/mst/azure-restart.yml index cbfb55dd..c821897c 100644 --- a/terraform/mst/azure-restart.yml +++ b/terraform/mst/azure-restart.yml @@ -1,6 +1,9 @@ schedules: - cron: 0 10 * * * # timezone is UTC displayName: "Restart app services nightly" + branches: + include: + - refactor/restart-app-services always: true pool: diff --git a/terraform/sbmtd/azure-restart.yml b/terraform/sbmtd/azure-restart.yml index bdd44eae..83659238 100644 --- a/terraform/sbmtd/azure-restart.yml +++ b/terraform/sbmtd/azure-restart.yml @@ -1,6 +1,9 @@ schedules: - cron: 0 10 * * * # timezone is UTC displayName: "Restart app services nightly" + branches: + include: + - refactor/restart-app-services always: true pool: From 673caf7f5b1029101d91ae8c37e213631a1cff02 Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Fri, 3 Nov 2023 21:24:42 +0000 Subject: [PATCH 5/7] fix: stage and job names cannot have spaces --- terraform/pipeline/restart.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/pipeline/restart.yml b/terraform/pipeline/restart.yml index cc9113a9..47747d45 100644 --- a/terraform/pipeline/restart.yml +++ b/terraform/pipeline/restart.yml @@ -3,11 +3,11 @@ parameters: type: string stages: - - stage: Restart app services + - stage: RestartAppServices variables: - template: ${{ parameters.variable_file }} jobs: - - job: Restart app services + - job: Restart steps: - task: AzureAppServiceManage@0 displayName: 'Restart Azure App Service: dev' From d7aa911afbf11b7c3cca8ed0cc8d151402575974 Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Fri, 3 Nov 2023 21:33:37 +0000 Subject: [PATCH 6/7] fix: opt out of PR triggers --- terraform/mst/azure-restart.yml | 2 ++ terraform/sbmtd/azure-restart.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/terraform/mst/azure-restart.yml b/terraform/mst/azure-restart.yml index c821897c..8254128b 100644 --- a/terraform/mst/azure-restart.yml +++ b/terraform/mst/azure-restart.yml @@ -6,6 +6,8 @@ schedules: - refactor/restart-app-services always: true +pr: none + pool: vmImage: ubuntu-latest diff --git a/terraform/sbmtd/azure-restart.yml b/terraform/sbmtd/azure-restart.yml index 83659238..7c160cd9 100644 --- a/terraform/sbmtd/azure-restart.yml +++ b/terraform/sbmtd/azure-restart.yml @@ -6,6 +6,8 @@ schedules: - refactor/restart-app-services always: true +pr: none + pool: vmImage: ubuntu-latest From 2ff282b1a60f38ad495a79ca09e8815301b2ef0e Mon Sep 17 00:00:00 2001 From: Angela Tran Date: Fri, 3 Nov 2023 21:35:05 +0000 Subject: [PATCH 7/7] refactor: update branch to dev for when it's merged in we only need one branch to run this pipeline --- terraform/mst/azure-restart.yml | 2 +- terraform/sbmtd/azure-restart.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/mst/azure-restart.yml b/terraform/mst/azure-restart.yml index 8254128b..e100cecd 100644 --- a/terraform/mst/azure-restart.yml +++ b/terraform/mst/azure-restart.yml @@ -3,7 +3,7 @@ schedules: displayName: "Restart app services nightly" branches: include: - - refactor/restart-app-services + - dev always: true pr: none diff --git a/terraform/sbmtd/azure-restart.yml b/terraform/sbmtd/azure-restart.yml index 7c160cd9..f71e2cbe 100644 --- a/terraform/sbmtd/azure-restart.yml +++ b/terraform/sbmtd/azure-restart.yml @@ -3,7 +3,7 @@ schedules: displayName: "Restart app services nightly" branches: include: - - refactor/restart-app-services + - dev always: true pr: none