From 2ca4a9bee3431865c6814e401b4a84910737b052 Mon Sep 17 00:00:00 2001 From: Ciprian Hacman Date: Tue, 29 Mar 2022 07:22:16 +0300 Subject: [PATCH 1/2] Use golang 1.18.0 explicitly Signed-off-by: Ciprian Hacman --- .github/workflows/main.yml | 8 ++++---- cloudbuild.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c4cfca309..209bb2cedc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: - name: Set up go uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab with: - go-version: 1.18 + go-version: 1.18.0 - uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2 https://api.github.com/repos/actions/checkout/git/tags/629c2de402a417ea7690ca6ce3f33229e27606a5 with: @@ -36,7 +36,7 @@ jobs: - name: Set up go uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab with: - go-version: 1.18 + go-version: 1.18.0 - uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2 https://api.github.com/repos/actions/checkout/git/tags/629c2de402a417ea7690ca6ce3f33229e27606a5 with: @@ -53,7 +53,7 @@ jobs: - name: Set up go uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab with: - go-version: 1.18 + go-version: 1.18.0 - uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2 https://api.github.com/repos/actions/checkout/git/tags/629c2de402a417ea7690ca6ce3f33229e27606a5 with: @@ -70,7 +70,7 @@ jobs: - name: Set up go uses: actions/setup-go@f6164bd8c8acb4a71fb2791a8b6c4024ff038dab with: - go-version: 1.18 + go-version: 1.18.0 - uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5 # v2 https://api.github.com/repos/actions/checkout/git/tags/629c2de402a417ea7690ca6ce3f33229e27606a5 with: diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 0e41e35314..48ce70e6ba 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -5,7 +5,7 @@ options: machineType: 'N1_HIGHCPU_8' steps: # Push the images -- name: 'gcr.io/k8s-staging-test-infra/image-builder:v20220314-46af1b01a6' +- name: 'docker.io/library/golang:1.18.0-bullseye' id: images entrypoint: make env: @@ -20,7 +20,7 @@ steps: - dns-controller-push - kube-apiserver-healthcheck-push # Push the artifacts -- name: 'gcr.io/k8s-staging-test-infra/image-builder:v20220314-46af1b01a6' +- name: 'docker.io/library/golang:1.18.0-bullseye' id: artifacts entrypoint: make env: @@ -35,7 +35,7 @@ steps: args: - gcs-upload-and-tag # Push the manifests -#- name: 'gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20211118-2f2d816b90' +#- name: 'docker.io/library/golang:1.18.0-bullseye' # id: manifests # waitFor: [images] # entrypoint: make @@ -50,7 +50,7 @@ steps: # - dns-controller-manifest # - kube-apiserver-healthcheck-manifest # Build cloudbuild artifacts (for attestation) -- name: 'gcr.io/k8s-staging-test-infra/image-builder:v20220314-46af1b01a6' +- name: 'docker.io/library/golang:1.18.0-bullseye' id: cloudbuild-artifacts entrypoint: make env: From 60d9a955c1c1173363e5eed72b95c391999bb590 Mon Sep 17 00:00:00 2001 From: Ciprian Hacman Date: Tue, 29 Mar 2022 08:46:14 +0300 Subject: [PATCH 2/2] Install gsutil if needed Signed-off-by: Ciprian Hacman --- Makefile | 10 +++++++--- hack/install-gsutil.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) create mode 100755 hack/install-gsutil.sh diff --git a/Makefile b/Makefile index 8418801942..ef3b8b0921 100644 --- a/Makefile +++ b/Makefile @@ -243,13 +243,13 @@ upload: version-dist # Upload kops to S3 # gcs-upload builds kops and uploads to GCS .PHONY: gcs-upload -gcs-upload: version-dist +gcs-upload: gsutil version-dist @echo "== Uploading kops ==" gsutil -h "Cache-Control:private, max-age=0, no-transform" -m cp -n -r ${UPLOAD}/kops/* ${GCS_LOCATION} # gcs-upload-tag runs gcs-upload to upload, then uploads a version-marker to LATEST_FILE .PHONY: gcs-upload-and-tag -gcs-upload-and-tag: gcs-upload +gcs-upload-and-tag: gsutil gcs-upload echo "${GCS_URL}${VERSION}" > ${BAZELUPLOAD}/latest.txt gsutil -h "Cache-Control:private, max-age=0, no-transform" cp ${BAZELUPLOAD}/latest.txt ${GCS_LOCATION}${LATEST_FILE} @@ -292,7 +292,7 @@ bazel-version-ci: bazel-version-dist-linux-amd64 bazel-version-dist-linux-arm64 # The last copy part is to satisfy kubetest2 path expectations .PHONY: gcs-publish-ci gcs-publish-ci: VERSION := ${KOPS_CI_VERSION}+${GITSHA} -gcs-publish-ci: version-dist-ci +gcs-publish-ci: gsutil version-dist-ci @echo "== Uploading kops ==" gsutil -h "Cache-Control:private, max-age=0, no-transform" -m cp -n -r ${UPLOAD}/kops/* ${GCS_LOCATION} echo "VERSION: ${VERSION}" @@ -617,6 +617,10 @@ bazel-push-aws-run: bazel-push ssh ${TARGET} chmod +x /tmp/nodeup ssh -t ${TARGET} sudo SKIP_PACKAGE_UPDATE=1 /tmp/nodeup --conf=/opt/kops/conf/kube_env.yaml --v=8 +.PHONY: gsutil +gsutil: + hack/install-gsutil.sh + .PHONY: ko ko: hack/install-ko.sh diff --git a/hack/install-gsutil.sh b/hack/install-gsutil.sh new file mode 100755 index 0000000000..434286e4e7 --- /dev/null +++ b/hack/install-gsutil.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Copyright 2022 The Kubernetes Authors. +# +# 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. + +set -o errexit +set -o nounset +set -o pipefail + +if ! command -v gsutil &> /dev/null; then + if ! command -v pip3 &> /dev/null; then + apt update + apt -y install python3-pip + fi + pip3 install gsutil +fi