Skip to content

Commit 87df7cd

Browse files
authored
Bugfix/fix condition to pull container (#20)
* Try fixing conditions * Upgrade download-artifact action
1 parent 40b96b8 commit 87df7cd

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

.github/workflows/container-vulnerability-scan.yaml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Set up Docker Buildx
4242
uses: docker/setup-buildx-action@v2
4343
- name: Login to DockerHub container registry
44-
if: ${{ inputs.login_dockerhub }}
44+
if: inputs.login_dockerhub
4545
uses: docker/login-action@v2
4646
with:
4747
username: ${{ secrets.DOCKERHUB_USERNAME }}
@@ -50,30 +50,22 @@ jobs:
5050
run: |
5151
docker pull aquasec/trivy:${{ inputs.trivy_tag }}
5252
- name: Download container image from artifacts if uploaded
53-
if: ${{ inputs.image_artifact_name }} != null &&
54-
${{ inputs.image_artifact_filename }} != null
55-
uses: actions/download-artifact@v2
53+
if: inputs.image_artifact_name != '' &&
54+
inputs.image_artifact_filename != ''
55+
uses: actions/download-artifact@v3.0.2
5656
with:
5757
name: ${{ inputs.image_artifact_name }}
5858
path: /tmp
5959
- name: Load container image file if one is shipped via artifacts
60-
if: ${{ inputs.image_artifact_name }} != null &&
61-
${{ inputs.image_artifact_filename }} != null
60+
if: inputs.image_artifact_name != '' &&
61+
inputs.image_artifact_filename != ''
6262
run: |
6363
docker load --input /tmp/${{ inputs.image_artifact_filename }}
64-
RC=$?
65-
if [ ${RC} -gt 0 ]; then
66-
exit ${RC}
67-
fi
6864
- name: Pull container image that should be scanned if no container image is shipped via artifacts
69-
if: ${{ inputs.image_artifact_name }} == null &&
70-
${{ inputs.image_artifact_filename }} == null
65+
if: inputs.image_artifact_name == '' ||
66+
inputs.image_artifact_filename == ''
7167
run: |
7268
docker pull ${{ inputs.image_name }}
73-
RC=$?
74-
if [ ${RC} -gt 0 ]; then
75-
exit ${RC}
76-
fi
7769
- name: List available container images in local repository
7870
run: |
7971
docker image ls -a

0 commit comments

Comments
 (0)