Skip to content

Prepare v0.6.2 #1094

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

Merged
merged 52 commits into from
Aug 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
0b83c77
:running: Run tests with race detector enabled
alvaroaleman Jun 21, 2020
201ac3b
Prefer reconciler from controller.Options
Danil-Grigorev Jun 30, 2020
c0ab285
Change other/minor emoji for PRs to :seedling:
vincepri Jul 1, 2020
5676182
🐛 Better UserAgent for leader-election client (#981)
jdef Jul 10, 2020
361dae7
pkg/predicate.go: add And and Or predicates
joelanford Jul 10, 2020
b90705f
Remove inactive members from OWNERS_ALIASES
nikhita Jul 11, 2020
d60c21c
Merge pull request #1012 from alvaroaleman/re-enable-race
k8s-ci-robot Jul 13, 2020
f98ea97
Merge pull request #1045 from nikhita/cleanup-owners
k8s-ci-robot Jul 14, 2020
32a79b6
optionally override leader election client config
jdef Jul 15, 2020
53289b8
:sparkles: Implement graceful shutdown
alvaroaleman May 26, 2020
4db8229
Merge pull request #1047 from jdef/patch-2
k8s-ci-robot Jul 16, 2020
57ed2a3
Merge pull request #1043 from joelanford/boolean-predicates
k8s-ci-robot Jul 17, 2020
cdda69f
:running: Disable golangs parallel testing
alvaroaleman Jul 19, 2020
229c3c3
Merge pull request #1057 from alvaroaleman/disable-parallel-testing
k8s-ci-robot Jul 20, 2020
bef7dd5
:sparkles: Add IsZero method to reconcile.Result
vincepri Jul 21, 2020
c5fc2a5
Merge pull request #1059 from vincepri/add-iszero-result
k8s-ci-robot Jul 21, 2020
21a81bc
Merge pull request #967 from alvaroaleman/wait-for-stop
k8s-ci-robot Jul 21, 2020
e1ced80
Merge pull request #1022 from Danil-Grigorev/fix-reconciler-options
k8s-ci-robot Jul 21, 2020
d961ff7
:seedling: Remove -parallel flag from test coverage
vincepri Jul 22, 2020
67f09e6
Merge pull request #1062 from vincepri/remove-p4
k8s-ci-robot Jul 22, 2020
a28fa2a
Implement NewPredicateFuncs to create predicate functions from a filt…
jiachengxu Jul 23, 2020
d7ec3bb
:running: Make alvaroaleman approver
alvaroaleman Jul 23, 2020
819181e
Merge pull request #1067 from alvaroaleman/make-alvaroaleman-approves
k8s-ci-robot Jul 23, 2020
57e78d0
Merge pull request #1066 from jiachengxu/new-predicate-funcs
k8s-ci-robot Jul 23, 2020
fb0577a
🐛 Fix allowed levels for --zap-log-levels flag to align with logr le…
bharathi-tenneti Jul 23, 2020
c4b343a
Remove coverage when running tests
vincepri Jul 23, 2020
51487c9
Mark leak goroutine tests as pending
vincepri Jul 23, 2020
e9ea67c
Merge pull request #1069 from vincepri/remove-coverage
k8s-ci-robot Jul 23, 2020
49e1044
Merge pull request #1070 from vincepri/disable-leak-tests
k8s-ci-robot Jul 23, 2020
dbd345f
Fix typo in envtest.Environment struct
jiachengxu Jul 23, 2020
ab02953
Merge pull request #1065 from jiachengxu/fix-webhookinstalloptions
k8s-ci-robot Jul 23, 2020
4804cd6
Enable Logger Injection for Controller Manager
jiachengxu Jul 24, 2020
e50c7b8
Merge pull request #1072 from jiachengxu/logger-injection
k8s-ci-robot Jul 24, 2020
accbce3
Test can inspect stdout & stderr: Give some time to exit
alvaroaleman Jul 27, 2020
cea989b
Merge pull request #1077 from alvaroaleman/use-eventually
k8s-ci-robot Jul 28, 2020
6633846
Generate junit in CI
alvaroaleman Jul 17, 2020
fe03072
hack/setup-envtest.sh: split out and make standalone from hack/check-…
joelanford Jul 31, 2020
6436207
:sparkles: Add ability to set/get logger in/from a context.Context
vincepri Aug 3, 2020
8734ac8
Merge pull request #1092 from joelanford/setup-envtest
k8s-ci-robot Aug 3, 2020
201e747
Merge pull request #1093 from vincepri/log-from-context
k8s-ci-robot Aug 3, 2020
de782a3
Merge pull request #1053 from alvaroaleman/junit
k8s-ci-robot Aug 3, 2020
829c816
:sparkles: Add options to configure a logger for manager and controllers
vincepri Aug 3, 2020
ef57964
Merge pull request #1095 from vincepri/logger-manager-controller
k8s-ci-robot Aug 3, 2020
97f6de4
Update dependencies to Kubernetes v0.18.6
vincepri Aug 3, 2020
a3abd26
Merge pull request #1098 from vincepri/json-patch420
k8s-ci-robot Aug 3, 2020
79de63c
Avoid marshalling error in debug log line
databus23 Jun 10, 2020
bd04ba6
Make individual readiness and liveness checks accessible
jimmidyson Aug 4, 2020
a9bd911
hack/setup-envtest.sh: follow-up from #1092
joelanford Aug 3, 2020
4ebccea
Merge pull request #1100 from jimmidyson/healthz-readyz-paths
k8s-ci-robot Aug 4, 2020
1abbd13
Merge pull request #989 from databus23/patch-2
k8s-ci-robot Aug 4, 2020
6b734aa
Merge pull request #1097 from joelanford/setup-envtest-2
k8s-ci-robot Aug 4, 2020
be832a1
Merge pull request #1024 from vincepri/seedling
k8s-ci-robot Aug 4, 2020
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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE/other.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- please add a :running: (`:running:`) to the title of this PR, and delete this line and similar ones -->
<!-- please add a :seedling: (`:seedling:`) to the title of this PR, and delete this line and similar ones -->

<!-- What does this do, and why do we need it? -->
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- please add a icon to the title of this PR (see VERSIONING.md), and delete this line and similar ones -->
<!-- the icon will be either ⚠ (:warning:, major), ✨ (:sparkles, minor), 🐛 (:bug:, patch), 📖 (:book:, docs), or 🏃 (:running:, other) -->
<!-- the icon will be either ⚠ (:warning:, major), ✨ (:sparkles, minor), 🐛 (:bug:, patch), 📖 (:book:, docs), or 🌱 (:seedling:, other) -->

<!-- What does this do, and why do we need it? -->
3 changes: 1 addition & 2 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ aliases:
- gerred
- shawn-hurley
- joelanford
- alvaroaleman

# folks who can review and LGTM any PRs in the repo (doesn't
# include approvers & admins -- those count too via the OWNERS
# file)
controller-runtime-reviewers:
- alvaroaleman
- alenkacz
- vincepri
- alexeldeib
Expand All @@ -33,7 +33,6 @@ aliases:
testing-integration-approvers:
- apelisse
- hoegaarden
- totherme

# folks who may have context on ancient history,
# but are no longer directly involved
Expand Down
12 changes: 6 additions & 6 deletions VERSIONING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ a:
- Non-breaking feature: :sparkles: (`:sparkles:`)
- Patch fix: :bug: (`:bug:`)
- Docs: :book: (`:book:`)
- Infra/Tests/Other: :running: (`:running:`)
- Infra/Tests/Other: :seedling: (`:seedling:`)
- No release note: :ghost: (`:ghost:`)

Use :ghost: (no release note) only for the PRs that change or revert unreleased
Expand Down Expand Up @@ -156,7 +156,7 @@ after that.

3. Add a release for controller-runtime on GitHub, using those release
notes, with a title of `vX.Y.Z`.

4. Do a similar process for
[controller-tools](https://github.com/kubernetes-sigs/controller-tools)

Expand Down Expand Up @@ -210,10 +210,10 @@ converging on a ergonomic API.

- Users will intuitively see `List`, and use that in new projects, even
if it's marked as deprecated.

- Users who don't notice the deprecation may be confused as to the
difference between `List` and `ListParametric`.

- It's not immediately obvious in isolation (e.g. in surrounding code)
why the method is called `ListParametric`, and may cause confusion
when reading code that makes use of that method.
Expand All @@ -229,8 +229,8 @@ Development branches:

- don't win us much in terms of maintenance in the case of breaking
changes (we still have to merge/manage multiple branches for development
and stable)
and stable)

- can be confusing to contributors, who often expect master to have the
latest changes.

Expand Down
5 changes: 5 additions & 0 deletions alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ var (
// get any actual logging.
Log = log.Log

// LoggerFromContext returns a logger with predefined values from a context.Context.
//
// This is meant to be used with the context supplied in a struct that satisfies the Reconciler interface.
LoggerFromContext = log.FromContext

// SetLogger sets a concrete logging implementation for all deferred Loggers.
SetLogger = log.SetLogger
)
10 changes: 4 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ require (
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
gomodules.xyz/jsonpatch/v2 v2.0.1
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
k8s.io/api v0.18.4
k8s.io/apiextensions-apiserver v0.18.4
k8s.io/apimachinery v0.18.4
k8s.io/client-go v0.18.4
k8s.io/api v0.18.6
k8s.io/apiextensions-apiserver v0.18.6
k8s.io/apimachinery v0.18.6
k8s.io/client-go v0.18.6
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451
sigs.k8s.io/yaml v1.2.0
)

replace github.com/evanphx/json-patch => github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8
27 changes: 14 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ github.com/emicklei/go-restful v2.9.5+incompatible h1:spTtZBk5DYEvbxMVutUuTyh1Ao
github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8 h1:DM7gHzQfHwIj+St8zaPOI6iQEPAxOwIkskvw6s9rDaM=
github.com/evanphx/json-patch v0.0.0-20190815234213-e83c0a1c26c8/go.mod h1:pmLOTb3x90VhIKxsA9yeQG5yfOkkKnkk1h+Ql8NDYDw=
github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M=
github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
Expand Down Expand Up @@ -498,17 +499,17 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/api v0.18.4 h1:8x49nBRxuXGUlDlwlWd3RMY1SayZrzFfxea3UZSkFw4=
k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4=
k8s.io/apiextensions-apiserver v0.18.4 h1:Y3HGERmS8t9u12YNUFoOISqefaoGRuTc43AYCLzWmWE=
k8s.io/apiextensions-apiserver v0.18.4/go.mod h1:NYeyeYq4SIpFlPxSAB6jHPIdvu3hL0pc36wuRChybio=
k8s.io/apimachinery v0.18.4 h1:ST2beySjhqwJoIFk6p7Hp5v5O0hYY6Gngq/gUYXTPIA=
k8s.io/apimachinery v0.18.4/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/apiserver v0.18.4/go.mod h1:q+zoFct5ABNnYkGIaGQ3bcbUNdmPyOCoEBcg51LChY8=
k8s.io/client-go v0.18.4 h1:un55V1Q/B3JO3A76eS0kUSywgGK/WR3BQ8fHQjNa6Zc=
k8s.io/client-go v0.18.4/go.mod h1:f5sXwL4yAZRkAtzOxRWUhA/N8XzGCb+nPZI8PfobZ9g=
k8s.io/code-generator v0.18.4/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
k8s.io/component-base v0.18.4/go.mod h1:7jr/Ef5PGmKwQhyAz/pjByxJbC58mhKAhiaDu0vXfPk=
k8s.io/api v0.18.6 h1:osqrAXbOQjkKIWDTjrqxWQ3w0GkKb1KA1XkUGHHYpeE=
k8s.io/api v0.18.6/go.mod h1:eeyxr+cwCjMdLAmr2W3RyDI0VvTawSg/3RFFBEnmZGI=
k8s.io/apiextensions-apiserver v0.18.6 h1:vDlk7cyFsDyfwn2rNAO2DbmUbvXy5yT5GE3rrqOzaMo=
k8s.io/apiextensions-apiserver v0.18.6/go.mod h1:lv89S7fUysXjLZO7ke783xOwVTm6lKizADfvUM/SS/M=
k8s.io/apimachinery v0.18.6 h1:RtFHnfGNfd1N0LeSrKCUznz5xtUP1elRGvHJbL3Ntag=
k8s.io/apimachinery v0.18.6/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
k8s.io/apiserver v0.18.6/go.mod h1:Zt2XvTHuaZjBz6EFYzpp+X4hTmgWGy8AthNVnTdm3Wg=
k8s.io/client-go v0.18.6 h1:I+oWqJbibLSGsZj8Xs8F0aWVXJVIoUHWaaJV3kUN/Zw=
k8s.io/client-go v0.18.6/go.mod h1:/fwtGLjYMS1MaM5oi+eXhKwG+1UHidUEXRh6cNsdO0Q=
k8s.io/code-generator v0.18.6/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c=
k8s.io/component-base v0.18.6/go.mod h1:knSVsibPR5K6EW2XOjEHik6sdU5nCvKMrzMt2D4In14=
k8s.io/gengo v0.0.0-20190128074634-0689ccc1d7d6/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200114144118-36b2048a9120/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
Expand Down
66 changes: 8 additions & 58 deletions hack/check-everything.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,72 +14,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -e
set -o errexit
set -o nounset
set -o pipefail

hack_dir=$(dirname ${BASH_SOURCE})
source ${hack_dir}/common.sh

k8s_version=1.16.4
goarch=amd64
goos="unknown"

if [[ "$OSTYPE" == "linux-gnu" ]]; then
goos="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
goos="darwin"
fi

if [[ "$goos" == "unknown" ]]; then
echo "OS '$OSTYPE' not supported. Aborting." >&2
exit 1
fi
source ${hack_dir}/setup-envtest.sh

tmp_root=/tmp
kb_root_dir=$tmp_root/kubebuilder

# Skip fetching and untaring the tools by setting the SKIP_FETCH_TOOLS variable
# in your environment to any value:
#
# $ SKIP_FETCH_TOOLS=1 ./check-everything.sh
#
# If you skip fetching tools, this script will use the tools already on your
# machine, but rebuild the kubebuilder and kubebuilder-bin binaries.
SKIP_FETCH_TOOLS=${SKIP_FETCH_TOOLS:-""}

# fetch k8s API gen tools and make it available under kb_root_dir/bin.
function fetch_kb_tools {
local dest_dir="${1}"

# use the pre-existing version in the temporary folder if it matches our k8s version
if [[ -x "${dest_dir}/kubebuilder/bin/kube-apiserver" ]]; then
version=$("${dest_dir}"/kubebuilder/bin/kube-apiserver --version)
if [[ $version == *"${k8s_version}"* ]]; then
header_text "Using cached kubebuilder-tools from ${dest_dir}"
return 0
fi
fi

header_text "fetching tools (into '${dest_dir}')"
kb_tools_archive_name="kubebuilder-tools-$k8s_version-$goos-$goarch.tar.gz"
kb_tools_download_url="https://storage.googleapis.com/kubebuilder-tools/$kb_tools_archive_name"

kb_tools_archive_path="$tmp_root/$kb_tools_archive_name"
if [ ! -f $kb_tools_archive_path ]; then
curl -sL ${kb_tools_download_url} -o "$kb_tools_archive_path"
fi

mkdir -p "${dest_dir}"
tar -C "${dest_dir}" --strip-components=1 -zvxf "$kb_tools_archive_path"
}

header_text "using tools"

if [ -z "$SKIP_FETCH_TOOLS" ]; then
fetch_kb_tools "$kb_root_dir"
fetch_kb_tools "${hack_dir}/../pkg/internal/testing/integration/assets"
fi
ENVTEST_K8S_VERSION=${ENVTEST_K8S_VERSION:-"1.16.4"}

setup_envs
fetch_envtest_tools "$kb_root_dir"
fetch_envtest_tools "${hack_dir}/../pkg/internal/testing/integration/assets"
setup_envtest_env "$kb_root_dir"

${hack_dir}/verify.sh
${hack_dir}/test-all.sh
Expand Down
9 changes: 0 additions & 9 deletions hack/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,3 @@ fi
function header_text {
echo "$header$*$reset"
}

function setup_envs {
header_text "setting up env vars"

# Setup env vars
if [[ -z "${KUBEBUILDER_ASSETS}" ]]; then
export KUBEBUILDER_ASSETS=$kb_root_dir/bin
fi
}
8 changes: 6 additions & 2 deletions hack/release/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ cr_minor_pattern=":sparkles:|$(printf "\xe2\x9c\xa8")"
cr_patch_pattern=":bug:|$(printf "\xf0\x9f\x90\x9b")"
cr_docs_pattern=":book:|$(printf "\xf0\x9f\x93\x96")"
cr_no_release_note_pattern=":ghost:|$(printf "\xf0\x9f\x91\xbb")"
cr_other_pattern=":running:|$(printf "\xf0\x9f\x8f\x83")"
cr_all_pattern="${cr_major_pattern}|${cr_minor_pattern}|${cr_patch_pattern}|${cr_docs_pattern}|${cr_other_pattern}"
cr_other_pattern=":seedling:|$(printf "\xf0\x9f\x8f\x83")"
cr_other_old_pattern=":running:|$(printf "\xf0\x9f\x8f\x83")"
cr_all_pattern="${cr_major_pattern}|${cr_minor_pattern}|${cr_patch_pattern}|${cr_docs_pattern}|${cr_other_old_pattern}|${cr_other_pattern}"

# cr::symbol-type-raw turns :xyz: and the corresponding emoji
# into one of "major", "minor", "patch", "docs", "other", or
Expand All @@ -32,6 +33,9 @@ cr::symbol-type-raw() {
@(${cr_other_pattern})?('!'))
echo "other"
;;
@(${cr_other_old_pattern})?('!'))
echo "other"
;;
*)
echo "unknown"
;;
Expand Down
96 changes: 96 additions & 0 deletions hack/setup-envtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env bash

