Skip to content

engine: fix versioning by propagating TAGPREFIX#410

Open
wojiushixiaobai wants to merge 1 commit intodocker:mainfrom
loong64:fix_pkg_engine
Open

engine: fix versioning by propagating TAGPREFIX#410
wojiushixiaobai wants to merge 1 commit intodocker:mainfrom
loong64:fix_pkg_engine

Conversation

@wojiushixiaobai
Copy link
Copy Markdown
Contributor

The gen-ver.sh script (or the version generation logic) fails to capture the correct version because it defaults to a tagregex of v[0-9]*. As shown in the build logs, this causes the versioning logic to either miss the official tags or fail to strip the docker- prefix:

#37 0.060 + tagregex='v[0-9]*'
#37 0.060 ++ git -C /usr/local/src/engine describe --match 'v[0-9]*' --tags
#37 0.095 + version=v2.0.0-beta.9-33-g828f87ccfd

Signed-off-by: 吴小白 <296015668@qq.com>
Copy link
Copy Markdown
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

ARG GO_VERSION="1.26.2"
ARG GO_IMAGE_VARIANT="bookworm"

ARG TAGPREFIX="docker-"
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if it should be closer to the default, but with a prefix, e.g. docker-v[0-9]*

(no strong opinion, just thinking out loud 😅)

cc @vvoland

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not sure if the * glob would work if set through the arg)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • # optional tag prefix to handle versions like:
    # cmd/cli/v0.1.44 -> v0.1.44
    # docker-v29.0.0 -> v29.0.0
    : "${TAGPREFIX:=}"
    srcdir="$1"
    if [ -z "$srcdir" ]; then
    echo "usage: ./gen-ver <srcdir>" >&2
    exit 1
    fi
    tagregex="${TAGPREFIX}v[0-9]*"
    version=$(git -C "${srcdir}" describe --match "$tagregex" --tags)
    commit="$(git --git-dir "${srcdir}/.git" rev-parse HEAD)"
    commitShort=${commit:0:7}

If we set TAGPREFIX="docker-v[0-9]*", the resulting tagregex becomes docker-v[0-9]*v[0-9]*, which won't match our tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants