diff --git a/templates/CVE_Scan.gitlab-ci.yml b/templates/CVE_Scan.gitlab-ci.yml index b3f153b..488fa1d 100644 --- a/templates/CVE_Scan.gitlab-ci.yml +++ b/templates/CVE_Scan.gitlab-ci.yml @@ -76,6 +76,9 @@ # prepare TAG if it was triggered with CI_COMMIT_TAG if [ -n "${CI_COMMIT_TAG}" ]; then TAG=$(echo "${TAG}"| sed 's/^v//' | cut -d '.' -f -2) + else + # if not - replace / with - + TAG=$(echo "${TAG}"| sed -e 's/\//-/g') fi module_tags=("${TAG}") @@ -84,7 +87,7 @@ fi echo "Getting tags to scan" # Check if provided tag is a semver minor, and if so - get image from prod registry - if echo "${TAG}" | grep -q "[0-9]*\.[0-9]*"; then + if echo "${TAG}" | grep -q "v[0-9]*\.[0-9]*"; then module_tags=($(crane ls "${PROD_REGISTRY_MODULE_BASEDIR}/${MODULE_NAME}" | grep "^v${TAG}\.[0-9]*" | sort -V -r | head -n 1)) fi if [ "${SCAN_SEVERAL_LASTEST_RELEASES}" == "true" ]; then diff --git a/templates/Setup.gitlab-ci.yml b/templates/Setup.gitlab-ci.yml index 15fe946..d719b78 100644 --- a/templates/Setup.gitlab-ci.yml +++ b/templates/Setup.gitlab-ci.yml @@ -26,13 +26,15 @@ variables: before_script: # Setup trdl - | - export PATH=$PATH:~/bin - trdl_target_version=$(curl -s https://tuf.trdl.dev/targets/channels/0/stable) - trdl_installed_version=$(trdl | tail -n 1 | sed -E 's/Version: v([0-9\.]+)/\1/') - if [[ "$trdl_installed_version" != "$trdl_target_version" ]]; then - curl -sSLO "https://tuf.trdl.dev/targets/releases/$trdl_target_version/linux-amd64/bin/trdl" - install -D trdl ~/bin/trdl - rm trdl + if ! command -v trdl; then + export PATH=$PATH:~/bin + trdl_target_version=$(curl -s https://tuf.trdl.dev/targets/channels/0/stable) + trdl_installed_version=$(trdl | tail -n 1 | sed -E 's/Version: v([0-9\.]+)/\1/') + if [[ "$trdl_installed_version" != "$trdl_target_version" ]]; then + curl -sSLO "https://tuf.trdl.dev/targets/releases/$trdl_target_version/linux-amd64/bin/trdl" + install -D trdl ~/bin/trdl + rm trdl + fi fi # Setup werf