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.
* Remove old template * pr-validate workflow * Pare down pr-open.yml * Shared workflow for pr-close.yml * Rename merge workflow * Move and rename unit-test.yml to analysis.yml * Run Trivy and CodeQL in analysis workflow * Pare down merge.yml * Update prod release workflow * vars.OC_SERVER * PR Results job * Scheduled.yml for PR expiry and ZAP tests
- Loading branch information
1 parent
ecb35b1
commit da45b9c
Showing
10 changed files
with
244 additions
and
362 deletions.
There are no files selected for viewing
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,61 @@ | ||
name: Analysis | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft] | ||
schedule: | ||
- cron: "0 11 * * 0" # 3 AM PST = 12 PM UDT, runs sundays | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
codeql: | ||
name: CodeQL Security Scan | ||
if: ${{ ! github.event.pull_request.draft }} | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: github/codeql-action/init@v3 | ||
with: | ||
languages: javascript | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:javascript" | ||
|
||
# https://github.com/marketplace/actions/aqua-security-trivy | ||
trivy: | ||
name: Trivy Security Scan | ||
if: ${{ ! github.event.pull_request.draft }} | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run Trivy vulnerability scanner in repo mode | ||
uses: aquasecurity/trivy-action@0.18.0 | ||
with: | ||
format: "sarif" | ||
output: "trivy-results.sarif" | ||
ignore-unfixed: true | ||
scan-type: "fs" | ||
scanners: "vuln,secret,config" | ||
severity: "CRITICAL,HIGH" | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: "trivy-results.sarif" | ||
|
||
results: | ||
name: Analysis Results | ||
needs: [codeql, trivy] | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- run: echo "Workflow completed successfully!" |
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,38 @@ | ||
name: Merge | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
paths-ignore: | ||
- ".github/ISSUE_TEMPLATE/*" | ||
- "**.md" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploys-test: | ||
name: TEST Deployments | ||
environment: test | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
name: [frontend, rctool] | ||
include: | ||
- name: frontend | ||
file: frontend/openshift.nginx.deploy.yml | ||
- name: rctool | ||
file: frontend/openshift.deploy.yml | ||
steps: | ||
- uses: bcgov-nr/action-deployer-openshift@v2.1.0 | ||
with: | ||
file: ${{ matrix.file }} | ||
oc_namespace: ${{ secrets.OC_NAMESPACE }} | ||
oc_server: ${{ vars.OC_SERVER }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
overwrite: true | ||
parameters: | ||
-p ZONE=test -p PROMOTE=${{ github.repository }}/${{ matrix.name }}:test | ||
-p NAME=${{ github.event.repository.name }} |
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 |
---|---|---|
@@ -1,43 +1,21 @@ | ||
name: Pull Request Closed | ||
name: PR Closed | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
types: [closed] | ||
|
||
concurrency: | ||
# PR open and close use the same group, allowing only one at a time | ||
group: pr-${{ github.ref }} | ||
group: ${{ github.event.number }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Clean up OpenShift when PR closed, no conditions | ||
cleanup-openshift: | ||
name: Cleanup OpenShift | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Remove OpenShift artifacts | ||
run: | | ||
oc login --token=${{ secrets.OC_TOKEN }} --server=${{ secrets.OC_SERVER }} | ||
oc project ${{ secrets.OC_NAMESPACE }} | ||
# Remove old build runs, build pods and deployment pods | ||
oc delete all,pvc,secret -l app=${{ github.event.repository.name }}-${{ github.event.number }} | ||
# If merged into main, then handle any image promotions | ||
image-promotions: | ||
name: Image Promotions | ||
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main' | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
packages: write | ||
strategy: | ||
matrix: | ||
package: [frontend,rctool] | ||
steps: | ||
- uses: shrink/actions-docker-registry-tag@v4 | ||
with: | ||
registry: ghcr.io | ||
repository: ${{ github.repository }}/${{ matrix.package }} | ||
target: ${{ github.event.number }} | ||
tags: test | ||
cleanup: | ||
name: Cleanup and Images | ||
uses: bcgov/quickstart-openshift-helpers/.github/workflows/.pr-close.yml@v0.4.0 | ||
secrets: | ||
oc_namespace: ${{ secrets.OC_NAMESPACE }} | ||
oc_token: ${{ secrets.OC_TOKEN }} | ||
with: | ||
cleanup: label | ||
packages: frontend rctool |
Oops, something went wrong.