Skip to content

Commit b2d7660

Browse files
committed
debug cve
Signed-off-by: Smyslov Maxim <maksim.smyslov@flant.com>
1 parent 3c8a195 commit b2d7660

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

templates/CVE_Scan.gitlab-ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
echo "Preparing DOCKER_CONFIG and login to registries"
4141
mkdir -p "${workdir}/docker"
4242
export DOCKER_CONFIG="${workdir}/docker"
43+
echo "Logging as ${PROD_REGISTRY_USER} to ${PROD_REGISTRY}"
4344
echo ${PROD_REGISTRY_PASSWORD} | docker login --username="${PROD_REGISTRY_USER}" --password-stdin ${PROD_REGISTRY}
45+
echo "Logging as ${DEV_REGISTRY_USER} to ${DEV_REGISTRY}"
4446
echo ${DEV_REGISTRY_PASSWORD} | docker login --username="${DEV_REGISTRY_USER}" --password-stdin ${DEV_REGISTRY}
4547
echo
4648
echo "======================================================="
@@ -69,28 +71,44 @@
6971
DEV_REGISTRY_MODULE_BASEDIR="${DEV_REGISTRY}/${MODULE_DEV_REGISTRY_CUSTOM_PATH:-sys/deckhouse-oss/modules}"
7072
severity="${SEVERITY:-UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL}"
7173
latest_releases_amount="${LATEST_RELEASES_AMOUNT:-3}"
74+
75+
echo "using prod registry module base dir: ${PROD_REGISTRY_MODULE_BASEDIR}"
76+
echo "using dev registry module base dir: ${DEV_REGISTRY_MODULE_BASEDIR}"
77+
echo "using severity: ${severity}"
78+
echo "using latest releases amount: ${latest_releases_amount}"
79+
7280
# If input var TAG is empty - set to default branch
7381
if [ -z "${TAG}" ]; then
82+
echo "TAG is empty, setting to default branch: ${CI_DEFAULT_BRANCH}"
7483
TAG="${CI_DEFAULT_BRANCH}"
7584
fi
7685
# prepare TAG if it was triggered with CI_COMMIT_TAG
7786
if [ -n "${CI_COMMIT_TAG}" ]; then
7887
TAG=$(echo "${TAG}"| sed 's/^v//' | cut -d '.' -f -2)
88+
echo "scanning from tag: ${TAG}"
7989
fi
8090
module_tags=("${TAG}")
8191
8292
if [ "${CI_PIPELINE_SOURCE}" == "schedule" ]; then
93+
echo "pipeline is scheduled, several latest releases will be scanned"
8394
SCAN_SEVERAL_LASTEST_RELEASES="true"
8495
fi
8596
echo "Getting tags to scan"
8697
# Check if provided tag is a semver minor, and if so - get image from prod registry
8798
if echo "${TAG}" | grep -qE "[0-9]+\.[0-9]+"; then
99+
echo "TAG is a semver minor, getting image from prod registry"
100+
echo "total images for module found: $(crane ls "${PROD_REGISTRY_MODULE_BASEDIR}/${MODULE_NAME}" | wc -l)"
101+
88102
module_tags=($(crane ls "${PROD_REGISTRY_MODULE_BASEDIR}/${MODULE_NAME}" | grep "^v${TAG}\.[0-9]*" | sort -V -r | head -n 1))
103+
echo "selected images: ${module_tags[@]}"
89104
fi
90105
if [ "${SCAN_SEVERAL_LASTEST_RELEASES}" == "true" ]; then
106+
echo "scanning several latest releases"
107+
91108
# Get release tags by regexp, sort by sevmer desc, cut to get minor version, uniq and get several latest
92109
releases=($(crane ls "${PROD_REGISTRY_MODULE_BASEDIR}/${MODULE_NAME}" | grep "^v[0-9]*\.[0-9]*\.[0-9]*" | sort -V -r))
93110
latest_minor_releases=($(printf '%s\n' "${releases[@]}"| cut -d "." -f -2 | uniq | head -n ${latest_releases_amount}))
111+
echo "this minor releases will be scanned: ${latest_minor_releases[@]}"
94112
for r in "${latest_minor_releases[@]}"; do
95113
module_tags+=($(printf '%s\n' "${releases[@]}" | grep "${r}" | sort -V -r|head -n 1))
96114
done

0 commit comments

Comments
 (0)