diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 91b63e312..ca60b94f0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -7,7 +7,7 @@ on: - "**.js" - "**.py" pull_request: - branches: [dev, test, prod] + branches: [main, test, prod] paths: - "**.js" - "**.py" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e71153d54..95775a033 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: push: branches: - - dev + - main - test - prod diff --git a/.github/workflows/labeler-deploy-dev.yml b/.github/workflows/labeler-deploy-dev.yml index b2441c058..fb072c057 100644 --- a/.github/workflows/labeler-deploy-dev.yml +++ b/.github/workflows/labeler-deploy-dev.yml @@ -2,7 +2,7 @@ name: Label dev deploys on: pull_request: - branches: [dev] + branches: [main] types: [opened] paths: - ".github/workflows/deploy-*.yml" diff --git a/.github/workflows/labeler-docs.yml b/.github/workflows/labeler-docs.yml index 05a6f6f7d..ad5add921 100644 --- a/.github/workflows/labeler-docs.yml +++ b/.github/workflows/labeler-docs.yml @@ -2,7 +2,7 @@ name: Label docs on: pull_request: - branches: [dev] + branches: [main] types: [opened] paths: - 'docs/**' diff --git a/.github/workflows/labeler-infrastructure.yml b/.github/workflows/labeler-infrastructure.yml index bf6090286..cd6c77fcf 100644 --- a/.github/workflows/labeler-infrastructure.yml +++ b/.github/workflows/labeler-infrastructure.yml @@ -2,7 +2,7 @@ name: Label infrastructure on: pull_request: - branches: [dev] + branches: [main] types: [opened] paths: - 'docs/deployment/**' diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml index 49306225b..e675d8db4 100644 --- a/.github/workflows/mkdocs.yml +++ b/.github/workflows/mkdocs.yml @@ -7,17 +7,17 @@ on: types: - completed branches: - - dev + - main pull_request: branches: - - dev + - main paths: - "docs/**" - "mkdocs.yml" - ".github/workflows/mkdocs.yml" push: branches: - - dev + - main paths: - "docs/**" - "mkdocs.yml" @@ -95,7 +95,7 @@ jobs: uses: dawidd6/action-download-artifact@v6 with: workflow: tests-pytest.yml - branch: dev + branch: main event: push name: coverage-report path: docs/tests/coverage diff --git a/.github/workflows/tests-ui.yml b/.github/workflows/tests-ui.yml index 409c9e8c1..f2a8849af 100644 --- a/.github/workflows/tests-ui.yml +++ b/.github/workflows/tests-ui.yml @@ -3,7 +3,7 @@ name: UI & a11y tests on: workflow_dispatch: pull_request: - branches: [dev, test, prod] + branches: [main, test, prod] defaults: run: diff --git a/terraform/azure-pipelines.yml b/terraform/azure-pipelines.yml index 482bb7718..eb2841300 100644 --- a/terraform/azure-pipelines.yml +++ b/terraform/azure-pipelines.yml @@ -3,7 +3,7 @@ trigger: # https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#pr-triggers branches: include: - - dev + - main - test - prod # only run for changes to Terraform files diff --git a/terraform/pipeline/deploy.yml b/terraform/pipeline/deploy.yml index 5e7c34b26..d36c1ff1f 100644 --- a/terraform/pipeline/deploy.yml +++ b/terraform/pipeline/deploy.yml @@ -48,7 +48,7 @@ steps: # service connection environmentServiceNameAzureRM: "${{ parameters.service_connection }}" # the plan is done as part of the apply (below), so don't bother doing it twice - condition: notIn(variables['Build.SourceBranchName'], 'dev', 'test', 'prod') + condition: notIn(variables['Build.SourceBranchName'], 'main', 'test', 'prod') - task: TerraformTaskV3@3 displayName: Terraform apply inputs: @@ -60,4 +60,4 @@ steps: # service connection environmentServiceNameAzureRM: "${{ parameters.service_connection }}" # only run on certain branches - condition: in(variables['Build.SourceBranchName'], 'dev', 'test', 'prod') + condition: in(variables['Build.SourceBranchName'], 'main', 'test', 'prod') diff --git a/terraform/pipeline/workspace.py b/terraform/pipeline/workspace.py index 120d07d93..17bd19c56 100644 --- a/terraform/pipeline/workspace.py +++ b/terraform/pipeline/workspace.py @@ -5,29 +5,32 @@ import sys REASON = os.environ["REASON"] + # the name of the variable that Azure Pipelines uses for the source branch # depends on the type of run, so need to check both SOURCE = os.environ.get("OTHER_SOURCE") or os.environ["INDIVIDUAL_SOURCE"] + TARGET = os.environ["TARGET"] -# the branches that correspond to environments -ENV_BRANCHES = ["dev", "test", "prod"] +# branch to workspace/environment mapping +ENV_BRANCHES = {"main": "dev", "test": "test", "prod": "prod"} if REASON == "PullRequest" and TARGET in ENV_BRANCHES: # it's a pull request against one of the environment branches, so use the # target branch - environment = TARGET + workspace = ENV_BRANCHES[TARGET] elif REASON in ["IndividualCI", "Manual"] and SOURCE in ENV_BRANCHES: # it's being run on one of the environment branches, so use that - environment = SOURCE + workspace = ENV_BRANCHES[SOURCE] else: # default to running against dev - environment = "dev" + workspace = "dev" # matching logic in ../init.sh -workspace = "default" if environment == "prod" else environment +# workspace to service connection mapping +service_connections = {"dev": "Development", "test": "Development", "prod": "Production"} -service_connection = "Production" if environment == "prod" else "Development" +service_connection = service_connections[workspace] # just for troubleshooting if TARGET is not None: