Skip to content

Commit

Permalink
refactor the migration checks and tests cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeebru committed Feb 15, 2024
1 parent 321664e commit 35769ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
34 changes: 13 additions & 21 deletions .github/workflows/test-report-deployment-status-to-slack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ on:

jobs:
test-report-start:
name: Test Slack report start
name: Test Slack report
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: ./report-deployment-status-to-slack
- name: Start
uses: ./report-deployment-status-to-slack
with:
project: Server
environment: US QA Cloud
Expand All @@ -24,13 +25,9 @@ jobs:
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

test-report:
name: Test Slack report
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: ./report-deployment-status-to-slack
- name: Success
uses: ./report-deployment-status-to-slack
with:
project: Server
environment: US QA Cloud
Expand All @@ -41,13 +38,8 @@ jobs:
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

test-report-failure:
name: Test Slack report failure
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: ./report-deployment-status-to-slack
- name: Failure
uses: ./report-deployment-status-to-slack
with:
project: Server
environment: US QA Cloud
Expand All @@ -64,7 +56,7 @@ jobs:
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Slack report with DB migration true on main
- name: With DB migration true on main
uses: ./report-deployment-status-to-slack
with:
project: Server
Expand All @@ -77,7 +69,7 @@ jobs:
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Slack report with DB migration false on main
- name: With DB migration false on main
uses: ./report-deployment-status-to-slack
with:
project: Server
Expand All @@ -90,25 +82,25 @@ jobs:
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Slack report with DB migration true on test branch
- name: With DB migration true on test branch
uses: ./report-deployment-status-to-slack
with:
project: Server
environment: US QA Cloud
tag: test-branch
tag: test-branch-failure
slack-channel: devops-alerts-test
event: 'failure'
commit-sha: ${{ github.sha }}
db_migration_detected: true
url: https://github.com/bitwarden/gh-actions/actions/runs/${{ github.run_id }}
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}

- name: Slack report with DB migration false on test branch
- name: With DB migration false on test branch
uses: ./report-deployment-status-to-slack
with:
project: Server
environment: US QA Cloud
tag: test-branch
tag: test-branch-success
slack-channel: devops-alerts-test
event: 'success'
commit-sha: ${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion report-deployment-status-to-slack/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ runs:
esac
}
if [[ ${{ inputs.db_migration_detected }} == true && ${{ inputs.tag }} != 'main|rc|hotfix-rc' ]]; then
if [[ ${{ inputs.db_migration_detected }} == true && $( ${{ inputs.tag }} != main && ${{ inputs.tag }} != rc && ${{ inputs.tag }} != hotfix-rc) ]]; then
slack_message_fn "${{ inputs.event }}" "${{ inputs.environment }}" "${{ inputs.tag }}" "${{ inputs.project }}" "${{ inputs.url }}" "${{ inputs.commit-sha }}"
SLACK_MESSAGE="$SLACK_MESSAGE
:red_siren: This branch has new database migration changes."
Expand Down

0 comments on commit 35769ff

Please sign in to comment.