From d5dee4e6e4f1d4df37b182e580623e5be62e0f70 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Mon, 16 Jan 2023 14:00:58 +0100 Subject: [PATCH 1/2] gitaly: Build UBI images with Go 1.19 We only build Gitaly's UBI images with Go 1.18, but Gitaly is about to start supporting Go 1.19. Build images for both versions so that Gitaly can upgrade their CI jobs to test with both versions. --- .gitlab/ci/gitaly.images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/ci/gitaly.images.yml b/.gitlab/ci/gitaly.images.yml index ed13e75..e27d4c8 100644 --- a/.gitlab/ci/gitaly.images.yml +++ b/.gitlab/ci/gitaly.images.yml @@ -22,6 +22,6 @@ gitaly: GIT: ['2.36'] - OS: ['ubi:8.6'] RUBY: ['2.7', '3.0'] - GOLANG: ['1.18'] + GOLANG: ['1.18', '1.19'] RUST: ['1.65'] GIT: ['2.36'] From bbca5a7fb9e296b51050e00af74a414a0867e598 Mon Sep 17 00:00:00 2001 From: DJ Mountney Date: Fri, 20 Jan 2023 11:52:09 -0800 Subject: [PATCH 2/2] Updated golang 1.19 build steps for ubi fips golang builds --- scripts/install-golang | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/scripts/install-golang b/scripts/install-golang index 5ff82d1..64873a2 100755 --- a/scripts/install-golang +++ b/scripts/install-golang @@ -15,7 +15,6 @@ function build_debian() { function build_ubi() { GO_MAJOR_VERSION=${INSTALL_GOLANG_VERSION%.*} - GOLANG_FIPS_BRANCH="go${GO_MAJOR_VERSION}-openssl-fips" mkdir -p /tmp/golang curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz @@ -23,16 +22,31 @@ function build_ubi() { tar -C /tmp/golang -xzf golang.tar.gz # For UBI, we will be installing golang-fips - git clone https://github.com/golang-fips/go.git --branch ${GOLANG_FIPS_BRANCH} --single-branch --depth 1 /usr/local/go + # Use a different build process when golang version is less-than-equal to 1.18 + if [[ $(echo -e "1.18\n${GO_MAJOR_VERSION}" | sort -V | tail -1) == '1.18' ]]; then + git clone https://github.com/golang-fips/go.git --branch "go${GO_MAJOR_VERSION}-openssl-fips" --single-branch --depth 1 /usr/local/go - cd /usr/local/go/src + cd /usr/local/go/src + PATH=$PATH:/tmp/golang/go/bin CGO_ENABLED=1 ./make.bash + else + git clone https://github.com/golang-fips/go.git --branch "go${GO_MAJOR_VERSION}-fips-release" --single-branch --depth 1 /tmp/golang-fips + cd /tmp/golang-fips - PATH=$PATH:/tmp/golang/go/bin CGO_ENABLED=1 ./make.bash + # The initialize script ends with a commit, so we need to set the user info. And needs to be global due to submodules in use. + git config --global user.email "builder@example.com" + git config --global user.name "Builder" + + PATH=$PATH:/tmp/golang/go/bin ./scripts/full-initialize-repo.sh + + cd /tmp/golang-fips/go/src + PATH=$PATH:/tmp/golang/go/bin GOROOT_FINAL=/usr/local/go CGO_ENABLED=1 ./make.bash + mv /tmp/golang-fips/go /usr/local/go + fi rm -rf /usr/local/go/pkg/*/cmd /usr/local/go/pkg/bootstrap \ /usr/local/go/pkg/obj /usr/local/go/pkg/tool/*/api \ /usr/local/go/pkg/tool/*/go_bootstrap /usr/local/go/src/cmd/dist/dist \ - /usr/local/go/.git* /tmp/golang + /usr/local/go/.git* /tmp/golang /tmp/golang-fips ln -sf /usr/local/go/bin/go /usr/local/go/bin/gofmt /usr/local/go/bin/godoc /usr/local/bin/ }