diff --git a/go/cloudbuild-release.yaml b/go/cloudbuild-release.yaml index 74069455..9b19775e 100644 --- a/go/cloudbuild-release.yaml +++ b/go/cloudbuild-release.yaml @@ -34,8 +34,26 @@ steps: ] waitFor: ["go125-build"] + # Go 1.26 build + - name: gcr.io/cloud-builders/docker + args: ["build", "-t", "us-central1-docker.pkg.dev/$PROJECT_ID/release-images/go126", "."] + dir: go/go126-release + id: go126-build + waitFor: ["-"] + - name: gcr.io/gcp-runtimes/structure_test + args: + [ + "-i", + "us-central1-docker.pkg.dev/$PROJECT_ID/release-images/go126", + "--config", + "/workspace/go/go126.yaml", + "-v", + ] + waitFor: ["go126-build"] + images: - us-central1-docker.pkg.dev/$PROJECT_ID/release-images/go125 + - us-central1-docker.pkg.dev/$PROJECT_ID/release-images/go126 options: logging: CLOUD_LOGGING_ONLY diff --git a/go/cloudbuild-test.yaml b/go/cloudbuild-test.yaml index 5a6e9a78..47013ba6 100644 --- a/go/cloudbuild-test.yaml +++ b/go/cloudbuild-test.yaml @@ -85,3 +85,20 @@ steps: "-v", ] waitFor: ["go125-release-build"] + + # Go 1.26 release build + - name: gcr.io/cloud-builders/docker + args: ["build", "-t", "us-central1-docker.pkg.dev/$PROJECT_ID/release-images/go126", "."] + dir: go/go126-release + id: go126-release-build + waitFor: ["-"] + - name: gcr.io/gcp-runtimes/structure_test + args: + [ + "-i", + "us-central1-docker.pkg.dev/$PROJECT_ID/release-images/go126", + "--config", + "/workspace/go/go126-release.yaml", + "-v", + ] + waitFor: ["go126-release-build"] diff --git a/go/go126-release.yaml b/go/go126-release.yaml new file mode 100644 index 00000000..04e35e27 --- /dev/null +++ b/go/go126-release.yaml @@ -0,0 +1,37 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +schemaVersion: 1.0.0 +commandTests: + - name: "version" + command: ["go", "version"] + expectedOutput: ["go version go1.26"] + - name: "gcloud" + command: ["gcloud", "version"] + expectedOutput: ["Google Cloud SDK"] + - name: "python3" + command: ["python3", "--version"] + expectedOutput: ["Python 3.9.13"] + - name: "jq" + command: ["jq", "--version"] + expectedOutput: ["jq-"] + - name: "uuidgen" + command: ["uuidgen", "--version"] + expectedOutput: ["uuidgen"] + - name: "git" + command: ["git", "--version"] + expectedOutput: ["git version"] + - name: "zip" + command: ["zip", "--version"] + expectedOutput: ["This is Zip"] diff --git a/go/go126-release/Dockerfile b/go/go126-release/Dockerfile new file mode 100644 index 00000000..42153f7d --- /dev/null +++ b/go/go126-release/Dockerfile @@ -0,0 +1,74 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM golang:1.26 + +# Install dependencies +RUN set -ex; \ + apt-get update -y; \ + apt-get install -y \ + unzip wget vim jq zip \ + # for docker + apt-transport-https ca-certificates curl gnupg \ + # for SBOM generation + uuid-runtime + +RUN install -m 0755 -d /etc/apt/keyrings && \ + curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \ + chmod a+r /etc/apt/keyrings/docker.gpg && \ + echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + tee /etc/apt/sources.list.d/docker.list > /dev/null && \ + apt-get update +RUN apt-get install -y docker-ce docker-ce-cli containerd.io + +RUN rm -rf /var/lib/apt/lists/* + +# Install protoc +RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protoc-3.13.0-linux-x86_64.zip +RUN unzip protoc-3.13.0-linux-x86_64.zip +RUN mv bin/protoc /bin/protoc && which protoc + +# Install gcloud SDK +RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \ + curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \ + apt-get update -y && apt-get install google-cloud-cli -y + +# Install tools used in build +RUN (export GOTOOLCHAIN='auto' && \ + go install honnef.co/go/tools/cmd/staticcheck@latest && \ + go install github.com/jstemmer/go-junit-report@latest && \ + go install gotest.tools/gotestsum@latest && \ + go install golang.org/x/lint/golint@latest && \ + go install golang.org/x/tools/cmd/goimports@latest) + +# Install pyenv +RUN apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \ + libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \ + xz-utils tk-dev libffi-dev liblzma-dev python3-openssl +RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv + +ENV PATH /root/.pyenv/bin:$PATH +ENV PATH /root/.pyenv/shims:$PATH + +RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> .bashrc && \ + echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> .bashrc && \ + echo 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc + +# Install python +RUN pyenv install 3.9.13 && \ + pyenv global 3.9.13 && \ + python3 -m pip install --upgrade pip setuptools + +WORKDIR $GOPATH