Skip to content

Commit cdb6100

Browse files
ci: support variant-prefixed devcontainer Go tags
The devcontainer-version-check workflow extracts the Go version from the base image tag in .devcontainer/Dockerfile. The previous regex only matched the legacy '<major>.<minor>-bookworm' tag and failed on the new variant-prefixed tags published on mcr.microsoft.com (e.g. '2-1.26-bookworm'), causing the job to exit with 'Could not parse versions'. Allow an optional leading '<digits>-' variant prefix so both tag forms are accepted.
1 parent ec72ee2 commit cdb6100

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/devcontainer-check.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ jobs:
2323
GOMOD_VERSION=$(grep '^go ' go.mod | awk '{print $2}')
2424
GOMOD_MAJOR_MINOR=$(echo "$GOMOD_VERSION" | grep -oE '^[0-9]+\.[0-9]+')
2525
26-
# Extract the Go version from the Dockerfile base image tag
27-
DOCKERFILE_TAG=$(grep -oP 'devcontainers/go:\K[0-9]+\.[0-9]+' .devcontainer/Dockerfile)
26+
# Extract the Go version from the Dockerfile base image tag.
27+
# Accept both the legacy form (go:1.26-bookworm) and the variant-prefixed
28+
# form (go:2-1.26-bookworm) published on mcr.microsoft.com.
29+
DOCKERFILE_TAG=$(grep -oP 'devcontainers/go:(?:[0-9]+-)?\K[0-9]+\.[0-9]+' .devcontainer/Dockerfile)
2830
2931
echo "go.mod requires: go ${GOMOD_VERSION} (major.minor: ${GOMOD_MAJOR_MINOR})"
3032
echo "Dockerfile base image: go:${DOCKERFILE_TAG}"

0 commit comments

Comments
 (0)