Skip to content

Promote Apps

Promote Apps #60

Workflow file for this run

name: Promote Apps
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
SKIP_REGRESSION:
description: Flag indicating if regression should be skipped.
type: boolean
required: false
default: false
APPS:
description: APPS to promote.
required: false
jobs:
affected:
runs-on: ubuntu-22.04
outputs:
affected_apps: ${{ github.event.inputs.APPS || steps.get-affected.outputs.affected_apps }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- run: npm ci
- name: Get last successful commit
uses: nrwl/nx-set-shas@v3
id: last_successful_commit
with:
last-successful-event: workflow_dispatch
- name: Get affected apps
id: get-affected
shell: bash
run: echo "affected_apps=$(npx nx show projects --affected --type=app --base=${{ steps.last_successful_commit.outputs.base }} | tr "\n" " ")" >> $GITHUB_OUTPUT
stagingRegression:
runs-on: ubuntu-22.04
needs: affected
if: needs.affected.outputs.affected_apps
environment:
name: Staging-e2e
strategy:
matrix:
app: [tenant-management-webapp, status-app, subscriber-app]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: E2E Test
uses: ./.github/actions/nx-cypress-e2e
if: github.event.inputs.SKIP_REGRESSION != 'true'
with:
app: ${{ matrix.app }}
environment: staging
tags: '@regression and not @ignore'
core-api-client-secret: ${{ secrets.CY_CORE_API_CLIENT_SECRET }}
core-api-user-password: ${{ secrets.CY_CORE_API_USER_PASSWORD }}
api-client-secret: ${{ secrets.CY_CLIENT_SECRET }}
cy-password: ${{ secrets.CY_PASSWORD }}
cy-password-2: ${{ secrets.CY_PASSWORD2 }}
cy-password-3: ${{ secrets.CY_PASSWORD3 }}
deployProduction:
runs-on: ubuntu-22.04
needs: [affected, stagingRegression]
env:
AFFECTED_APPS: ${{ needs.affected.outputs.affected_apps }}
environment:
name: Production
steps:
- uses: actions/checkout@v4
- name: Oc login
uses: redhat-actions/oc-login@v1
with:
openshift_server_url: ${{ secrets.ARO_SERVER }}
openshift_token: ${{ secrets.ARO_TOKEN }}
namespace: adsp-build
insecure_skip_tls_verify: true
- name: Tag Production
run: |
for app in $AFFECTED_APPS
do
oc tag $app:uat $app:prod --reference-policy='local'
done
- run: oc project adsp-prod
- name: Apply Manifests
run: |
for app in $AFFECTED_APPS
do
oc process -f .openshift/managed/$app.yml -p INFRA_NAMESPACE=adsp-build -p NAMESPACE=adsp-prod -p DEPLOY_TAG=prod > $app.prod.json
oc apply -f $app.prod.json -l apply-prod=true,component!=database
done
- name: Deploy Production
run: |
for app in $AFFECTED_APPS
do
oc rollout latest dc/$app
oc rollout status dc/$app
done
smokeTestProd:
runs-on: ubuntu-22.04
needs: deployProduction
environment:
name: Prod-e2e
strategy:
matrix:
app: [tenant-management-webapp, status-app, subscriber-app]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: E2E Test
uses: ./.github/actions/nx-cypress-e2e
with:
app: ${{ matrix.app }}
environment: prod
tags: '@smoke-test and not @ignore'
core-api-client-secret: ${{ secrets.CY_CORE_API_CLIENT_SECRET }}
core-api-user-password: ${{ secrets.CY_CORE_API_USER_PASSWORD }}
api-client-secret: ${{ secrets.CY_CLIENT_SECRET }}
cy-password: ${{ secrets.CY_PASSWORD }}
cy-password-2: ${{ secrets.CY_PASSWORD2 }}
cy-password-3: ${{ secrets.CY_PASSWORD3 }}