Skip to content

Commit b4ad72a

Browse files
Update the release tooling for go 1.10
1 parent 5061f3c commit b4ad72a

21 files changed

+697
-106
lines changed

hack/build-images.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ os::util::ensure::gopath_binary_exists imagebuilder
2020
os::build::release::check_for_rpms
2121

2222
# we need to mount RPMs into the container builds for installation
23-
OS_BUILD_IMAGE_ARGS="${OS_BUILD_IMAGE_ARGS:-} -mount ${OS_OUTPUT_RPMPATH}/:/srv/origin-local-release/"
23+
cat <<END > "${OS_OUTPUT_RPMPATH}/_local.repo"
24+
[origin-local-release]
25+
name = OpenShift Origin Release from Local Source
26+
baseurl = file:///srv/origin-local-release/
27+
gpgcheck = 0
28+
enabled = 0
29+
END
30+
OS_BUILD_IMAGE_ARGS="${OS_BUILD_IMAGE_ARGS:-} -mount ${OS_OUTPUT_RPMPATH}/:/srv/origin-local-release/ -mount ${OS_OUTPUT_RPMPATH}/_local.repo:/etc/yum.repos.d/origin-local-release.repo"
2431

2532
os::build::images

hack/deps

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ if [[ $# -eq 0 ]]; then
2626
fi
2727

2828
os::util::ensure::system_binary_exists 'digraph'
29-
cat "${OS_OUTPUT}/deps" | digraph $@
29+
digraph "${@}" <"${OS_OUTPUT}/deps"

hack/lib/build/binaries.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ function os::build::setup_env() {
8585
if [[ "${TRAVIS:-}" != "true" ]]; then
8686
local go_version
8787
go_version=($(go version))
88-
if [[ "${go_version[2]}" < "${OS_REQUIRED_GO_VERSION}" ]]; then
88+
local expected_order=$(printf "%s\n%s\n" "${OS_REQUIRED_GO_VERSION}" "${go_version[2]}")
89+
local actual_order=$(echo "${expected_order}" | sort --version-sort)
90+
if [[ "${actual_order}" != "${expected_order}" ]]; then
8991
os::log::fatal "Detected Go version: ${go_version[*]}.
9092
Builds require Go version ${OS_REQUIRED_GO_VERSION} or greater."
9193
fi

hack/lib/cmd.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ readonly -f os::cmd::internal::get_results
383383

384384
# os::cmd::internal::get_last_results prints the stderr and stdout from the last attempt
385385
function os::cmd::internal::get_last_results() {
386-
cat "${os_cmd_internal_tmpout}" | awk 'BEGIN { RS = "\x1e" } END { print $0 }'
387-
cat "${os_cmd_internal_tmperr}" | awk 'BEGIN { RS = "\x1e" } END { print $0 }'
386+
awk 'BEGIN { RS = "\x1e" } END { print $0 }' <"${os_cmd_internal_tmpout}"
387+
awk 'BEGIN { RS = "\x1e" } END { print $0 }' <"${os_cmd_internal_tmperr}"
388388
}
389389
readonly -f os::cmd::internal::get_last_results
390390

hack/lib/test/junit.sh

-59
Original file line numberDiff line numberDiff line change
@@ -143,62 +143,3 @@ function os::test::junit::reconcile_output() {
143143
done
144144
}
145145
readonly -f os::test::junit::reconcile_output
146-
147-
# os::test::junit::generate_report determines which type of report is to
148-
# be generated and does so from the raw output of the tests.
149-
#
150-
# Globals:
151-
# - JUNIT_REPORT_OUTPUT
152-
# - ARTIFACT_DIR
153-
# Arguments:
154-
# None
155-
# Returns:
156-
# None
157-
function os::test::junit::generate_report() {
158-
if [[ -z "${JUNIT_REPORT_OUTPUT:-}" ||
159-
-n "${JUNIT_REPORT_OUTPUT:-}" && ! -s "${JUNIT_REPORT_OUTPUT:-}" ]]; then
160-
# we can't generate a report
161-
return
162-
fi
163-
164-
if grep -q "=== END TEST CASE ===" "${JUNIT_REPORT_OUTPUT}"; then
165-
os::test::junit::reconcile_output
166-
os::test::junit::check_test_counters
167-
os::test::junit::internal::generate_report "oscmd"
168-
else
169-
os::test::junit::internal::generate_report "gotest"
170-
fi
171-
}
172-
173-
# os::test::junit::internal::generate_report generats an XML jUnit
174-
# report for either `os::cmd` or `go test`, based on the passed
175-
# argument. If the `junitreport` binary is not present, it will be built.
176-
#
177-
# Globals:
178-
# - JUNIT_REPORT_OUTPUT
179-
# - ARTIFACT_DIR
180-
# Arguments:
181-
# - 1: specify which type of tests command output should junitreport read
182-
# Returns:
183-
# export JUNIT_REPORT_NUM_FAILED
184-
function os::test::junit::internal::generate_report() {
185-
local report_type="$1"
186-
os::util::ensure::built_binary_exists 'junitreport'
187-
188-
local report_file
189-
report_file="$( mktemp "${ARTIFACT_DIR}/${report_type}_report_XXXXX" ).xml"
190-
os::log::info "jUnit XML report placed at $( os::util::repository_relative_path ${report_file} )"
191-
junitreport --type "${report_type}" \
192-
--suites nested \
193-
--roots github.com/openshift/origin \
194-
--output "${report_file}" \
195-
<"${JUNIT_REPORT_OUTPUT}"
196-
197-
local summary
198-
summary=$( junitreport summarize <"${report_file}" )
199-
200-
JUNIT_REPORT_NUM_FAILED="$( grep -oE "[0-9]+ failed" <<<"${summary}" )"
201-
export JUNIT_REPORT_NUM_FAILED
202-
203-
echo "${summary}"
204-
}

hack/lib/util/golang.sh

-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
11
#!/bin/bash
22
#
33
# This library holds golang related utility functions.
4-
5-
# os::golang::verify_go_version ensure the go tool exists and is a viable version.
6-
function os::golang::verify_go_version() {
7-
os::util::ensure::system_binary_exists 'go'
8-
9-
local go_version
10-
go_version=($(go version))
11-
if [[ "${go_version[2]}" != go1.8* ]]; then
12-
os::log::info "Detected go version: ${go_version[*]}."
13-
if [[ -z "${PERMISSIVE_GO:-}" ]]; then
14-
os::log::warning "Please install Go version ${OS_REQUIRED_GO_VERSION} or use PERMISSIVE_GO=y to bypass this check."
15-
return 0
16-
else
17-
os::log::warning "Detected golang version doesn't match required Go version."
18-
os::log::warning "This version mismatch could lead to differences in execution between this run and the CI systems."
19-
return 0
20-
fi
21-
fi
22-
}
23-
readonly -f os::golang::verify_go_version

hack/test-go.sh

+6-12
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@
2121
function cleanup() {
2222
return_code=$?
2323

24-
os::test::junit::generate_report
25-
if [[ "${JUNIT_REPORT_NUM_FAILED:-}" == "0 failed" ]]; then
26-
if [[ "${return_code}" -ne "0" ]]; then
27-
os::log::warning "While the jUnit report found no failed tests, the \`go test\` process failed."
28-
os::log::warning "This usually means that the unit test suite failed to compile."
29-
fi
30-
fi
31-
3224
os::util::describe_return_code "${return_code}"
3325
exit "${return_code}"
3426
}
@@ -135,11 +127,15 @@ if [[ -n "${junit_report}" ]]; then
135127
# we don't care if the `go test` fails in this pipe, as we want to generate the report and summarize the output anyway
136128
set +o pipefail
137129

138-
go test -i ${gotest_flags} ${test_packages}
139-
go test ${gotest_flags} ${test_packages} 2>"${test_error_file}" | tee "${JUNIT_REPORT_OUTPUT}"
130+
os::util::ensure::built_binary_exists 'gotest2junit'
131+
report_file="$( mktemp "${ARTIFACT_DIR}/unit_report_XXXXX" ).xml"
140132

133+
go test -json ${gotest_flags} ${test_packages} 2>"${test_error_file}" | tee "${JUNIT_REPORT_OUTPUT}" | gotest2junit > "${report_file}"
141134
test_return_code="${PIPESTATUS[0]}"
142135

136+
gzip "${test_error_file}" -c > "${ARTIFACT_DIR}/unit-error.log.gz"
137+
gzip "${JUNIT_REPORT_OUTPUT}" -c > "${ARTIFACT_DIR}/unit.log.gz"
138+
143139
set -o pipefail
144140

145141
if [[ -s "${test_error_file}" ]]; then
@@ -162,7 +158,6 @@ $( cat "${test_error_file}") "
162158

163159
elif [[ -n "${coverage_output_dir}" ]]; then
164160
# we need to generate coverage reports
165-
go test -i ${gotest_flags} ${test_packages}
166161
for test_package in ${test_packages}; do
167162
mkdir -p "${coverage_output_dir}/${test_package}"
168163
local_gotest_flags="${gotest_flags} -coverprofile=${coverage_output_dir}/${test_package}/profile.out"
@@ -187,6 +182,5 @@ elif [[ -n "${dlv_debug}" ]]; then
187182
dlv test ${test_packages}
188183
else
189184
# we need to generate neither jUnit XML nor coverage reports
190-
go test -i ${gotest_flags} ${test_packages}
191185
go test ${gotest_flags} ${test_packages}
192186
fi

hack/verify-gofmt.sh

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ function cleanup() {
88
}
99
trap "cleanup" EXIT
1010

11-
os::golang::verify_go_version
12-
1311
bad_files=$(os::util::list_go_src_files | xargs gofmt -s -l)
1412
if [[ -n "${bad_files}" ]]; then
1513
os::log::warning "!!! gofmt needs to be run on the listed files"

hack/verify-golint.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22
source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
33

4-
os::golang::verify_go_version
54
os::util::ensure::system_binary_exists 'golint'
65

76
arg="${1:-""}"

hack/verify-govet.sh

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ function cleanup() {
88
}
99
trap "cleanup" EXIT
1010

11-
os::golang::verify_go_version
12-
1311
govet_blacklist=( "${OS_GOVET_BLACKLIST[@]-}" )
1412

1513
function govet_blacklist_contains() {

hack/verify-imports.sh

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
66

77
function cleanup() {
88
return_code=$?
9-
os::test::junit::generate_report
109
os::util::describe_return_code "${return_code}"
1110
exit "${return_code}"
1211
}

hack/verify-upstream-commits.sh

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ source "$(dirname "${BASH_SOURCE}")/lib/init.sh"
33

44
function cleanup() {
55
return_code=$?
6-
os::test::junit::generate_report
76
os::util::describe_return_code "${return_code}"
87
exit "${return_code}"
98
}

tools/changelog/changelog.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func main() {
183183
// github merge
184184

185185
// has api changes
186-
display := fmt.Sprintf("%s [\\#%s](https://github.com/openshift/origin/pull/%s)", message, matches[1], matches[1])
186+
display := fmt.Sprintf("%s [\\#%s](https://github.com/openshift/origin-web-console-server/pull/%s)", message, matches[1], matches[1])
187187
if hasFileChanges(c.short, "api/") {
188188
apiChanges = append(apiChanges, display)
189189
}

0 commit comments

Comments
 (0)