From 14248bca55c06f8d7c0da84fb9c09017b5704504 Mon Sep 17 00:00:00 2001 From: Jay Whitwell <72501756+jay-whitwell@users.noreply.github.com> Date: Tue, 22 Oct 2024 09:24:00 +0100 Subject: [PATCH] LPAL-1324: include PR number (#2163) * LPAL-1324: include PR number * remove unnecessary contains * fix runs-on typo --- .github/workflows/workflow_pr.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow_pr.yml b/.github/workflows/workflow_pr.yml index 76d0c52965..a9849596ea 100644 --- a/.github/workflows/workflow_pr.yml +++ b/.github/workflows/workflow_pr.yml @@ -32,6 +32,7 @@ jobs: outputs: short_sha: ${{ steps.short_sha.outputs.short_sha }} safe_branch_name: ${{ steps.safe_branch_name.outputs.safe }} + workspace_name: ${{ steps.set_workspace_name.outputs.workspace_name }} environment_terraform_version: ${{ steps.terraform_version_environment.outputs.version }} account_terraform_version: ${{ steps.terraform_version_account.outputs.version }} region_terraform_version: ${{ steps.terraform_version_region.outputs.version }} @@ -40,8 +41,11 @@ jobs: - name: Set safe branch name id: safe_branch_name uses: ministryofjustice/opg-github-actions/.github/actions/branch-name@v3.1.0 - with: - length: "15" + + - name: Set workspace name + id: set_workspace_name + run: | + echo "workspace_name=${{ github.event.number }}${{ steps.safe_branch_name.outputs.safe }}" >> $GITHUB_OUTPUT - name: Set output to short SHA id: short_sha @@ -69,8 +73,6 @@ jobs: with: terraform_directory: "./terraform/email" - - terraform_lint: name: TF - Lint needs: @@ -169,7 +171,7 @@ jobs: with: terraform_version: ${{ needs.workflow_variables.outputs.environment_terraform_version }} use_ssh_private_key: true - terraform_workspace: ${{ needs.workflow_variables.outputs.safe_branch_name }} + terraform_workspace: ${{ needs.workflow_variables.outputs.workspace_name }} is_ephemeral: true workspace_manager_aws_account_id: "050256574573" workspace_manager_aws_iam_role: opg-lpa-ci @@ -525,7 +527,7 @@ jobs: - workflow_variables - post_tests_slack_msg environment: - name: "dev_${{ needs.workflow_variables.outputs.safe_branch_name }}" + name: "dev_${{ needs.workflow_variables.outputs.workspace_name }}" url: "https://${{ env.FRONT_URL }}/home" env: FRONT_URL: ${{ needs.terraform_outputs.outputs.front_fqdn }} @@ -533,7 +535,7 @@ jobs: - name: End of Workflow run: | if ${{ contains(needs.terraform_outputs.result, 'success') && contains(needs.post_tests_slack_msg.result, 'success') }}; then - echo "${{ needs.workflow_variables.outputs.safe_branch_name }} PR environment tested, built and deployed" + echo "${{ needs.workflow_variables.outputs.workspace_name }} PR environment tested, built and deployed" echo "Tag Deployed: ${{ needs.workflow_variables.outputs.short_sha }}" echo "URL: https://${{ env.FRONT_URL }}/home" exit 0