Skip to content

Commit e5ee257

Browse files
committed
Add golang 1.26 to builder-base
1 parent 13c7d25 commit e5ee257

3 files changed

Lines changed: 41 additions & 3 deletions

File tree

builder-base/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,24 @@ RUN --mount=type=cache,target=/var/cache/yum,sharing=locked \
441441
/install_golang.sh $GOLANG_VERSION_125 && \
442442
/remove_yum_packages.sh
443443

444+
FROM ${BUILDER_IMAGE} as golang-1.26
445+
ARG TARGETARCH
446+
ARG GOLANG_VERSION_126
447+
ARG GOLANG_RPM_SOURCE_DIR
448+
WORKDIR /workdir
449+
ENV GOPATH /go
450+
ENV PATH="/go/bin/:$PATH"
451+
452+
COPY --link --from=upx /upx /
453+
COPY ./scripts/install_base_yum_packages.sh ./scripts/remove_yum_packages.sh ./scripts/common_vars.sh \
454+
./scripts/install_golang.sh /
455+
COPY $GOLANG_RPM_SOURCE_DIR/linux/arm64/go1.26*.tar.gz /tmp/linux/arm64/
456+
COPY $GOLANG_RPM_SOURCE_DIR/linux/amd64/go1.26*.tar.gz /tmp/linux/amd64/
457+
RUN --mount=type=cache,target=/var/cache/yum,sharing=locked \
458+
/install_base_yum_packages.sh && \
459+
/install_golang.sh $GOLANG_VERSION_126 && \
460+
/remove_yum_packages.sh
461+
444462
FROM ${BUILDER_IMAGE} as skopeo
445463
ARG TARGETARCH
446464
ARG GOPROXY
@@ -625,6 +643,22 @@ RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
625643
--mount=type=secret,id=netrc,target=/root/.netrc \
626644
/install_go_licenses.sh
627645

646+
FROM ${BUILDER_IMAGE} as go-licenses-1.26
647+
ARG TARGETARCH
648+
ARG GOPROXY
649+
ARG GO_LICENSES_VERSION
650+
ENV GO_LICENSES_VERSION=$GO_LICENSES_VERSION
651+
WORKDIR /workdir
652+
ENV GOPATH /go
653+
ENV PATH="/go/bin/:$PATH"
654+
COPY --link --from=upx /upx /
655+
COPY --link --from=golang-1.26 /golang-1.26 /
656+
COPY ./scripts/common_vars.sh \
657+
./scripts/install_go_licenses.sh /
658+
RUN --mount=type=cache,target=/root/.cache/go-build,sharing=locked \
659+
--mount=type=secret,id=netrc,target=/root/.netrc \
660+
/install_go_licenses.sh
661+
628662
FROM ${BUILDER_IMAGE} as go-vuln-check
629663
ARG TARGETARCH
630664
ARG GOPROXY
@@ -684,6 +718,8 @@ COPY --link --from=golang-1.24 /golang-1.24 /
684718
COPY --link --from=go-licenses-1.24 /go-licenses-1.24 /
685719
COPY --link --from=golang-1.25 /golang-1.25 /
686720
COPY --link --from=go-licenses-1.25 /go-licenses-1.25 /
721+
COPY --link --from=golang-1.26 /golang-1.26 /
722+
COPY --link --from=go-licenses-1.26 /go-licenses-1.26 /
687723
# add the default golang verison last so its /usr/bin/go
688724
# takes precendent
689725
COPY --link --from=golang-1.20 /golang-1.20 /

builder-base/scripts/install_golang.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ function build::go::extract {
6464

6565
# go stopped building addr2line, doc, objdump, pprof, and trace by default starting with 1.25 so building them here
6666
if [[ "$major_version" -eq 1 && "$minor_version" -ge 25 ]]; then
67-
local binaries=("addr2line" "doc" "objdump" "pprof" "trace")
67+
local binaries=("addr2line" "objdump" "pprof" "trace")
6868
pushd /tmp/go-extracted/go/
6969
for binary in "${binaries[@]}"; do
70-
bin/go build -o "pkg/tool/linux_$TARGETARCH/$binary" "./src/cmd/$binary"
70+
GOROOT=/tmp/go-extracted/go bin/go build -o "pkg/tool/linux_$TARGETARCH/$binary" "cmd/$binary"
7171
done
7272
popd
7373
fi
@@ -147,4 +147,4 @@ mv ${GOPATH} ${NEWROOT}/${GOPATH}
147147
# process, then using the compressed version will require more RAM and/or
148148
# swap space. So, shell programs (bash, csh, etc.) and ``make''
149149
# might not be good candidates for compression.
150-
time upx --best --no-lzma ${NEWROOT}/root/sdk/go${VERSION%-*}/bin/go ${NEWROOT}/root/sdk/go${VERSION%-*}/pkg/tool/linux_$TARGETARCH/{addr2line,asm,cgo,cover,doc,objdump,pprof,trace,vet}
150+
time upx --best --no-lzma ${NEWROOT}/root/sdk/go${VERSION%-*}/bin/go ${NEWROOT}/root/sdk/go${VERSION%-*}/pkg/tool/linux_$TARGETARCH/{addr2line,asm,cgo,cover,objdump,pprof,trace,vet}

builder-base/scripts/validate_components.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ if [ "${FINAL_STAGE_BASE}" = "full-copy-stage" ]; then
7777
/go/go1.24/bin/go-licenses --help
7878
/go/bin/go1.25 version
7979
/go/go1.25/bin/go-licenses --help
80+
/go/bin/go1.26 version
81+
/go/go1.26/bin/go-licenses --help
8082

8183
gcc --version
8284

0 commit comments

Comments
 (0)