Skip to content

Commit

Permalink
MLPAB-1419 - Use a single persistent environment for weblate changes …
Browse files Browse the repository at this point in the history
…optimise workflow (#741)

* exclude this test weblate pr branch

* run a weblate workflow only for a webalte branch

* reconfigure conditions

* use a webalte environment and skip long tests

* remove account level changes as they won't be
part of changes from weblate

* remove ui tests on image

* fix issue with end of line

* add weblate-pr branch:

* don't run on push from a webalte branch

* only run ui tests when it's not the weblate branch

* use the correct branch for now

* force a build

* full ref

* print head_ref

* fix expression

* use contains

* no need for if

* wrap

* force a build and run smoke for webalte pr

* if weblate pr then workspace is weblate

* weblate is a protected environmetn

* cleanup
  • Loading branch information
andrewpearce-digital authored Oct 3, 2023
1 parent 755481e commit 4fd0af5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/tags_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ jobs:
workspace=${workspace//\/}
workspace=${workspace:0:11}
workspace=$(echo ${workspace} | tr '[:upper:]' '[:lower:]')
if ${{ contains(fromJSON('["MLPAB-1419-use-a-single-persistent-environment-for-weblate-changes-optimise-workflow", "weblate-pr"]'), github.head_ref) }}; then
workspace="weblate"
fi
echo "name=${workspace}" >> $GITHUB_OUTPUT
echo ${workspace}
outputs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/terraform_environment_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
}
- name: Protect environment workspace
if: github.workflow == '[Workflow] PR'
if: github.event_name == 'pull_request' && inputs.workspace_name != 'weblate'
env:
TF_WORKSPACE: ${{ inputs.workspace_name }}
TF_VAR_container_version: ${{ inputs.version_tag }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/workflow_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ jobs:
with:
run_against_image: true
tag: ${{ needs.create_tags.outputs.version_tag }}
smoke: ${{ contains(fromJSON('["MLPAB-1419-use-a-single-persistent-environment-for-weblate-changes-optimise-workflow", "weblate-pr"]'), github.head_ref) }}
secrets:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
Expand Down
2 changes: 1 addition & 1 deletion scripts/workspace_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi
export TF_EXIT_CODE="0"

in_use_workspaces=( "$@" )
reserved_workspaces=( "default" "production" "preproduction" "ur" "demo")
reserved_workspaces=( "default" "production" "preproduction" "ur" "demo" "weblate" )

protected_workspaces=( "${in_use_workspaces[@]} ${reserved_workspaces[@]}" )
all_workspaces=$(terraform workspace list|sed 's/*//g')
Expand Down

0 comments on commit 4fd0af5

Please sign in to comment.