Skip to content

Commit

Permalink
Fix DockerHub namespace and update test
Browse files Browse the repository at this point in the history
  • Loading branch information
ckaipf committed Nov 27, 2023
1 parent cf65b64 commit bd3feb3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 24 deletions.
19 changes: 12 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@ inputs:
dockerhub_token:
description: "The DockerHub token used to authenticate"
required: true
tag:
description: "The tag used to publish to the registry."
required: true
dockerhub_namespace:
description: "The namespace used to publish to the registry."
required: true
default: ghga
working_directory:
description: "Directory which contains Dockerfile and project configuration files"
default: "."
trivy_severity:
description: "Severities of vulnerabilities to scanned for and displayed"
default: "CRITICAL,HIGH"
tag:
description: "The tag used to publish to the registry."
required: true

runs:
using: "composite"
steps:
Expand Down Expand Up @@ -68,7 +73,7 @@ runs:
TAG_VER=${{ inputs.package_version }}
[[ -z "$TAG_VER" ]] && TAG_VER=${{ inputs.tag }}
echo "Package version is $PKG_VER" >&2
echo "Tag version is $TAG_VER" >&2
if [ "$PKG_VER" != "$TAG_VER" ]; then
Expand All @@ -94,13 +99,13 @@ runs:
with:
push: true
platforms: linux/amd64,linux/arm64
tags: "${{ inputs.dockerhub_username }}/${{ github.event.repository.name }}:${{ inputs.tag }}"
tags: "${{ inputs.dockerhub_namespace }}/${{ github.event.repository.name }}:${{ inputs.tag }}"
context: "${{ inputs.working_directory }}"

- name: Run Trivy vulnerability scanner
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: "docker.io/${{ inputs.dockerhub_username }}/${{ github.event.repository.name }}:${{ inputs.tag }}"
image-ref: "docker.io/${{ inputs.dockerhub_namespace }}/${{ github.event.repository.name }}:${{ inputs.tag }}"
format: "table"
exit-code: "1"
ignore-unfixed: true
Expand Down
5 changes: 5 additions & 0 deletions test/event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"repository": {
"name": "test"
}
}
35 changes: 18 additions & 17 deletions test/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ jobs:
runs-on: ubuntu-latest
name: Install and test action
steps:
- uses: actions/checkout@v4
- name: Test locally
uses: ./
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
working_directory: ./test
tag: "0.0.0"
trivy_severity: "CRITICAL"
- name: Test release
uses: ghga-de/[email protected]
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
working_directory: ./test
tag: "0.0.0"
trivy_severity: "CRITICAL"
- uses: actions/checkout@v4
- name: Test locally
uses: ./
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
working_directory: ./test
tag: "0.0.0"
dockerhub_namespace: camillkaipf
trivy_severity: "CRITICAL"
- name: Test release
uses: ghga-de/[email protected]
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
working_directory: ./test
tag: "0.0.0"
trivy_severity: "CRITICAL"

0 comments on commit bd3feb3

Please sign in to comment.