From b32841e66ae6750b25049995a47849659911979a Mon Sep 17 00:00:00 2001 From: pohanhuangtw Date: Tue, 19 Mar 2024 15:13:51 +0800 Subject: [PATCH] [NVSHAS-8797] Add variable to the GITHUB_OUTPUT for future reference --- test/scan-image.bats | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/scan-image.bats b/test/scan-image.bats index 7298a4b..6c49bcb 100644 --- a/test/scan-image.bats +++ b/test/scan-image.bats @@ -5,7 +5,7 @@ setup_file() { } @test "docker daemon not reachable" { - run docker run --rm -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "$GITHUB_OUTPUT:/github-output" + run docker run --rm -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} echo "Status $status" echo "Output" echo -e $output @@ -14,7 +14,7 @@ setup_file() { } @test "invalid scanner image" { - run docker run --rm -e NV_SCANNER_IMAGE=invalid-image:latest -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "$GITHUB_OUTPUT:/github-output" + run docker run --rm -e NV_SCANNER_IMAGE=invalid-image:latest -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} echo "Status $status" echo "Output" echo -e $output @@ -23,7 +23,7 @@ setup_file() { } @test "scan image with vulnerabilities but don't fail" { - run docker run --rm -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "$GITHUB_OUTPUT:/github-output" + run docker run --rm -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} echo "Status $status" echo "Output" echo -e $output @@ -32,7 +32,7 @@ setup_file() { } @test "scan image with vulnerabilities and high severity fail" { - run docker run --rm -e HIGH_VUL_TO_FAIL=1 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "$GITHUB_OUTPUT:/github-output" + run docker run --rm -e HIGH_VUL_TO_FAIL=1 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} echo "Status $status" echo "Output" echo -e $output @@ -41,7 +41,7 @@ setup_file() { } @test "scan image with vulnerabilities and medium severity fail" { - run docker run --rm -e MEDIUM_VUL_TO_FAIL=1 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "$GITHUB_OUTPUT:/github-output" + run docker run --rm -e MEDIUM_VUL_TO_FAIL=1 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} echo "Status $status" echo "Output" echo -e $output @@ -50,7 +50,7 @@ setup_file() { } @test "scan image with vulnerabilities and specific CVE fail" { - run docker run --rm -e VUL_NAMES_TO_FAIL=invalid,CVE-2020-16156 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "$GITHUB_OUTPUT:/github-output" + run docker run --rm -e VUL_NAMES_TO_FAIL=invalid,CVE-2020-16156 -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} echo "Status $status" echo "Output" echo -e $output @@ -59,7 +59,7 @@ setup_file() { } @test "scan image with json output" { - run docker run --rm -e OUTPUT=json -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "$GITHUB_OUTPUT:/github-output" + run docker run --rm -e OUTPUT=json -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} echo "Status $status" echo "Output" echo -e $output @@ -68,7 +68,7 @@ setup_file() { } @test "scan image with csv output" { - run docker run --rm -e OUTPUT=csv -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} -v "$GITHUB_OUTPUT:/github-output" + run docker run --rm -e OUTPUT=csv -e SCANNER_REGISTRY=https://index.docker.io/ -e SCANNER_REPOSITORY=library/debian -e SCANNER_TAG=11.0 -v /var/run/docker.sock:/var/run/docker.sock bashofmann/neuvector-image-scan-action -e GITHUB_OUTPUT=${GITHUB_OUTPUT} echo "Status $status" echo "Output" echo -e $output