diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 0f0c9553..d724268f 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -157,6 +157,10 @@ jobs: - name: Normalize image name run: | IMAGE_NAME=$(echo "${{ env.IMAGE_NAME }}" | tr '[:upper:]' '[:lower:]') + if [ -z "$IMAGE_NAME" ]; then + echo "::error::IMAGE_NAME is empty!" + exit 1 + fi echo "IMAGE_NAME=${IMAGE_NAME}" >> "$GITHUB_ENV" - name: Determine image push policy @@ -176,6 +180,11 @@ jobs: env: PR_HEAD_REF: ${{ github.head_ref }} run: | + if [ -z "$IMAGE_NAME" ]; then + echo "::error::IMAGE_NAME is empty!" + exit 1 + fi + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) DEFAULT_TAG="sha-${SHORT_SHA}" BRANCH_NAME="${{ github.ref_name }}" @@ -191,6 +200,11 @@ jobs: fi fi + if [ -z "$DEFAULT_TAG" ]; then + echo "::error::DEFAULT_TAG is empty!" + exit 1 + fi + sanitize_tag() { local raw="$1" local max_len="$2" @@ -266,6 +280,24 @@ jobs: TAGS+=("${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:nightly") fi + if [ ${#TAGS[@]} -eq 0 ]; then + echo "::error::No tags generated!" + exit 1 + fi + + for tag in "${TAGS[@]}"; do + if [ -z "$tag" ]; then + echo "::error::Generated tag is empty!" + exit 1 + fi + if [[ "$tag" =~ [[:space:]] ]]; then + echo "::error::Generated tag contains whitespace: $tag" + exit 1 + fi + done + + printf '%s\n' "${TAGS[@]}" + { echo "tags<