Skip to content

Commit

Permalink
Fix false positive slack message on release (#5203)
Browse files Browse the repository at this point in the history
* Fix false positive slack message on release, when there is an error in prepare instance job

* Add run on push to tests changes

* Add run on push to tests changes

* Add run on push to tests changes

* Fix slack message payload

* Fix slack message payload

* Fix slack message payload

* Fix slack message payload

* Fix slack message payload

* Fix slack message payload

* Fix slack message payload

* Fix slack message payload

* remove data for testing
  • Loading branch information
karola312 authored Oct 10, 2024
1 parent 8bf935a commit 14742dc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/slimy-dodos-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": minor
---

Now we have slack message if there is failure when preparing instance before release tests
4 changes: 2 additions & 2 deletions .github/workflows/automation-tests-on-repository-dispatch.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Execute automation tests
run-name: Run tests on ${{github.event.client_payload.custom_version }} ${{github.event.client_payload.project}}
run-name: Run tests on ${{github.event.client_payload.custom_version }} ${{github.event.client_payload.project}}

on:
repository_dispatch:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
uses: ./.github/workflows/run-tests-on-release.yml
with:
VERSION: ${{needs.get-environment-variables.outputs.VERSION}}
CUSTOM_VERSION: ${{github.event.client_payload.custom_version }}
CUSTOM_VERSION: ${{github.event.client_payload.custom_version }}
ADDITIONAL_TITLE: "Core automation test"
secrets: inherit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ program
.option("--repo_token <repo_token>", "github token")
.option("--project <project>", "release project")
.action(async options => {

if (options.version.match(/^\d+\.\d+\./)) {
throw new Error(`Incorrect version provided - ${customVersion}`);
}
const isOldVersion = await checkIfOldVersion(options.version, options.repo_token);
core.setOutput("IS_OLD_VERSION", isOldVersion);

Expand Down
30 changes: 29 additions & 1 deletion .github/workflows/run-tests-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
required: false
default: "Dashboard Automation test run "


secrets:
STAGING_TOKEN:
required: true
Expand Down Expand Up @@ -130,6 +131,32 @@ jobs:
--repo_token "$REPO_TOKEN" \
--project "$PROJECT"
- name: send slack message if failure
if: failure()
env:
LINK: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
MESSAGE: "Could not prepare instance for release tests on version ${{ env.CUSTOM_VERSION }}"
run: |
payload=$(\
jq --null-input \
--arg link "$LINK" \
--arg message "$MESSAGE" \
'{
"attachments": [
{
"pretext": "FAILURE",
"color": "#FE6E76",
"title": "Automation tests failure",
"title_link": $link,
"text": $message
}
]
}'
)
curl -H "Content-type: application/json" \
--data "$payload" \
-X POST ${{ secrets.SLACK_QA_STATUSES_WEBHOOK_URL }}
run-cy-tests:
if: needs.add-check-and-prepare-instance.outputs.FRAMEWORK == '"cypress"'
needs: add-check-and-prepare-instance
Expand Down Expand Up @@ -230,7 +257,7 @@ jobs:

tests-complete:
if: |
!cancelled() && always()
!cancelled() && always() && needs.add-check-and-prepare-instance.result == 'success'
needs: ["add-check-and-prepare-instance", "run-cy-tests", "run-pw-tests"]
runs-on: ubuntu-22.04
timeout-minutes: 30
Expand Down Expand Up @@ -303,6 +330,7 @@ jobs:
always() &&
(needs.tests-complete != 'success' && cancelled()) &&
needs.add-check-and-prepare-instance.outputs.FRAMEWORK == '"playwright"'
&& needs.add-check-and-prepare-instance.result == 'success'
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit 14742dc

Please sign in to comment.