Skip to content
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

Bump to exact Go versions during update-golang #2757

Merged
merged 3 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions ci/autoscaler/tasks/update-sdk/update_golang_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,25 @@
[ -n "${DEBUG}" ] && set -x
set -euo pipefail

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
script_dir="$(cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
source "${script_dir}/vars.source.sh"
source "${script_dir}/vendor_package.sh"

golang_dir=${GOLANG_DIR:-"${autoscaler_dir}/../golang-release"}
export golang_dir="$(realpath -e "${golang_dir}")"
golang_dir="$(realpath -e "${golang_dir}")"
export golang_dir

SED="sed"
which gsed >/dev/null && SED=gsed
golang_version=$(cat "${golang_dir}/packages/golang-1-linux/version")

# shellcheck disable=SC2154
golang_version=$( cat "${golang_dir}/packages/golang-1-linux/version")
stripped_go_version=$(echo "${golang_version}" | cut -d . -f -2)
step "updating go.work file with golang version ${golang_version}"
go work edit -go "${golang_version}" "${autoscaler_dir}/go.work"

step "updating mod files with ${stripped_go_version}"
# shellcheck disable=SC2154
find "${autoscaler_dir}" -name go.mod -type f -exec ${SED} -i "s/^[[:space:]]*go 1.*/go ${stripped_go_version}/g" "{}" \;
step "updating go.mod files with golang version ${golang_version}"
find "${autoscaler_dir}" -name go.mod -type f -exec go mod edit -go "${golang_version}" "{}" \;

step "updating .tool-version with ${golang_version}"
"${SED}" -i "s/golang 1.*/golang ${golang_version}/g" "${autoscaler_dir}/.tool-versions"
step "updating .tool-versions file with golang version ${golang_version}"
sed -i "s/golang 1.*/golang ${golang_version}/g" "${autoscaler_dir}/.tool-versions"

echo -n "${golang_version}" > "${autoscaler_dir}/version"
vendor-package "${golang_dir}" golang-1-linux "${golang_version}"

echo -n "${golang_version}" > ${autoscaler_dir}/version
vendor-package "$golang_dir" golang-1-linux "${golang_version}"
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module apitester

go 1.21
go 1.21.3
2 changes: 1 addition & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.21
go 1.21.3

use (
./src/acceptance
Expand Down
2 changes: 1 addition & 1 deletion src/acceptance/assets/app/go_app/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module code.cloudfoundry.org/app-autoscaler-release/src/acceptance/assets/app/go_app

go 1.21
go 1.21.3

require (
github.com/cloudfoundry-community/go-cfenv v1.18.0
Expand Down
2 changes: 1 addition & 1 deletion src/acceptance/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module acceptance

go 1.21
go 1.21.3

require (
github.com/cloudfoundry/cf-test-helpers/v2 v2.9.0
Expand Down
4 changes: 3 additions & 1 deletion src/autoscaler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ openapi-generated-clients-and-servers-files = $(wildcard ${openapi-generated-cli
generate-openapi-generated-clients-and-servers: ${openapi-generated-clients-and-servers-dir} ${openapi-generated-clients-and-servers-files}
${openapi-generated-clients-and-servers-dir} ${openapi-generated-clients-and-servers-files} &: $(wildcard ./helpers/apis/generate.go) ${openapi-specs-list} ./go.mod ./go.sum
@echo "# Generating OpenAPI clients and servers"
go generate ./helpers/apis/generate.go
# $(wildcard ./helpers/apis/generate.go) causes the target to always being executed, no matter if file exists or not.
# so let's don't fail if file can't be found, e.g. the eventgenerator bosh package does not contain it.
go generate ./helpers/apis/generate.go || true
silvestre marked this conversation as resolved.
Show resolved Hide resolved

# The presence of the subsequent directory indicates whether the fakes still need to be generated
# or not.
Expand Down
2 changes: 1 addition & 1 deletion src/autoscaler/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module code.cloudfoundry.org/app-autoscaler/src/autoscaler

go 1.21
go 1.21.3

require (
code.cloudfoundry.org/cfhttp/v2 v2.0.1-0.20230113212937-05beac96f8c7
Expand Down
2 changes: 1 addition & 1 deletion src/changelog/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module changelog

go 1.21
go 1.21.3

require (
github.com/Masterminds/semver/v3 v3.2.1
Expand Down
2 changes: 1 addition & 1 deletion src/changeloglockcleaner/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module changeloglockcleaner

go 1.21
go 1.21.3

require (
github.com/go-sql-driver/mysql v1.8.0
Expand Down
Loading