Skip to content

Commit

Permalink
Merge branch 'bcgov:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
nimya-aot authored Aug 20, 2024
2 parents fdfda2f + 5b398c6 commit 16f1af6
Show file tree
Hide file tree
Showing 148 changed files with 13,056 additions and 5,224 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG VARIANT="18.20.3-bookworm"
ARG VARIANT="18.20.4-bookworm"
FROM node:${VARIANT}

# not much in here, could acheive this another way for sure...
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"VARIANT": "18.20.3-bookworm"
"VARIANT": "18.20.4-bookworm"
}
},

Expand Down
8 changes: 4 additions & 4 deletions .github/actions/build-push-container/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,23 +117,23 @@ runs:
echo "HAS_DOCKERHUB=${{ fromJson(inputs.dockerhub_username != '' && inputs.dockerhub_token != '') }}" >> $GITHUB_ENV
- name: Login to Github Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ env.GH_USERNAME }}
password: ${{ inputs.github_token }}

- name: Login to Dockerhub Container Registry
if: env.HAS_DOCKERHUB == 'true'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ inputs.dockerhub_username }}
password: ${{ inputs.dockerhub_token }}

- name: Prepare Container Metadata tags
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ env.GH_USERNAME }}/${{ inputs.image_name }}
Expand All @@ -151,7 +151,7 @@ runs:
- name: Build and Push to Container Registry
id: builder
uses: docker/build-push-action@v3
uses: docker/build-push-action@v6
with:
context: ${{ inputs.context }}
push: true
Expand Down
8 changes: 4 additions & 4 deletions .github/actions/deploy-to-environment/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ inputs:
ref:
description: The checkout ref id
required: false
default: ''
default: ""

runs:
using: composite
steps:
- name: Checkout repository from pull request
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
if: ${{ inputs.ref != '' }}
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
if: ${{ inputs.ref == '' }}

- name: Login to OpenShift Cluster
uses: jasonchung1871/oc-login@v1.1.2
uses: redhat-actions/oc-login@v1

with:
openshift_server_url: ${{ inputs.openshift_server }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -57,7 +57,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -71,4 +71,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
17 changes: 13 additions & 4 deletions .github/workflows/on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build & Push
uses: ./.github/actions/build-push-container
with:
Expand All @@ -38,10 +38,12 @@ jobs:
url: https://${{ env.ACRONYM }}-dev.apps.silver.devops.gov.bc.ca/app
runs-on: ubuntu-latest
needs: build
outputs:
url: https://${{ env.ACRONYM }}-dev.apps.silver.devops.gov.bc.ca/app
timeout-minutes: 12
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Deploy to Dev
uses: ./.github/actions/deploy-to-environment
with:
Expand All @@ -57,6 +59,13 @@ jobs:
route_path: /app
route_prefix: ${{ vars.ROUTE_PREFIX }}

scan-dev:
name: Scan Dev
needs: deploy-dev
uses: ./.github/workflows/reusable-owasp-zap.yaml
with:
url: ${{ needs.deploy-dev.outputs.url }}

deploy-test:
name: Deploy to Test
environment:
Expand All @@ -69,7 +78,7 @@ jobs:
timeout-minutes: 12
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Deploy to Test
uses: ./.github/actions/deploy-to-environment
with:
Expand Down Expand Up @@ -98,7 +107,7 @@ jobs:
timeout-minutes: 12
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Deploy to Prod
uses: ./.github/actions/deploy-to-environment
with:
Expand Down
34 changes: 11 additions & 23 deletions .github/workflows/.deploy.yaml → .github/workflows/pr_deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy PR
name: PR Deploy
run-name: Deploy PR-${{ github.event.inputs.pr-number }}

env:
Expand All @@ -9,7 +9,7 @@ on:
inputs:
pr-number:
description: Pull request number
required: false
required: true
type: string

concurrency:
Expand Down Expand Up @@ -37,6 +37,7 @@ jobs:
echo "JOB_NAME=master" >> "$GITHUB_OUTPUT"
echo "ROUTE_PATH=/app" >> "$GITHUB_OUTPUT"
echo "URL=https://$ACRONYM-dev.apps.silver.devops.gov.bc.ca" >> "$GITHUB_OUTPUT"
- name: Final variables
id: vars
env:
Expand All @@ -45,17 +46,10 @@ jobs:
REF=refs/pull/$PR_NUMBER/head
echo REF:$REF
echo "ref=$REF" >> $GITHUB_OUTPUT
if [[ "$PR_NUMBER" != '' ]]; then
echo "APP_TITLE=${{ steps.default-vars.outputs.APP_TITLE }} - PR-$PR_NUMBER" >> "$GITHUB_OUTPUT"
echo "JOB_NAME=pr-$PR_NUMBER" >> "$GITHUB_OUTPUT"
echo "ROUTE_PATH=/pr-$PR_NUMBER" >> "$GITHUB_OUTPUT"
echo "URL=${{ steps.default-vars.outputs.URL }}/pr-$PR_NUMBER" >> "$GITHUB_OUTPUT"
else
echo "APP_TITLE=${{ steps.default-vars.outputs.APP_TITLE }}" >> "$GITHUB_OUTPUT"
echo "JOB_NAME=${{ steps.default-vars.outputs.JOB_NAME }}" >> "$GITHUB_OUTPUT"
echo "ROUTE_PATH=${{ steps.default-vars.outputs.ROUTE_PATH }}" >> "$GITHUB_OUTPUT"
echo "URL=${{ steps.default-vars.outputs.URL }}/app" >> "$GITHUB_OUTPUT"
fi
echo "APP_TITLE=${{ steps.default-vars.outputs.APP_TITLE }} - PR-$PR_NUMBER" >> "$GITHUB_OUTPUT"
echo "JOB_NAME=pr-$PR_NUMBER" >> "$GITHUB_OUTPUT"
echo "ROUTE_PATH=/pr-$PR_NUMBER" >> "$GITHUB_OUTPUT"
echo "URL=${{ steps.default-vars.outputs.URL }}/pr-$PR_NUMBER" >> "$GITHUB_OUTPUT"
build:
name: Build & Push
Expand All @@ -67,10 +61,6 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ needs.set-vars.outputs.ref }}
if: ${{ needs.set-vars.outputs.ref != '' }}
- name: Checkout repository
uses: actions/checkout@v4
if: ${{ needs.set-vars.outputs.ref == '' }}
- name: Build & Push
uses: ./.github/actions/build-push-container
with:
Expand All @@ -85,7 +75,7 @@ jobs:
pr_number: ${{ github.event.inputs.pr-number }}

