diff --git a/templates/gitlab-ci-python.yml b/templates/gitlab-ci-python.yml index 47b8be9d2743a32bb3005ea7146566cca91c6889..c609a47a4530eef310c528f16c2cc0282bec8479 100644 --- a/templates/gitlab-ci-python.yml +++ b/templates/gitlab-ci-python.yml @@ -1061,7 +1061,8 @@ py-sbom: if [[ -z "$PYTHON_SBOM_SYFT_URL" ]] then log_info "Syft version unset: retrieve latest version..." - PYTHON_SBOM_SYFT_URL="https://github.com$(curl https://github.com/anchore/syft/releases -s | sed -rn 's/.*href="(.*_linux_amd64\.tar\.gz)".*/\1/p')" + syft_version=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/anchore/syft/releases/latest | grep -o '[^/v]*$') + PYTHON_SBOM_SYFT_URL="https://github.com/anchore/syft/releases/download/v${syft_version}/syft_${syft_version}_linux_amd64.tar.gz" log_info "... use latest Syft version: \\e[32m$PYTHON_SBOM_SYFT_URL\\e[0m" fi python_sbom_syft="$PIP_CACHE_DIR/syft-$(echo "$PYTHON_SBOM_SYFT_URL" | md5sum | cut -d" " -f1)"