Skip to content

Commit e7e33bc

Browse files
committed
Fix pipeline scan job
Signed-off-by: Arjun <agadiyar@nvidia.com>
1 parent edb816e commit e7e33bc

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

‎.nvidia-ci.yml‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,36 +79,38 @@ image-distroless:
7979
- echo "Skipped in internal CI"
8080

8181
# The .scan step forms the base of the image scan operation performed before releasing
82-
# images.
82+
# images. pulse-cli pulls from the registry directly, so DinD is not required.
8383
.scan:
8484
stage: scan
8585
image: "${PULSE_IMAGE}"
86+
services: []
8687
variables:
8788
IMAGE: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}"
88-
IMAGE_ARCHIVE: "nvidia-sandbox-device-plugin.tar"
8989
except:
9090
variables:
9191
- $CI_COMMIT_MESSAGE =~ /\[skip[ _-]scans?\]/i
9292
- $SKIP_SCANS && $SKIP_SCANS == "yes"
9393
before_script:
94-
- docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}"
95-
- docker pull --platform="${PLATFORM}" "${IMAGE}"
96-
- docker save "${IMAGE}" -o "${IMAGE_ARCHIVE}"
94+
- mkdir -p "$HOME/.docker"
95+
- chmod 700 "$HOME/.docker"
96+
- >
97+
REGISTRY_AUTH="$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')"
98+
- >
99+
jq -n --arg registry "$CI_REGISTRY" --arg auth "$REGISTRY_AUTH"
100+
'{auths: {($registry): {auth: $auth}}}' > "$HOME/.docker/config.json"
101+
- export REGISTRY_AUTH_FILE="$HOME/.docker/config.json"
97102
- AuthHeader=$(echo -n $SSA_CLIENT_ID:$SSA_CLIENT_SECRET | base64 -w0)
98103
- >
99104
export SSA_TOKEN=$(curl --request POST --header "Authorization: Basic $AuthHeader" --header "Content-Type: application/x-www-form-urlencoded" ${SSA_ISSUER_URL} | jq ".access_token" | tr -d '"')
100105
- if [ -z "$SSA_TOKEN" ]; then exit 1; else echo "SSA_TOKEN set!"; fi
101106
script:
102-
- pulse-cli -n $NSPECT_ID --ssa $SSA_TOKEN scan -i $IMAGE_ARCHIVE -p $CONTAINER_POLICY -o
107+
- echo "Scanning image ${IMAGE} for platform ${PLATFORM}"
108+
- pulse-cli -n "${NSPECT_ID}" scan-image -i "${IMAGE}" --platform "${PLATFORM}" -p "${CONTAINER_POLICY}" --output-dir="scan-results" -o
103109
artifacts:
104110
when: always
105111
expire_in: 1 week
106112
paths:
107-
- pulse-cli.log
108-
- licenses.json
109-
- sbom.json
110-
- vulns.json
111-
- policy_evaluation.json
113+
- scan-results/**/*
112114

113115
# The .scan-distroless steps forms the base for all distroless image scans across supported architectures
114116
.scan-distroless:

0 commit comments

Comments
 (0)