# Copyright 2020 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 pipefail

# Turn colors in this script off by setting the NO_COLOR variable in your
# environment to any value:
#
# $ NO_COLOR=1 test.sh
NO_COLOR=${NO_COLOR:-""}
if [ -z "$NO_COLOR" ]; then
header=$'\e[1;33m'
reset=$'\e[0m'
else
header=''
reset=''
fi

function header_text {
echo "$header$*$reset"
}

function setup_envtest_env {
header_text "setting up env vars"

# Setup env vars
KUBEBUILDER_ASSETS=${KUBEBUILDER_ASSETS:-""}
if [[ -z "${KUBEBUILDER_ASSETS}" ]]; then
export KUBEBUILDER_ASSETS=$1/bin
fi
}

# fetch k8s API gen tools and make it available under envtest_root_dir/bin.
#
# Skip fetching and untaring the tools by setting the SKIP_FETCH_TOOLS variable
# in your environment to any value:
#
# $ SKIP_FETCH_TOOLS=1 ./check-everything.sh
#
# If you skip fetching tools, this script will use the tools already on your
# machine.
function fetch_envtest_tools {
SKIP_FETCH_TOOLS=${SKIP_FETCH_TOOLS:-""}
if [ -n "$SKIP_FETCH_TOOLS" ]; then
return 0
fi

tmp_root=/tmp
envtest_root_dir=$tmp_root/envtest

k8s_version="${ENVTEST_K8S_VERSION:-1.16.4}"
goarch="$(go env GOARCH)"
goos="$(go env GOOS)"

if [[ "$goos" != "linux" && "$goos" != "darwin" ]]; then
echo "OS '$goos' not supported. Aborting." >&2
return 1
fi

local dest_dir="${1}"

# use the pre-existing version in the temporary folder if it matches our k8s version
if [[ -x "${dest_dir}/bin/kube-apiserver" ]]; then
version=$("${dest_dir}"/bin/kube-apiserver --version)
if [[ $version == *"${k8s_version}"* ]]; then
header_text "Using cached envtest tools from ${dest_dir}"
return 0
fi
fi

header_text "fetching envtest tools@${k8s_version} (into '${dest_dir}')"
envtest_tools_archive_name="kubebuilder-tools-$k8s_version-$goos-$goarch.tar.gz"
envtest_tools_download_url="https://storage.googleapis.com/kubebuilder-tools/$envtest_tools_archive_name"

envtest_tools_archive_path="$tmp_root/$envtest_tools_archive_name"
if [ ! -f $envtest_tools_archive_path ]; then
curl -sL ${envtest_tools_download_url} -o "$envtest_tools_archive_path"
fi

mkdir -p "${dest_dir}"
tar -C "${dest_dir}" --strip-components=1 -zvxf "$envtest_tools_archive_path"
}
17 changes: 3 additions & 14 deletions hack/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,10 @@ set -e

