-
Notifications
You must be signed in to change notification settings - Fork 264
[backport v1.6] fix: bumping Go version to 1.24.13 #4342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/v1.6
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,34 +10,37 @@ parameters: | |||||
|
|
||||||
|
|
||||||
| steps: | ||||||
| - task: GoTool@0 | ||||||
| - task: ShellScript@2 | ||||||
| displayName: "Install msft-go" | ||||||
| inputs: | ||||||
| version: '$(GOVERSION)' | ||||||
| scriptPath: $(REPO_ROOT)/.pipelines/build/scripts/install-go.sh | ||||||
| env: | ||||||
| name: $(name) | ||||||
|
||||||
| name: $(name) | |
| name: ${{ parameters.target }} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
| set -eux | ||
|
|
||
| # Install crane (google/go-containerregistry) for daemonless container image extraction. | ||
| # crane can pull and export image filesystems without a Docker daemon. | ||
| # Go is pre-installed in the build container, so we use go install. | ||
| # Rely on go install for supply chain security and reproducibility | ||
| if ! command -v crane &> /dev/null; then | ||
| go install github.com/google/go-containerregistry/cmd/crane@v0.21.3 | ||
| sudo mv "$(go env GOPATH)/bin/crane" /usr/local/bin/crane | ||
| fi | ||
|
|
||
| crane version |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||||||
| #!/bin/bash | ||||||||||
| set -eux | ||||||||||
|
|
||||||||||
|
Comment on lines
+1
to
+3
|
||||||||||
| # Install Go by extracting it from the msft-go container image. | ||||||||||
| # The golang image reference is read directly from the source Dockerfile for the | ||||||||||
| # current image (identified by $name), keeping the pipeline in sync with the build. | ||||||||||
| # | ||||||||||
| # Priority: | ||||||||||
| # 1. MSFT_GO_IMAGE env var (explicit override) | ||||||||||
| # 2. Parsed from the source Dockerfile for $name | ||||||||||
| # 3. Hardcoded fallback digest below | ||||||||||
| # | ||||||||||
| # To update the fallback, run: | ||||||||||
| # skopeo inspect docker://mcr.microsoft.com/oss/go/microsoft/golang:1.24-cbl-mariner2.0 --format "{{.Name}}@{{.Digest}}" | ||||||||||
| DEFAULT_IMAGE="mcr.microsoft.com/oss/go/microsoft/golang@sha256:b05a9bbf50a8ccfdd0ebe9f673ef29dca7c1d5e209434b35a560a4e8ae5f72b2" | ||||||||||
|
|
||||||||||
|
Comment on lines
+13
to
+16
|
||||||||||
| # Resolves the golang image from the source Dockerfile for the given $name. | ||||||||||
| # Echoes the image reference, or empty string if it cannot be determined. | ||||||||||
| resolve_go_image() { | ||||||||||
| if [[ "${name:-}" == "npm" ]]; then | ||||||||||
| # npm uses OS-specific Dockerfiles with a tag-based reference. | ||||||||||
| # The image may be field 2 (no --platform) or field 3 (with --platform), | ||||||||||
| # so extract the mcr.* token directly. | ||||||||||
| # e.g. FROM mcr.../golang:1.25.5 AS builder | ||||||||||
| # e.g. FROM --platform=linux/amd64 mcr.../golang:1.25.5 AS builder | ||||||||||
| local buildfile="${REPO_ROOT}/npm/${OS:-linux}.Dockerfile" | ||||||||||
| grep -m1 '^FROM.*golang' "${buildfile}" | grep -o 'mcr[^ ]*' | ||||||||||
|
||||||||||
| grep -m1 '^FROM.*golang' "${buildfile}" | grep -o 'mcr[^ ]*' | |
| if [[ -f "${buildfile}" ]]; then | |
| grep -m1 '^FROM.*golang' "${buildfile}" | grep -o 'mcr[^ ]*' || true | |
| fi |
Copilot
AI
Apr 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before extracting the new Go toolchain, consider removing any existing /usr/local/go directory. Untarring over an existing installation can leave stale files from the previous version if paths were removed/renamed upstream.
| # crane export streams the full image filesystem; we extract just usr/local/go. | |
| # crane export streams the full image filesystem; we extract just usr/local/go. | |
| # Remove any existing Go installation first to avoid stale files from older versions. | |
| sudo rm -rf /usr/local/go |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| ARG ARCH | ||
| # skopeo inspect docker://mcr.microsoft.com/oss/go/microsoft/golang:1.23.2 --format "{{.Name}}@{{.Digest}}" | ||
| FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:86c5b00bbed2a6e7157052d78bf4b45c0bf26545ed6e8fd7dbad51ac9415f534 AS builder | ||
| # skopeo inspect docker://mcr.microsoft.com/oss/go/microsoft/golang:1.24 --format "{{.Name}}@{{.Digest}}" | ||
| FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:f3e556c9de4dd93be774dc0fa2ce3cfa76f7744d0bacada92d1624f04ce69461 AS builder | ||
|
Comment on lines
+2
to
+3
|
||
| ARG VERSION | ||
| ARG DEBUG | ||
| ARG OS | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # Source images | ||
| export GO_IMG ?= mcr.microsoft.com/oss/go/microsoft/golang:1.23-cbl-mariner2.0 | ||
| export GO_IMG ?= mcr.microsoft.com/oss/go/microsoft/golang:1.24-cbl-mariner2.0 | ||
|
||
| export MARINER_CORE_IMG ?= mcr.microsoft.com/cbl-mariner/base/core:2.0 | ||
| export MARINER_DISTROLESS_IMG ?= mcr.microsoft.com/cbl-mariner/distroless/minimal:2.0 | ||
| export WIN_HPC_IMG ?= mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,8 @@ ARG DROPGZ_VERSION=v0.0.12 | |
| ARG OS_VERSION | ||
| ARG OS | ||
|
|
||
| # mcr.microsoft.com/oss/go/microsoft/golang:1.23-cbl-mariner2.0 | ||
| FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:1d8a3fc8df13298bab0d6ea34f49ded3641fd60985c7968518717e965edaef99 AS go | ||
| # mcr.microsoft.com/oss/go/microsoft/golang:1.24-cbl-mariner2.0 | ||
| FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:b05a9bbf50a8ccfdd0ebe9f673ef29dca7c1d5e209434b35a560a4e8ae5f72b2 AS go | ||
|
behzad-mir marked this conversation as resolved.
behzad-mir marked this conversation as resolved.
Comment on lines
+8
to
+9
|
||
|
|
||
| # mcr.microsoft.com/cbl-mariner/base/core:2.0 | ||
| FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core@sha256:61b8c8e5c769784be2137cba8612c3a0f0c1752a66276b3b1b5306014a1e20e0 AS mariner-core | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,8 @@ ARG ARCH | |
| ARG OS_VERSION | ||
| ARG OS | ||
|
|
||
| # mcr.microsoft.com/oss/go/microsoft/golang:1.23-cbl-mariner2.0 | ||
| FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:1d8a3fc8df13298bab0d6ea34f49ded3641fd60985c7968518717e965edaef99 AS go | ||
| # mcr.microsoft.com/oss/go/microsoft/golang:1.24-cbl-mariner2.0 | ||
| FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang@sha256:b05a9bbf50a8ccfdd0ebe9f673ef29dca7c1d5e209434b35a560a4e8ae5f72b2 AS go | ||
|
behzad-mir marked this conversation as resolved.
behzad-mir marked this conversation as resolved.
Comment on lines
+7
to
+8
|
||
|
|
||
| # mcr.microsoft.com/cbl-mariner/base/core:2.0 | ||
| FROM mcr.microsoft.com/cbl-mariner/base/core@sha256:61b8c8e5c769784be2137cba8612c3a0f0c1752a66276b3b1b5306014a1e20e0 AS mariner-core | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
install-go.shrelies oncrane, but this template no longer installs it (unlikeimages.jobs.yaml). As-is, binary builds will fail withcrane: command not found. Add anInstall cranestep beforeInstall msft-go(or otherwise guaranteecraneis present).