generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into chore/jump-host
- Loading branch information
Showing
74 changed files
with
2,287 additions
and
1,043 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: .Deploy Stack | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
### Required | ||
environment_name: | ||
description: 'The name of the environment to deploy to' | ||
required: true | ||
default: 'dev' | ||
type: string | ||
command: | ||
description: 'The terragrunt command to run' | ||
required: true | ||
default: 'apply' | ||
type: string | ||
tag: | ||
description: 'The tag of the containers to deploy' | ||
default: 'latest' | ||
type: string | ||
required: false | ||
app_env: | ||
required: false | ||
type: string | ||
description: 'The APP env separates between AWS ENV and Actual APP, since AWS dev is where PR, and TEST is deployed' | ||
outputs: | ||
API_GW_URL: | ||
value: ${{ jobs.deploy-api.outputs.API_GW_URL }} | ||
S3_BUCKET_ARN: | ||
value: ${{ jobs.deploy-cloudfront.outputs.S3_BUCKET_ARN }} | ||
CF_DOMAIN: | ||
value: ${{ jobs.deploy-cloudfront.outputs.CF_DOMAIN }} | ||
CF_DISTRIBUTION_ID: | ||
value: ${{ jobs.deploy-cloudfront.outputs.CF_DISTRIBUTION_ID }} | ||
env: | ||
AWS_REGION: ca-central-1 | ||
jobs: | ||
stack-prefix: | ||
name: Stack Prefix | ||
uses: ./.github/workflows/.stack-prefix.yml | ||
deploy-db: | ||
name: Deploys Database | ||
needs: [stack-prefix] | ||
uses: ./.github/workflows/.deployer.yml | ||
with: | ||
environment_name: ${{ inputs.environment_name }} | ||
command: ${{ inputs.command }} | ||
working_directory: database | ||
app_env: ${{ inputs.app_env }} | ||
stack_prefix: ${{ needs.stack-prefix.outputs.stack_prefix }} | ||
secrets: inherit | ||
deploy-api: | ||
name: Deploys API | ||
needs: [deploy-db, stack-prefix] | ||
uses: ./.github/workflows/.deployer.yml | ||
with: | ||
environment_name: ${{ inputs.environment_name }} | ||
command: ${{ inputs.command }} | ||
tag: ${{ inputs.tag }} | ||
app_env: ${{ inputs.app_env }} | ||
working_directory: api | ||
stack_prefix: ${{ needs.stack-prefix.outputs.stack_prefix }} | ||
secrets: inherit | ||
deploy-cloudfront: | ||
name: Deploys Cloudfront | ||
needs: [stack-prefix] | ||
uses: ./.github/workflows/.deployer.yml | ||
with: | ||
environment_name: ${{ inputs.environment_name }} | ||
command: ${{ inputs.command }} | ||
tag: ${{ inputs.tag }} | ||
app_env: ${{ inputs.app_env }} | ||
working_directory: frontend | ||
stack_prefix: ${{ needs.stack-prefix.outputs.stack_prefix }} | ||
secrets: inherit | ||
build-ui: | ||
name: Build And upload UI to s3 ${{ inputs.environment_name }} | ||
environment: ${{ inputs.environment_name }} | ||
if: ${{ inputs.command == 'apply' }} | ||
needs: [deploy-api, deploy-cloudfront] | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: setup node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22' | ||
cache: 'npm' | ||
cache-dependency-path: frontend/package-lock.json | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
- name: Build And Update UI (CF) | ||
working-directory: frontend | ||
env: | ||
VITE_API_BASE_URL: ${{ needs.deploy-api.outputs.API_GW_URL }}/api | ||
S3_BUCKET_ARN: ${{ needs.deploy-cloudfront.outputs.S3_BUCKET_ARN }} | ||
CF_DISTRIBUTION_ID: ${{ needs.deploy-cloudfront.outputs.CF_DISTRIBUTION_ID }} | ||
run: | | ||
npm run deploy | ||
aws s3 sync --delete ./dist s3://$(echo "$S3_BUCKET_ARN" | cut -d: -f6) | ||
aws cloudfront create-invalidation --distribution-id $CF_DISTRIBUTION_ID --paths "/*" |
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: .E2E | ||
on: | ||
workflow_call: | ||
inputs: | ||
frontend_url: | ||
description: 'The URL of the frontend to test' | ||
required: true | ||
type: string | ||
tag: | ||
description: 'The tag of the containers to test' | ||
default: 'latest' | ||
type: string | ||
required: false | ||
jobs: | ||
e2e-tests: | ||
name: E2E Tests | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Run Docker compose | ||
if: ${{ inputs.frontend_url == 'http://localhost:3000' }} | ||
env: | ||
BACKEND_IMAGE: ghcr.io/${{ github.repository }}/backend:${{ inputs.tag }} | ||
FLYWAY_IMAGE: ghcr.io/${{ github.repository }}/migrations:${{ inputs.tag }} | ||
FRONTEND_IMAGE: ghcr.io/${{ github.repository }}/frontend:${{ inputs.tag }} | ||
run: docker compose up -d --wait | ||
continue-on-error: true | ||
- name: Docker Compose Logs | ||
if: ${{ inputs.frontend_url == 'http://localhost:3000' }} | ||
run: docker compose logs | ||
- name: Cache Playwright Browsers | ||
uses: actions/cache@v4 | ||
id: playwright-cache | ||
with: | ||
path: | | ||
~/.cache/ms-playwright | ||
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }} | ||
- uses: actions/setup-node@v4 | ||
name: Setup Node | ||
with: | ||
node-version: 22 | ||
cache: 'npm' | ||
cache-dependency-path: frontend/package-lock.json | ||
- name: Fix permissions | ||
run: sudo chown -R $USER:$USER frontend | ||
- name: Install dependencies | ||
working-directory: frontend | ||
run: | | ||
npm ci | ||
- run: npx @playwright/test install --with-deps | ||
if: steps.playwright-cache.outputs.cache-hit != 'true' | ||
working-directory: ./frontend | ||
- run: npx @playwright/test install-deps | ||
if: steps.playwright-cache.outputs.cache-hit == 'true' | ||
working-directory: ./frontend | ||
- name: Run Tests | ||
working-directory: frontend | ||
env: | ||
E2E_BASE_URL: ${{ inputs.frontend_url }} | ||
CI: 'true' | ||
run: | | ||
npx playwright test --project="chromium" --reporter=blob |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: .Stack Prefix | ||
on: | ||
workflow_call: | ||
outputs: | ||
STACK_PREFIX: | ||
description: 'The Stack Prefix' | ||
value: ${{ jobs.prefix.outputs.STACK_PREFIX }} | ||
jobs: | ||
prefix: | ||
name: Stack Prefix | ||
runs-on: ubuntu-24.04 | ||
outputs: | ||
STACK_PREFIX: ${{ steps.stack-prefix.outputs.STACK_PREFIX }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Generate Stack Prefix | ||
id: stack-prefix | ||
shell: bash | ||
run: | | ||
# Get repository name | ||
REPO_NAME="${{ github.event.repository.name }}" | ||
# If repo name is less than 20 characters, use it directly | ||
if [[ ${#REPO_NAME} -lt 20 ]]; then | ||
STACK_PREFIX="${REPO_NAME}" | ||
else | ||
# Split by hyphen or underscore and get first letter of each word | ||
PREFIX=$(echo "$REPO_NAME" | | ||
awk -v RS='[-_]' '{printf "%s", tolower(substr($0,1,1))}' | | ||
tr -d '\n') | ||
# Ensure at least 4 characters without repetition | ||
while [[ ${#PREFIX} -lt 4 ]]; do | ||
# Concatenate with the next letter in the sequence (avoiding randomness) | ||
SUFFIX="${PREFIX: -1}" # Get the last character of the current PREFIX | ||
INDEX=$(( $(echo "$PREFIX" | grep -o "$SUFFIX" | wc -l) + 1 )) # Get the index of the next character | ||
NEXT_CHAR=$(echo "$PREFIX" | cut -c $INDEX) # Get the next character | ||
PREFIX="${PREFIX}${NEXT_CHAR}" | ||
done | ||
# Truncate if prefix exceeds 10 characters | ||
if [[ ${#PREFIX} -gt 10 ]]; then | ||
PREFIX="${PREFIX:0:10}" | ||
fi | ||
STACK_PREFIX="${PREFIX}" | ||
fi | ||
# Set output | ||
echo "STACK_PREFIX=$STACK_PREFIX" >> $GITHUB_OUTPUT | ||
echo "Generated prefix: $STACK_PREFIX" |
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
Oops, something went wrong.