deploy:
name: Deploys to selected environment
name: Deploy
environment:
name: pr
url: ${{ needs.set-vars.outputs.URL }}
Expand All @@ -97,10 +87,6 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ needs.set-vars.outputs.ref }}
if: ${{ needs.set-vars.outputs.ref != '' }}
- name: Checkout repository
uses: actions/checkout@v4
if: ${{ needs.set-vars.outputs.ref == '' }}
- name: Deploy to environment
uses: ./.github/actions/deploy-to-environment
with:
Expand All @@ -118,9 +104,11 @@ jobs:
ref: ${{ needs.set-vars.outputs.ref }}
- name: Release Comment on PR
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.event.inputs.pr-number }} != '' && success()
if: success()
with:
header: release
hide_and_recreate: true
hide_classify: "OUTDATED"
message: |
Release ${{ github.sha }} deployed at <https://${{ env.ACRONYM }}-dev.apps.silver.devops.gov.bc.ca/pr-${{ github.event.inputs.pr-number }}>
number: ${{ github.event.inputs.pr-number }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Close pull request deployment
name: PR Undeploy
run-name: Undeploy PR-${{ github.event.inputs.pr-number }}

env:
ACRONYM: chefs
Expand All @@ -7,19 +8,9 @@ on:
workflow_dispatch:
inputs:
pr-number:
description: Pull request number, leave blank for dev/test/prod deployment
required: false
type: string
environment:
description: Environment name; choose dev for PR
description: Pull request number
required: true
type: choice
options:
- dev
- test
- prod
default: dev

type: string

jobs:
remove-pr-dev:
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ jobs:
version: [18]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check CodeClimate Secrets
id: check-secrets
run: echo "HAS_CC_SECRETS=${{ secrets.CC_TEST_REPORTER_ID != '' }}" >> $GITHUB_OUTPUT
- name: Use Node.js ${{ matrix.version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-app
env:
cache-name: cache-node-modules
Expand All @@ -50,7 +50,7 @@ jobs:
CI: true
- name: Save Coverage Results
if: matrix.version == 18
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-app
path: ${{ github.workspace }}/app/coverage
Expand Down Expand Up @@ -81,13 +81,13 @@ jobs:
version: [18]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-frontend
env:
cache-name: cache-node-modules
Expand All @@ -107,7 +107,7 @@ jobs:
CI: true
- name: Save Coverage Results
if: matrix.version == 18
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-frontend
path: ${{ github.workspace }}/app/frontend/coverage
Expand All @@ -133,11 +133,11 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Restore Coverage Results
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
- name: Publish code coverage
uses: paambaati/codeclimate-action@v3.2.0
uses: paambaati/codeclimate-action@v8
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
Expand Down
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The stability of the CHEFS application is of highest importance.
- Please bring your change ideas to the team before starting work
- Contributors must follow the [Code of Conduct](CODE-OF-CONDUCT.md)
- Changes must include test coverage, documentation, and comments
- If changes to the code alter the functionality of CHEFS, please update the [documentation](https://developer.gov.bc.ca/docs/default/component/chefs-techdocs) by raising a pull request in the CHEFS tech docs [repository](https://github.com/bcgov/common-hosted-form-service-techdocs).
- The repository guardians review all changes and may ask for revisions

## Contributing code
Expand All @@ -20,4 +21,4 @@ Government employees, public and members of the private sector are encouraged to

All contributors retain the original copyright to their stuff, but by contributing to this project, you grant a world-wide, royalty-free, perpetual, irrevocable, non-exclusive, transferable license to all users **under the terms of the [license](./LICENSE) under which this project is distributed**.

To set up CHEFS on your workstation, visit the [Developer](https://github.com/bcgov/common-hosted-form-service/wiki/Developer) Wiki page.
To set up CHEFS on your workstation, visit the [developer documentation](https://developer.gov.bc.ca/docs/default/component/chefs-techdocs/Developer/).
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/node:18.20.3-alpine3.20
FROM docker.io/node:18.20.4-alpine3.20

ENV NO_UPDATE_NOTIFIER=true
WORKDIR /opt/app-root/src/app
Expand Down
Loading

0 comments on commit 16f1af6

Please sign in to comment.