-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Add update-go-version and goversioncheck targets
Until recently we were using a very outdated golang 1.13.4 release (latest is 1.13.15). This commit adds an 'update-go-version' Makefile target which will automatically update the golang version to the latest release ones in the various files where we explicitly set it. It also adds a 'goversioncheck' target which can be used in the future by CI to get notifications when the golang version that we use is out of date.
- Loading branch information
1 parent
d32d37f
commit 8cc1c01
Showing
4 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
build: off | ||
|
||
clone_folder: c:\gopath\src\github.com\code-ready\crc | ||
|
||
environment: | ||
GOPATH: c:\gopath | ||
|
||
stack: go 1.14 | ||
|
||
before_test: | ||
- choco install make | ||
- make cross | ||
|
||
test_script: | ||
- make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# Updates our various build files, CI configs, ... to the latest released go | ||
# version in a given minor release stream (1.x) | ||
# This requires yq and jq in addition to fairly standard shell tools (curl, grep, sed, ...) | ||
|
||
golang_base_version=$1 | ||
latest_version=$(curl --silent 'https://golang.org/dl/?mode=json&include=all' | jq -r '.[].files[].version' |uniq | sed -e 's/go//' |sort -V |grep ${golang_base_version}|tail -1) | ||
echo "Updating golang version to $latest_version" | ||
|
||
go mod edit -go ${golang_base_version} | ||
sed -i "s,^FROM registry.svc.ci.openshift.org/openshift/release:golang-1\... AS builder\$,FROM registry.svc.ci.openshift.org/openshift/release:golang-${golang_base_version} AS builder," images/openshift-ci/Dockerfile | ||
sed -i "s/GOVERSION: .*\$/GOVERSION: \"${latest_version}\"/" .circleci/config.yml | ||
sed -i "s/^GO_VERSION=.*$/GO_VERSION=${latest_version}/" centos_ci.sh | ||
yq write --inplace ./appveyor.yml stack "go ${golang_base_version}" | ||
yq write --inplace ./.travis.yml go[0] ${latest_version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
export GO111MODULE=on | ||
|
||
readonly REPO_ROOT_DIR="$(git rev-parse --show-toplevel 2> /dev/null)" | ||
readonly TMP_DIFFROOT="$(mktemp -d "${REPO_ROOT_DIR}"/tmpdiffroot.XXXXXX)" | ||
|
||
cleanup() { | ||
rm -rf "${TMP_DIFFROOT}" | ||
} | ||
|
||
trap "cleanup" EXIT SIGINT | ||
|
||
cleanup | ||
|
||
git clone "${REPO_ROOT_DIR}" "${TMP_DIFFROOT}" | ||
|
||
make -C "${TMP_DIFFROOT}" update-go-version | ||
|
||
echo "Diffing ${REPO_ROOT_DIR} against tree with freshly updated golang version" | ||
ret=0 | ||
git --no-pager -C ${TMP_DIFFROOT} diff --exit-code 2>&1 >/dev/null || ret=1 | ||
#diff -Naupr "${REPO_ROOT_DIR}/vendor" "${TMP_DIFFROOT}/vendor" || ret=1 | ||
|
||
if [[ $ret -eq 0 ]] | ||
then | ||
echo "${REPO_ROOT_DIR} up to date." | ||
else | ||
echo "${REPO_ROOT_DIR} is out of date. Please run make update-go-version" | ||
exit 1 | ||
fi |