Skip to content

Set the dr deployment to active #272

Set the dr deployment to active

Set the dr deployment to active #272

name: Set the dr deployment to active
on:
workflow_dispatch:
inputs:
project:
description: "The target project"
type: choice
required: true
options: ["SANDBOX", "PRODUCTION", "OLD-SANDBOX"]
default: "SANDBOX"
environment:
description: "env to deploy"
type: choice
options: ["dev","test","prod"]
default: "dev"
jobs:
alert-sso-alerts:
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- name: Rocket.Chat Notification
uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master
with:
type: ${{ job.status }}
job_name: 'The switch to Gold DR action was triggered for the ${{ github.event.inputs.project }}-${{ github.event.inputs.environment }} project, confirm if'
mention: 'jsharman @nithinshekar.kuruba @jlanglois @Marco'
mention_if: 'always'
channel: '#sso-alerts'
url: ${{ secrets.SSO_ALERTS }}
token: ${{ secrets.ROCKETCHAT_TOKEN }}
transition-scripts:
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: Set the deployment namespace
run: |
chmod +x ./namespace-setter.sh
./namespace-setter.sh ${{ github.event.inputs.project }} ${{ github.event.inputs.environment }}
working-directory: .github/helpers
- name: Login Openshift Gold & Golddr
uses: ./.github/actions/oc-login
with:
namespace: $NAMESPACE
oc-server-gold: ${{ secrets.OPENSHIFT_SERVER_GOLD }}
oc-token-gold: ${{ secrets.OPENSHIFT_TOKEN_GOLD }}
oc-server-golddr: ${{ secrets.OPENSHIFT_SERVER_GOLDDR }}
oc-token-golddr: ${{ secrets.OPENSHIFT_TOKEN_GOLDDR }}
- name: Run transition script
run: |
echo "Running on the $NAMESPACE namespace"
chmod +x ./switch-to-golddr.sh
./switch-to-golddr.sh $NAMESPACE
working-directory: transition-scripts
- name: Alert on failure
if: failure()
uses: RocketChat/Rocket.Chat.GitHub.Action.Notification@master
with:
type: ${{ job.status }}
job_name: 'The switch to Gold DR for the ${{ github.event.inputs.project }}-${{ github.event.inputs.environment }} project'
mention: 'jsharman @nithinshekar.kuruba @jlanglois @Marco'
mention_if: 'always'
channel: '#sso-alerts'
url: ${{ secrets.SSO_ALERTS }}
token: ${{ secrets.ROCKETCHAT_TOKEN }}