-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from Secure-Compliance-Solutions-LLC/dev
v21.4.3-v1
- Loading branch information
Showing
9 changed files
with
160 additions
and
31 deletions.
There are no files selected for viewing
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 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 |
---|---|---|
|
@@ -23,11 +23,94 @@ permissions: | |
packages: write | ||
|
||
jobs: | ||
build_test: | ||
name: Build and Test | ||
build_test_trivy: | ||
name: Build and Test - Trivy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: PrepareReg Names | ||
run: | | ||
echo IMAGE_REPOSITORY_GHCR=$(echo "ghcr.io/${{ github.repository }}" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | ||
echo IMAGE_TAG=$(echo ${{ github.ref }} | tr '[:upper:]' '[:lower:]' | awk '{split($0,a,"/"); print a[3]}') >> $GITHUB_ENV | ||
- name: Set tag var | ||
id: vars | ||
run: echo ::set-output name=docker_tag::$(echo ${GITHUB_REF} | cut -d'/' -f3)-${GITHUB_SHA} | ||
|
||
- name: Download artifact | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
# Optional, GitHub token, a Personal Access Token with `public_repo` scope if needed | ||
# Required, if artifact is from a different repo | ||
github_token: ${{secrets.GITHUB_TOKEN}} | ||
# Required, workflow file name or ID | ||
workflow: build-apk.yml | ||
# Optional, will use the branch | ||
branch: master | ||
# Optional, uploaded artifact name, | ||
# will download all artifacts if not specified | ||
# and extract them in respective subdirectories | ||
# https://github.com/actions/download-artifact#download-all-artifacts | ||
name: apk-builds | ||
# Optional, directory where to extract artifact. Defaults to the artifact name (see `name` input) | ||
path: ${{ github.workspace }}/apk-build/ | ||
# Optional, defaults to current repo | ||
repo: Secure-Compliance-Solutions-LLC/GVM-APK-build | ||
|
||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --build-arg OPT_PDF=1 --tag ${{ env.IMAGE_REPOSITORY_GHCR }}:${{ github.sha }} | ||
|
||
- uses: actions/[email protected] | ||
with: | ||
path: .trivy | ||
key: ${{ runner.os }}-trivy-${{ github.run_id }} | ||
restore-keys: | | ||
${{ runner.os }}-trivy- | ||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
with: | ||
image-ref: "${{ env.IMAGE_REPOSITORY_GHCR }}:${{ github.sha }}" | ||
format: "table" | ||
exit-code: "1" | ||
ignore-unfixed: true | ||
vuln-type: "os,library" | ||
severity: "CRITICAL,HIGH" | ||
cache-dir: .trivy | ||
|
||
- name: Run Trivy vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
if: always() | ||
with: | ||
image-ref: "${{ env.IMAGE_REPOSITORY_GHCR }}:${{ github.sha }}" | ||
format: "template" | ||
template: "@/contrib/sarif.tpl" | ||
output: "trivy-results.sarif" | ||
severity: "CRITICAL,HIGH" | ||
cache-dir: .trivy | ||
|
||
- name: Upload Trivy scan results to GitHub Security tab | ||
uses: github/codeql-action/upload-sarif@v1 | ||
if: always() | ||
with: | ||
sarif_file: "trivy-results.sarif" | ||
|
||
- name: Correct Trivy cache permissions | ||
if: always() | ||
run: sudo chown -R $USER:$GROUP .trivy | ||
|
||
build_test_anchore: | ||
name: Build and Test - Anchore | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: PrepareReg Names | ||
run: | | ||
echo IMAGE_REPOSITORY_GHCR=$(echo "ghcr.io/${{ github.repository }}" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | ||
echo IMAGE_TAG=$(echo ${{ github.ref }} | tr '[:upper:]' '[:lower:]' | awk '{split($0,a,"/"); print a[3]}') >> $GITHUB_ENV | ||
- name: Set tag var | ||
id: vars | ||
run: echo ::set-output name=docker_tag::$(echo ${GITHUB_REF} | cut -d'/' -f3)-${GITHUB_SHA} | ||
|
@@ -53,13 +136,20 @@ jobs: | |
repo: Secure-Compliance-Solutions-LLC/GVM-APK-build | ||
|
||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --build-arg OPT_PDF=1 --tag myapp:${{ steps.vars.outputs.docker_tag }} | ||
run: docker build . --file Dockerfile --build-arg OPT_PDF=1 --tag ${{ env.IMAGE_REPOSITORY_GHCR }}:${{ github.sha }} | ||
|
||
- uses: anchore/scan-action@v2 | ||
if: always() | ||
id: scan | ||
with: | ||
image: "${{ env.IMAGE_REPOSITORY_GHCR }}:${{ github.sha }}" | ||
acs-report-enable: true | ||
|
||
- name: Scan with Phonito Security | ||
uses: phonito/phonito-scanner-action@master | ||
- name: upload Anchore scan SARIF report | ||
if: always() | ||
uses: github/codeql-action/upload-sarif@v1 | ||
with: | ||
image: myapp:${{ steps.vars.outputs.docker_tag }} | ||
phonito-token: ${{ secrets.PHONITO_TOKEN }} | ||
sarif_file: ${{ steps.scan.outputs.sarif }} | ||
|
||
build_release: | ||
name: Build and Release | ||
|
@@ -179,7 +269,7 @@ jobs: | |
latest=${{ steps.releasePreareLatestTag.outputs.latest}} | ||
onlatest=${{ steps.releasePreareLatestTag.outputs.latest}} | ||
prefix= | ||
suffix=-full | ||
suffix=-full,onlatest=${{ steps.releasePreareLatestTag.outputs.latest}} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=tag | ||
|
@@ -213,7 +303,7 @@ jobs: | |
latest=${{ steps.releasePreareLatestTag.outputs.latest}} | ||
onlatest=${{ steps.releasePreareLatestTag.outputs.latest}} | ||
prefix= | ||
suffix=-data | ||
suffix=-data,onlatest=${{ steps.releasePreareLatestTag.outputs.latest}} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
|
@@ -245,7 +335,7 @@ jobs: | |
latest=${{ steps.releasePreareLatestTag.outputs.latest}} | ||
onlatest=${{ steps.releasePreareLatestTag.outputs.latest}} | ||
prefix= | ||
suffix=-data-full | ||
suffix=-data-full,onlatest=${{ steps.releasePreareLatestTag.outputs.latest}} | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
|
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 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 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 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 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,2 @@ | ||
#!/usr/bin/env bash | ||
set -Eeuo pipefail |
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 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