06.Dispatch Maintenance #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 06.Dispatch Maintenance | |
on: | |
workflow_dispatch: | |
inputs: | |
maintenanceMode: | |
description: Enable Maintenance Mode | |
type: choice | |
required: true | |
options: | |
- 'true' | |
- 'false' | |
environment: | |
description: Environment to deploy (dev, test, prod) | |
type: environment | |
required: true | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
toggle-maintenance: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
permissions: | |
contents: read | |
environment: | |
name: ${{ inputs.environment }} | |
steps: | |
- uses: hmarr/debug-action@f7318c783045ac39ed9bb497e22ce835fdafbfe6 | |
- uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 | |
with: | |
ref: main | |
- name: Authenticate and set context | |
uses: redhat-actions/oc-login@dfbd9912672664f9df2023c1c16e07bcf306043c | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | |
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | |
namespace: ${{ vars.OPENSHIFT_NAMESPACE }} | |
insecure_skip_tls_verify: true | |
- name: Deploy apps with Helm chart | |
run: | | |
helm dependency update | |
helm upgrade --set app.maintenance.enabled=${{ inputs.maintenanceMode }} \ | |
pltsvc . -n ${{ vars.OPENSHIFT_NAMESPACE }} \ | |
-f values.yaml -f values-${{ vars.OPENSHIFT_NAMESPACE }}.yaml | |
working-directory: ./helm/main | |
- name: Notify RocketChat on Success | |
if: success() | |
uses: ./.github/actions/rocketchat-notification | |
with: | |
webhook-url: ${{ secrets.ROCKETCHAT_WEBHOOK_URL }} | |
data: | | |
{ | |
"text": ":rocket: Maintenance Mode ${{ inputs.maintenanceMode }} deployed successfully in ${{ inputs.environment }}!" | |
} | |
- name: Notify RocketChat on Failure | |
if: failure() | |
uses: ./.github/actions/rocketchat-notification | |
with: | |
webhook-url: ${{ secrets.ROCKETCHAT_WEBHOOK_URL }} | |
data: | | |
{ | |
"text": ":warning: Maintenance Mode deployment failed in ${{ inputs.environment }}!" | |
} |