source $(dirname ${BASH_SOURCE})/common.sh

setup_envs

header_text "running go test"

# TODO(directxman12): enable the race detector once the LeaderElector race condition is resolved in client-go
go test ${MOD_OPT} ./... -parallel 4

header_text "running coverage"
go test -race ${MOD_OPT} ./...

# Verify no coverage regressions have been introduced. Remove the exception list from here
# once the coverage has been brought back up
if [[ ! $(go test ${MOD_OPT} ./pkg/... -coverprofile cover.out -parallel 4 | grep -v "coverage: 100.0% of statements" | grep "controller-runtime/pkg " | grep -v "controller-runtime/pkg \|controller-runtime/pkg/recorder \|pkg/cache\|pkg/client \|pkg/event \|pkg/client/config \|pkg/controller/controllertest \|pkg/reconcile/reconciletest \|pkg/test ") ]]; then
echo "ok"
else
go test ${MOD_OPT} ./pkg/... -coverprofile cover.out -parallel 4 | grep -v "coverage: 100.0% of statements" | grep "controller-runtime/pkg " | grep -v "controller-runtime/pkg \|controller-runtime/pkg/recorder \|pkg/cache\|pkg/client \|pkg/event \|pkg/client/config \|pkg/controller/controllertest \|pkg/reconcile/reconciletest \|pkg/test "
echo "missing test coverage"
exit 1
if [[ -n ${ARTIFACTS:-} ]]; then
if grep -Rin '<failure type="Failure">' ${ARTIFACTS}/*; then exit 1; fi
fi
3 changes: 2 additions & 1 deletion pkg/builder/builder_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import (

func TestBuilder(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecsWithDefaultAndCustomReporters(t, "application Suite", []Reporter{printer.NewlineReporter{}})
suiteName := "application Suite"
RunSpecsWithDefaultAndCustomReporters(t, suiteName, []Reporter{printer.NewlineReporter{}, printer.NewProwReporter(suiteName)})
}

var testenv *envtest.Environment
Expand Down
Loading