Skip to content

Commit

Permalink
feat: create stub app for admin frontend (#500)
Browse files Browse the repository at this point in the history
Signed-off-by: Sukanya Rath <[email protected]>
Co-authored-by: Sukanya Rath <[email protected]>
  • Loading branch information
banders and sukanya-rath authored May 28, 2024
1 parent 9143ec2 commit 8aa7a55
Show file tree
Hide file tree
Showing 140 changed files with 16,907 additions and 503 deletions.
45 changes: 26 additions & 19 deletions .github/workflows/.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,59 @@ on:
workflow_call:
inputs:
target:
description: 'PR number, test or prod.'
description: "PR number, test or prod."
required: true
type: string
autoscaling:
description: 'Autoscaling enabled or not for the deployments'
description: "Autoscaling enabled or not for the deployments"
required: false
type: boolean
default: true
tag:
description: 'Docker tag; e.g. PR number, tag, test or prod'
description: "Docker tag; e.g. PR number, tag, test or prod"
required: false
type: string
default: ${{ github.event.number }}

directory:
description: 'Chart directory.'
default: 'charts/${{ github.event.repository.name }}'
description: "Chart directory."
default: "charts/${{ github.event.repository.name }}"
required: false
type: string
timeout-minutes:
description: 'Timeout minutes'
default: 8
description: "Timeout minutes"
default: 12
required: false
type: number
values:
description: 'Values file.'
default: 'values.yaml'
description: "Values file."
default: "values.yaml"
required: false
type: string

frontend-url:
description: 'Frontend URL of the application'
description: "Frontend URL of the application"
required: true
type: string
admin-frontend-url:
description: "URL of the admin frontend application"
required: true
type: string
environment:
description: 'Environment to read secrets from GitHub secrets'
description: "Environment to read secrets from GitHub secrets"
required: false
default: dev
type: string
semver:
description: 'Semver version of the helm chart'
description: "Semver version of the helm chart"
required: false
type: string
default: 0.0.1
params:
description: 'Extra params to pass to helm upgrade command'
description: "Extra params to pass to helm upgrade command"
required: false
type: string
default: ''

default: ""

jobs:
deploys:
Expand Down Expand Up @@ -83,7 +86,7 @@ jobs:
- name: Clean PR Environment
shell: bash
run: |
# If inputs.target starts with 'pr-', uninstall the helm chart first to ensure a clean install
if [[ "${{ inputs.target }}" == pr-* ]]; then
helm uninstall ${{ env.deployment_name }}-${{ inputs.target }} || true
Expand All @@ -97,14 +100,15 @@ jobs:
- name: Deploy to OpenShift
shell: bash
run: |
# 1 minute less for HELM to do atomic deployment and rollback if not completed within the time.
DEPLOY_TIMEOUT=$((${{ inputs.timeout-minutes }}-1))
# Perform atomic upgrade/installation of helm chart
helm upgrade --debug --install --wait --atomic ${{ env.deployment_name }}-${{ inputs.target }} \
--values ${{ inputs.directory }}/${{ inputs.values }} \
--set-string backend.image.tag="${{ inputs.tag }}" \
--set-string admin-frontend.image.tag="${{ inputs.tag }}" \
--set-string frontend.image.tag="${{ inputs.tag }}" \
--set-string database.image.tag="${{ inputs.tag }}" \
--set-string doc-gen-service.image.tag="${{ inputs.tag }}" \
Expand All @@ -114,6 +118,9 @@ jobs:
--set-string global.secrets.keycloakClientId="${{ secrets.KEYCLOAK_CLIENT_ID }}" \
--set-string global.secrets.keycloakClientSecret="${{ secrets.KEYCLOAK_CLIENT_SECRET }}" \
--set-string global.secrets.keycloakUrl="${{ secrets.KEYCLOAK_URL }}" \
--set-string global.secrets.adminKeycloakUrl="${{ secrets.ADMIN_KEYCLOAK_URL }}" \
--set-string global.secrets.adminKeycloakClientId="${{ secrets.ADMIN_KEYCLOAK_CLIENT_ID }}" \
--set-string global.secrets.adminKeycloakClientSecret="${{ secrets.ADMIN_KEYCLOAK_CLIENT_SECRET }}" \
--set-string global.secrets.uiPrivateKey="${{ env.UI_PRIVATE_KEY }}" \
--set-string global.secrets.uiPublicKey="${{ env.UI_PUBLIC_KEY }}" \
--set-string global.secrets.databasePassword="${{ secrets.DATABASE_PWD }}" \
Expand All @@ -130,6 +137,7 @@ jobs:
--set-string global.secrets.chesClientSecret="${{ secrets.CHES_CLIENT_SECRET }}" \
--set-string global.secrets.chesAPIURL="${{ secrets.CHES_API_URL }}" \
--set-string global.secrets.chesEmailRecipients="${{ secrets.CHES_EMAIL_RECIPIENTS }}" \
--set-string global.serverAdminFrontend="${{ inputs.admin-frontend-url }}" \
--set-string global.serverFrontend="${{ inputs.frontend-url }}" \
--set-string crunchy.pgBackRest.s3.bucket="${{ secrets.S3_BUCKET }}" \
--set-string crunchy.pgBackRest.s3.endpoint="${{ secrets.S3_ENDPOINT }}" \
Expand All @@ -143,4 +151,3 @@ jobs:
run: |
# print history
helm history ${{ env.deployment_name }}-${{ inputs.target }}
88 changes: 88 additions & 0 deletions .github/workflows/.e2e-admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: .E2E
env:
deployment_name: pay-transparency
on:
workflow_dispatch:
secrets:
E2E_ADMIN_USERNAME:
required: true
E2E_ADMIN_PASSWORD:
required: true
inputs:
admin-frontend-url:
description: "URL of the admin frontend application"
required: true
type: string
environment:
description: "Environment to read secrets from GitHub secrets"
required: false
default: dev
type: string
timeout-minutes:
description: "Timeout minutes"
default: 8
required: false
type: number
workflow_call:
secrets:
E2E_ADMIN_USERNAME:
required: true
E2E_ADMIN_PASSWORD:
required: true
inputs:
admin-frontend-url:
description: "URL of the admin frontend application"
required: true
type: string
environment:
description: "Environment to read secrets from GitHub secrets"
required: false
default: dev
type: string
timeout-minutes:
description: "Timeout minutes"
default: 8
required: false
type: number

jobs:
end-to-end:
name: Tests
environment: ${{ inputs.environment }}
defaults:
run:
working-directory: admin-frontend
runs-on: ubuntu-22.04
timeout-minutes: ${{ inputs.timeout-minutes }}
strategy:
max-parallel: 3
matrix:
project: [chromium, Google Chrome, firefox, safari, Microsoft Edge]
steps:
- uses: actions/checkout@v4
name: Checkout
- uses: actions/setup-node@v4
name: Setup Node
with:
node-version: 20
- name: Install dependencies
run: |
npm ci
npx playwright install --with-deps
- name: Run Tests
env:
E2E_ADMIN_BASE_URL: ${{ inputs.admin-frontend-url }}
E2E_ADMIN_USERNAME: ${{ secrets.E2E_ADMIN_USERNAME }}
E2E_ADMIN_PASSWORD: ${{ secrets.E2E_ADMIN_PASSWORD }}
run: |
npx playwright test --project="${{ matrix.project }}" --reporter=html
- uses: actions/upload-artifact@v4
if: always()
name: upload results
env:
PW_TEST_HTML_REPORT_OPEN: always
with:
name: playwright-report-${{ matrix.project }}
path: "./admin-frontend/playwright-report" # path from current folder
retention-days: 7
7 changes: 5 additions & 2 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@ jobs:
- 5432:5432
strategy:
matrix:
dir: [backend, frontend, doc-gen-service, backend-external]
dir:
[backend, admin-frontend, frontend, doc-gen-service, backend-external]
include:
- dir: backend
sonar_projectKey: fin-pay-transparency_backend
token: SONAR_TOKEN_BACKEND
- dir: admin-frontend
sonar_projectKey: fin-pay-transparency_admin-frontend
token: SONAR_TOKEN_ADMIN_FRONTEND
- dir: frontend
sonar_projectKey: fin-pay-transparency_frontend
token: SONAR_TOKEN_FRONTEND
Expand Down Expand Up @@ -98,7 +102,6 @@ jobs:
sonar_token: ${{ secrets[matrix.token] }}
triggers: ${{ matrix.triggers }}


# https://github.com/marketplace/actions/aqua-security-trivy
trivy:
name: Trivy Security Scan
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/cd-to-prod-on-workflow-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'The Docker Tag to deploy, it would be the latest tagged version that you want to deploy from TEST to PROD.'
description: "The Docker Tag to deploy, it would be the latest tagged version that you want to deploy from TEST to PROD."
required: true
concurrency:
group: ${{ github.workflow }}
Expand All @@ -19,7 +19,16 @@ jobs:
packages: write
strategy:
matrix:
package: [backend, database-migrations, frontend, doc-gen-service, backend-external, maintenance]
package:
[
backend,
database-migrations,
admin-frontend,
frontend,
doc-gen-service,
backend-external,
maintenance,
]
steps:
- uses: shrink/actions-docker-registry-tag@v4
with:
Expand All @@ -29,14 +38,15 @@ jobs:
tags: prod
deploys:
name: Deploys (prod)
needs: [ image-promotions-to-prod ]
needs: [image-promotions-to-prod]
uses: ./.github/workflows/.deploy.yml
secrets: inherit
with:
target: prod
environment: prod
tag: ${{ github.event.inputs.tag }}
frontend-url: https://paytransparency.fin.gov.bc.ca
admin-frontend-url: https://paytransparency-admin.fin.gov.bc.ca
semver: ${{ github.event.inputs.tag }}
values: "values-prod.yaml"
zap:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/cd-to-test-on-workflow-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
[
backend,
database-migrations,
admin-frontend,
frontend,
doc-gen-service,
backend-external,
Expand All @@ -47,6 +48,7 @@ jobs:
environment: test
tag: ${{ github.event.inputs.tag }}
frontend-url: https://test.paytransparency.fin.gov.bc.ca
admin-frontend-url: https://test.paytransparency-admin.fin.gov.bc.ca
semver: ${{ github.event.inputs.tag }}
values: "values-test.yaml"
test-integration:
Expand All @@ -57,4 +59,3 @@ jobs:
with:
backend-external-url: https://pay-transparency-test-backend-external.apps.silver.devops.gov.bc.ca/api
environment: test

Loading

0 comments on commit 8aa7a55

Please sign in to comment.