Skip to content

Commit

Permalink
Add Hadolint and Trivy Checks (#557)
Browse files Browse the repository at this point in the history
* Add Hadolint and Trivy Checks

* fix: Resolve 'no more disk space'

---------

Co-authored-by: Harald Heckmann <mail@haraldheckmann.de>
  • Loading branch information
samuelarogbonlo and sea212 committed Aug 3, 2023
1 parent 41a2564 commit 82ead37
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/docker-hub-parachain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ on:
- '^v[0-9]+.[0-9]+.[0-9]+$'

jobs:
hadolint:
runs-on: ubuntu-20.04
name: "Hadolint"
steps:
- uses: actions/checkout@v3
- uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: "./Dockerfile"

publish:
needs: hadolint
name: Publish
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -48,7 +58,15 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


- name: Trivy Scan
uses: aquasecurity/trivy-action@master
with:
image-ref: 'zeitgeistpm/zeitgeist-node-parachain:latest'
format: 'sarif'
output: 'zeitgeist-node-parachain-report.sarif'
severity: 'HIGH,CRITICAL'

- name: Update image version of the existing Zeitgeist network spec
uses: "OnFinality-io/action-onf-release@v1"
with:
Expand All @@ -69,4 +87,4 @@ jobs:
onf-network-key: ${{ secrets.ONF_NETWORK_KEY_BS }}
onf-sub-command: image
onf-action: add
image-version: ${{ steps.vars.outputs.tag }}
image-version: ${{ steps.vars.outputs.tag }}
18 changes: 18 additions & 0 deletions .github/workflows/docker-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ on:
tags: [ '*' ]

jobs:
hadolint:
runs-on: ubuntu-20.04
name: "Hadolint"
steps:
- uses: actions/checkout@v3
- uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: "./Dockerfile"

publish:
needs: hadolint
name: Publish
runs-on: ubuntu-latest
steps:
Expand All @@ -28,3 +38,11 @@ jobs:
else
./scripts/docker-hub-publish.sh ${GITHUB_SHA}
fi
- name: Trivy Scan
uses: aquasecurity/trivy-action@master
with:
image-ref: 'zeitgeistpm/zeitgeist-node:latest'
format: 'sarif'
output: 'zetgeist-node-report.sarif'
severity: 'HIGH,CRITICAL'
3 changes: 3 additions & 0 deletions .hadolint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ignored:
- SC1091
- SC2115
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ WORKDIR /zeitgeist
COPY . /zeitgeist

RUN apt-get update && \
apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold"

apt-get upgrade -y -o Dpkg::Options::="--force-confold"

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN ./scripts/init.sh nosudo

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN . "$HOME/.cargo/env" && cargo build --profile "$PROFILE" --features "$FEATURES"

# ==== SECOND STAGE ====
Expand Down

0 comments on commit 82ead37

Please sign in to comment.