diff --git a/build/README.md b/build/README.md index 514366cfc26..dc23bdfc958 100644 --- a/build/README.md +++ b/build/README.md @@ -62,7 +62,7 @@ In addition, there are some other tar files that are created: When building final release tars, they are first staged into `_output/release-stage` before being tar'd up and put into `_output/release-tars`. ## Reproducibility -`make release`, its variant `make quick-release`, and Bazel all provide a +`make release` and its variant `make quick-release` provide a hermetic build environment which should provide some level of reproducibility for builds. `make` itself is **not** hermetic. diff --git a/build/root/Makefile b/build/root/Makefile index 11af1ec9213..43ce95f8f4d 100644 --- a/build/root/Makefile +++ b/build/root/Makefile @@ -117,7 +117,7 @@ define VERIFY_HELP_INFO # Example: # make verify # make verify BRANCH=branch_x -# make verify WHAT="bazel typecheck" +# make verify WHAT="gofmt typecheck" endef .PHONY: verify ifeq ($(PRINT_HELP),y) @@ -563,71 +563,3 @@ else help: hack/make-rules/make-help.sh endif - -# Non-dockerized bazel rules. -.PHONY: bazel-build bazel-test bazel-release - -ifeq ($(PRINT_HELP),y) -define BAZEL_BUILD_HELP_INFO -# Build with bazel -# -# Example: -# make bazel-build -endef -bazel-build: - @echo "$$BAZEL_BUILD_HELP_INFO" -else -# Some things in vendor don't build due to empty target lists for cross-platform rules. -bazel-build: - bazel build -- //... -//vendor/... -endif - - -ifeq ($(PRINT_HELP),y) -define BAZEL_TEST_HELP_INFO -# Test with bazel -# -# Example: -# make bazel-test -endef -bazel-test: - @echo "$$BAZEL_TEST_HELP_INFO" -else -# //hack:verify-all is a manual target. -# Some things in vendor don't build due to empty target lists for cross-platform rules. -bazel-test: - bazel test --config=unit -- \ - //... \ - //hack:verify-all \ - -//vendor/... -endif - -ifeq ($(PRINT_HELP),y) -define BAZEL_TEST_INTEGRATION_HELP_INFO -# Integration test with bazel -# -# Example: -# make bazel-test-integration -endef -bazel-test-integration: - @echo "$$BAZEL_TEST_INTEGRATION_HELP_INFO" -else -bazel-test-integration: - bazel test --config integration //test/integration/... -endif - -ifeq ($(PRINT_HELP),y) -define BAZEL_RELEASE_HELP_INFO -# Build release tars with bazel -# -# Example: -# make bazel-release -endef -bazel-release: - @echo "$$BAZEL_RELEASE_HELP_INFO" -else -bazel-release: - bazel build //build/release-tars - bazel shutdown || true - pkill ^bazel || true -endif diff --git a/cluster/common.sh b/cluster/common.sh index d0570ed9afc..0ae153209f9 100755 --- a/cluster/common.sh +++ b/cluster/common.sh @@ -314,7 +314,6 @@ function find-tar() { "${KUBE_ROOT}/node/${tarball}" "${KUBE_ROOT}/server/${tarball}" "${KUBE_ROOT}/_output/release-tars/${tarball}" - "${KUBE_ROOT}/bazel-bin/build/release-tars/${tarball}" ) location=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 ) diff --git a/hack/boilerplate/boilerplate.bzl.txt b/hack/boilerplate/boilerplate.bzl.txt deleted file mode 100644 index 384f325abf3..00000000000 --- a/hack/boilerplate/boilerplate.bzl.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright YEAR 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. - diff --git a/hack/boilerplate/boilerplate.generatebzl.txt b/hack/boilerplate/boilerplate.generatebzl.txt deleted file mode 100644 index 069e282bc85..00000000000 --- a/hack/boilerplate/boilerplate.generatebzl.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright 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. - diff --git a/hack/generate-bindata.sh b/hack/generate-bindata.sh index c12da77e54b..ad8f785a458 100755 --- a/hack/generate-bindata.sh +++ b/hack/generate-bindata.sh @@ -40,10 +40,8 @@ pushd "${KUBE_ROOT}" >/dev/null # These are files for e2e tests. BINDATA_OUTPUT="test/e2e/generated/bindata.go" -# IMPORTANT: if you make any changes to these arguments, you must also update -# test/e2e/generated/BUILD and/or build/bindata.bzl. go-bindata -nometadata -o "${BINDATA_OUTPUT}.tmp" -pkg generated \ - -ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \ + -ignore .jpg -ignore .png -ignore .md \ "test/conformance/testdata/..." \ "test/e2e/testing-manifests/..." \ "test/e2e_node/testing-manifests/..." \ @@ -66,10 +64,8 @@ rm -f "${BINDATA_OUTPUT}.tmp" # These are files for runtime code BINDATA_OUTPUT="staging/src/k8s.io/kubectl/pkg/generated/bindata.go" -# IMPORTANT: if you make any changes to these arguments, you must also update -# pkg/generated/BUILD and/or build/bindata.bzl. go-bindata -nometadata -nocompress -o "${BINDATA_OUTPUT}.tmp" -pkg generated \ - -ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \ + -ignore .jpg -ignore .png -ignore .md \ "translations/..." gofmt -s -w "${BINDATA_OUTPUT}.tmp" diff --git a/hack/lib/golang.sh b/hack/lib/golang.sh index 746c600dffb..97ae45a8281 100755 --- a/hack/lib/golang.sh +++ b/hack/lib/golang.sh @@ -458,20 +458,6 @@ kube::golang::create_gopath_tree() { if [[ ! -e "${go_pkg_dir}" || "$(readlink "${go_pkg_dir}")" != "${KUBE_ROOT}" ]]; then ln -snf "${KUBE_ROOT}" "${go_pkg_dir}" fi - - # Using bazel with a recursive target (e.g. bazel test ...) will abort due to - # the symlink loop created in this function, so create this special file which - # tells bazel not to follow the symlink. - touch "${go_pkg_basedir}/DONT_FOLLOW_SYMLINKS_WHEN_TRAVERSING_THIS_DIRECTORY_VIA_A_RECURSIVE_TARGET_PATTERN" - # Additionally, the //:package-srcs glob recursively includes all - # subdirectories, and similarly fails due to the symlink loop. By creating a - # BUILD.bazel file, we effectively create a dummy package, which stops the - # glob from descending further into the tree and hitting the loop. - cat >"${KUBE_GOPATH}/BUILD.bazel" </dev/null || true) | head -1 ) diff --git a/hack/make-rules/verify.sh b/hack/make-rules/verify.sh index 531b71fc4ee..8d500459e7b 100755 --- a/hack/make-rules/verify.sh +++ b/hack/make-rules/verify.sh @@ -72,12 +72,10 @@ if [[ ${EXCLUDE_READONLY_PACKAGE:-} =~ ^[yY]$ ]]; then ) fi -# Only run whitelisted fast checks in quick mode. -# These run in <10s each on enisoc's workstation, assuming that -# `make` had already been run. +# Only run known fast checks in quick mode. +# These ideally run in less than 10s. QUICK_PATTERNS+=( "verify-api-groups.sh" - "verify-bazel.sh" "verify-boilerplate.sh" "verify-external-dependencies-version.sh" "verify-vendor-licenses.sh" diff --git a/hack/print-workspace-status.sh b/hack/print-workspace-status.sh index 767567c034d..a3de7742b29 100755 --- a/hack/print-workspace-status.sh +++ b/hack/print-workspace-status.sh @@ -13,8 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script is used by bazel as the workspace_status_command to implement +# This script was used by bazel as the workspace_status_command to implement # build stamping with git information. +# +# It is still useful for obtaining kube::version::get_version_vars without +# sourcing Kubernetes build internals. +# # Usage: `hack/print-workspace-status.sh`. set -o errexit diff --git a/hack/tools/README.md b/hack/tools/README.md index 292e587b5bf..1da7039bf02 100644 --- a/hack/tools/README.md +++ b/hack/tools/README.md @@ -1,5 +1,5 @@ This directory contains a stub go module used to track version of development -tools like the ones needed for updating bazel BUILD files. +tools like the ones needed for linting go sources. Run `make build` to download the dependencies, build the binaries and add them to your `$GOBIN` directory. diff --git a/hack/update-bazel.sh b/hack/update-bazel.sh index 9e7eb55b48e..c45ab3b6f0a 100755 --- a/hack/update-bazel.sh +++ b/hack/update-bazel.sh @@ -19,12 +19,17 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. -# delete all bazel related files -find "${KUBE_ROOT}" \( \ - -name BUILD \ - -o -name BUILD.bazel \ - -o -name '*.bzl' \ -\) \ +# delete all bazel related files not in vendor/ +find "${KUBE_ROOT}" \ + \( \ + -name BUILD \ + -o -name BUILD.bazel \ + -o -name '*.bzl' \ + \) \ + -not \ + \( \ + -path "${KUBE_ROOT}"'/vendor*' \ + \) \ -delete # remove additional one-off bazel related files diff --git a/hack/update-vendor.sh b/hack/update-vendor.sh index e881587395a..bc7796c2ebe 100755 --- a/hack/update-vendor.sh +++ b/hack/update-vendor.sh @@ -378,15 +378,6 @@ for repo in $(kube::util::list_staging_repos); do ln -s "../../staging/src/k8s.io/${repo}" "${KUBE_ROOT}/vendor/k8s.io/${repo}" done -kube::log::status "vendor: updating BUILD files" -# Assume that anything imported through vendor doesn't need Bazel to build. -# Prune out any Bazel build files, since these can break the build due to -# missing dependencies that aren't included by go mod vendor. -find vendor/ -type f \ - \( -name BUILD -o -name BUILD.bazel -o -name WORKSPACE \) \ - -exec rm -f {} \; -hack/update-bazel.sh >>"${LOG_FILE}" 2>&1 - kube::log::status "vendor: updating vendor/LICENSES" hack/update-vendor-licenses.sh >>"${LOG_FILE}" 2>&1 diff --git a/hack/update-workspace-mirror.sh b/hack/update-workspace-mirror.sh deleted file mode 100755 index 59d3b90ac58..00000000000 --- a/hack/update-workspace-mirror.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2018 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 [[ $# -ne 1 ]]; then - echo 'use "bazel run //hack:update-mirror"' - echo "(usage: $0 )" - exit 1 -fi - -BUCKET="gs://k8s-bazel-cache" - -gsutil acl get "${BUCKET}" > /dev/null - -tmpfile=$(mktemp bazel_workspace_mirror.XXXXXX) -trap 'rm ${tmpfile}' EXIT -while read -r url; do - echo "${url}" - if gsutil ls "${BUCKET}/${url}" &> /dev/null; then - echo present - else - echo missing - if curl -fLag "${url}" > "${tmpfile}"; then - gsutil cp -a public-read "${tmpfile}" "${BUCKET}/${url}" - fi - fi -done < "$1" diff --git a/hack/verify-bazel.sh b/hack/verify-bazel.sh index ac514022da9..fc83ddbc952 100755 --- a/hack/verify-bazel.sh +++ b/hack/verify-bazel.sh @@ -13,8 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script checks whether updating of the bazel compilation files is needed -# or not. We should run `hack/update-bazel.sh` if actually updates them. +# This script checks whether removal of bazel related files is still needed. +# If so: run `hack/update-bazel.sh` to actually remove them. +# # Usage: `hack/verify-bazel.sh`. set -o errexit diff --git a/hack/verify-gofmt.sh b/hack/verify-gofmt.sh index 03888f09f6c..dc8d3d7bebe 100755 --- a/hack/verify-gofmt.sh +++ b/hack/verify-gofmt.sh @@ -14,10 +14,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script checks whether the source codes need to be formatted or not by -# `gofmt`. We should run `hack/update-gofmt.sh` if actually formats them. +# This script checks whether the source code needs to be formatted or not by +# `gofmt`. Run `hack/update-gofmt.sh` to actually format sources. +# +# Note: gofmt output can change between go versions. +# # Usage: `hack/verify-gofmt.sh`. -# Note: GoFmt apparently is changing @ head... set -o errexit set -o nounset @@ -28,12 +30,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh" cd "${KUBE_ROOT}" -# Prefer bazel's gofmt. -gofmt="external/io_bazel_rules_go_toolchain/bin/gofmt" -if [[ ! -x "${gofmt}" ]]; then - gofmt=$(which gofmt) - kube::golang::verify_go_version -fi +kube::golang::setup_env find_files() { find . -not \( \ @@ -56,7 +53,7 @@ find_files() { # formatting (e.g., a file does not parse correctly). Without "|| true" this # would have led to no useful error message from gofmt, because the script would # have failed before getting to the "echo" in the block below. -diff=$(find_files | xargs "${gofmt}" -d -s 2>&1) || true +diff=$(find_files | xargs gofmt -d -s 2>&1) || true if [[ -n "${diff}" ]]; then echo "${diff}" >&2 echo >&2 diff --git a/staging/publishing/rules.yaml b/staging/publishing/rules.yaml index 346fd3ea4c8..dadcb1f3382 100644 --- a/staging/publishing/rules.yaml +++ b/staging/publishing/rules.yaml @@ -1,4 +1,7 @@ recursive-delete-patterns: +# TODO: remove bazel related files after we stop publishing branches with +# bazel files +# See: https://github.com/kubernetes/enhancements/issues/2420 - BUILD - "*/BUILD" - BUILD.bazel diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/connection_test.go b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/connection_test.go index 046b3de8a13..70301ebbbc5 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/connection_test.go +++ b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/connection_test.go @@ -31,7 +31,6 @@ import ( "testing" "k8s.io/legacy-cloud-providers/vsphere/vclib" - "k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures" ) func createTestServer( @@ -83,14 +82,14 @@ func createTestServer( func TestWithValidCaCert(t *testing.T) { handler, verifyConnectionWasMade := getRequestVerifier(t) - server, _ := createTestServer(t, fixtures.CaCertPath, fixtures.ServerCertPath, fixtures.ServerKeyPath, handler) + server, _ := createTestServer(t, "./testdata/ca.pem", "./testdata/server.pem", "./testdata/server.key", handler) server.StartTLS() u := mustParseURL(t, server.URL) connection := &vclib.VSphereConnection{ Hostname: u.Hostname(), Port: u.Port(), - CACert: fixtures.CaCertPath, + CACert: "./testdata/ca.pem", } // Ignoring error here, because we only care about the TLS connection @@ -102,7 +101,7 @@ func TestWithValidCaCert(t *testing.T) { func TestWithVerificationWithWrongThumbprint(t *testing.T) { handler, _ := getRequestVerifier(t) - server, _ := createTestServer(t, fixtures.CaCertPath, fixtures.ServerCertPath, fixtures.ServerKeyPath, handler) + server, _ := createTestServer(t, "./testdata/ca.pem", "./testdata/server.pem", "./testdata/server.key", handler) server.StartTLS() u := mustParseURL(t, server.URL) @@ -122,7 +121,7 @@ func TestWithVerificationWithWrongThumbprint(t *testing.T) { func TestWithVerificationWithoutCaCertOrThumbprint(t *testing.T) { handler, _ := getRequestVerifier(t) - server, _ := createTestServer(t, fixtures.CaCertPath, fixtures.ServerCertPath, fixtures.ServerKeyPath, handler) + server, _ := createTestServer(t, "./testdata/ca.pem", "./testdata/server.pem", "./testdata/server.key", handler) server.StartTLS() u := mustParseURL(t, server.URL) @@ -140,7 +139,7 @@ func TestWithValidThumbprint(t *testing.T) { handler, verifyConnectionWasMade := getRequestVerifier(t) server, thumbprint := - createTestServer(t, fixtures.CaCertPath, fixtures.ServerCertPath, fixtures.ServerKeyPath, handler) + createTestServer(t, "./testdata/ca.pem", "./testdata/server.pem", "./testdata/server.key", handler) server.StartTLS() u := mustParseURL(t, server.URL) @@ -173,7 +172,7 @@ func TestInvalidCaCert(t *testing.T) { connection := &vclib.VSphereConnection{ Hostname: "should-not-matter", Port: "27015", // doesn't matter, but has to be a valid port - CACert: fixtures.InvalidCertPath, + CACert: "./testdata/invalid.pem", } _, err := connection.NewClient(context.Background()) diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/fixtures.go b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/fixtures.go deleted file mode 100644 index 7ef4dc0347c..00000000000 --- a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/fixtures.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright 2018 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. -*/ - -package fixtures - -import ( - "fmt" - "os" - "path/filepath" - "runtime" -) - -var ( - // CaCertPath is the filepath to a certificate that can be used as a CA - // certificate. - CaCertPath string - // ServerCertPath is the filepath to a leaf certifiacte signed by the CA at - // `CaCertPath`. - ServerCertPath string - // ServerKeyPath is the filepath to the private key for the ceritifiacte at - // `ServerCertPath`. - ServerKeyPath string - // InvalidCertPath is the filepath to an invalid certificate. - InvalidCertPath string -) - -func init() { - fixturesDir, err := pkgPath() - if err != nil { - panic(fmt.Sprintf("Cannot get path to the fixtures: %s", err)) - } - - CaCertPath = filepath.Join(fixturesDir, "ca.pem") - ServerCertPath = filepath.Join(fixturesDir, "server.pem") - ServerKeyPath = filepath.Join(fixturesDir, "server.key") - InvalidCertPath = filepath.Join(fixturesDir, "invalid.pem") -} - -// pkgPath returns the absolute file path to this package's directory. With go -// test, we can just look at the runtime call stack. However, bazel compiles go -// binaries with the -trimpath option so the simple approach fails however we -// can consult environment variables to derive the path. -// -// The approach taken here works for both go test and bazel on the assumption -// that if and only if trimpath is passed, we are running under bazel. -func pkgPath() (string, error) { - _, thisFile, _, ok := runtime.Caller(1) - if !ok { - return "", fmt.Errorf("failed to get current file") - } - - pkgPath := filepath.Dir(thisFile) - - // If we find bazel env variables, then -trimpath was passed so we need to - // construct the path from the environment. - if testSrcdir, testWorkspace := os.Getenv("TEST_SRCDIR"), os.Getenv("TEST_WORKSPACE"); testSrcdir != "" && testWorkspace != "" { - pkgPath = filepath.Join(testSrcdir, testWorkspace, pkgPath) - } - - // If the path is still not absolute, something other than bazel compiled - // with -trimpath. - if !filepath.IsAbs(pkgPath) { - return "", fmt.Errorf("can't construct an absolute path from %q", pkgPath) - } - - return pkgPath, nil -} diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/README.md b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/README.md similarity index 100% rename from staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/README.md rename to staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/README.md diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/ca.key b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/ca.key similarity index 100% rename from staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/ca.key rename to staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/ca.key diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/ca.pem b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/ca.pem similarity index 100% rename from staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/ca.pem rename to staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/ca.pem diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/createCerts.sh b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/createCerts.sh similarity index 100% rename from staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/createCerts.sh rename to staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/createCerts.sh diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/invalid.pem b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/invalid.pem similarity index 100% rename from staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/invalid.pem rename to staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/invalid.pem diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/server.csr b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/server.csr similarity index 100% rename from staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/server.csr rename to staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/server.csr diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/server.key b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/server.key similarity index 100% rename from staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/server.key rename to staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/server.key diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/server.pem b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/server.pem similarity index 100% rename from staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures/server.pem rename to staging/src/k8s.io/legacy-cloud-providers/vsphere/vclib/testdata/server.pem diff --git a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere_test.go b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere_test.go index 5fb91a96199..62962fb9941 100644 --- a/staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere_test.go +++ b/staging/src/k8s.io/legacy-cloud-providers/vsphere/vsphere_test.go @@ -54,7 +54,6 @@ import ( cloudprovider "k8s.io/cloud-provider" "k8s.io/legacy-cloud-providers/vsphere/vclib" - "k8s.io/legacy-cloud-providers/vsphere/vclib/fixtures" ) // localhostCert was generated from crypto/tls/generate_cert.go with the following command: @@ -319,12 +318,12 @@ func TestVSphereLoginByToken(t *testing.T) { } func TestVSphereLoginWithCaCert(t *testing.T) { - caCertPEM, err := ioutil.ReadFile(fixtures.CaCertPath) + caCertPEM, err := ioutil.ReadFile("./vclib/testdata/ca.pem") if err != nil { t.Fatalf("Could not read ca cert from file") } - serverCert, err := tls.LoadX509KeyPair(fixtures.ServerCertPath, fixtures.ServerKeyPath) + serverCert, err := tls.LoadX509KeyPair("./vclib/testdata/server.pem", "./vclib/testdata/server.key") if err != nil { t.Fatalf("Could not load server cert and server key from files: %#v", err) } @@ -342,7 +341,7 @@ func TestVSphereLoginWithCaCert(t *testing.T) { cfg, cleanup := configFromSimWithTLS(&tlsConfig, false) defer cleanup() - cfg.Global.CAFile = fixtures.CaCertPath + cfg.Global.CAFile = "./vclib/testdata/ca.pem" // Create vSphere configuration object vs, err := newControllerNode(cfg) diff --git a/test/integration/framework/etcd.go b/test/integration/framework/etcd.go index 3033a68efde..983c512f990 100644 --- a/test/integration/framework/etcd.go +++ b/test/integration/framework/etcd.go @@ -23,7 +23,6 @@ import ( "net" "os" "os/exec" - "path/filepath" "runtime" "strings" "time" @@ -47,12 +46,6 @@ You can use 'hack/install-etcd.sh' to install a copy in third_party/. // getEtcdPath returns a path to an etcd executable. func getEtcdPath() (string, error) { - bazelPath := filepath.Join(os.Getenv("RUNFILES_DIR"), fmt.Sprintf("com_coreos_etcd_%s", runtime.GOARCH), "etcd") - - p, err := exec.LookPath(bazelPath) - if err == nil { - return p, nil - } return exec.LookPath("etcd") } diff --git a/test/kubemark/start-kubemark.sh b/test/kubemark/start-kubemark.sh index 312b66cd415..275f869efd2 100755 --- a/test/kubemark/start-kubemark.sh +++ b/test/kubemark/start-kubemark.sh @@ -48,28 +48,21 @@ KUBEMARK_IMAGE_TAG=$(head /dev/urandom | tr -dc 'a-z0-9' | fold -w 6 | head -n 1 function create-and-upload-hollow-node-image { authenticate-docker KUBEMARK_IMAGE_REGISTRY="${KUBEMARK_IMAGE_REGISTRY:-${CONTAINER_REGISTRY}/${PROJECT}}" - if [[ "${KUBEMARK_BAZEL_BUILD:-}" =~ ^[yY]$ ]]; then - # Build+push the image through bazel. - touch WORKSPACE # Needed for bazel. - build_cmd=("bazel" "run" "//cluster/images/kubemark:push" "--define" "REGISTRY=${KUBEMARK_IMAGE_REGISTRY}" "--define" "IMAGE_TAG=${KUBEMARK_IMAGE_TAG}") - run-cmd-with-retries "${build_cmd[@]}" - else - # Build+push the image through makefile. - build_cmd=("make" "${KUBEMARK_IMAGE_MAKE_TARGET}") - MAKE_DIR="${KUBE_ROOT}/cluster/images/kubemark" - KUBEMARK_BIN="$(kube::util::find-binary-for-platform kubemark linux/amd64)" - if [[ -z "${KUBEMARK_BIN}" ]]; then - echo 'Cannot find cmd/kubemark binary' - exit 1 - fi - echo "Copying kubemark binary to ${MAKE_DIR}" - cp "${KUBEMARK_BIN}" "${MAKE_DIR}" - CURR_DIR=$(pwd) - cd "${MAKE_DIR}" - REGISTRY=${KUBEMARK_IMAGE_REGISTRY} IMAGE_TAG=${KUBEMARK_IMAGE_TAG} run-cmd-with-retries "${build_cmd[@]}" - rm kubemark - cd "$CURR_DIR" + # Build+push the image through makefile. + build_cmd=("make" "${KUBEMARK_IMAGE_MAKE_TARGET}") + MAKE_DIR="${KUBE_ROOT}/cluster/images/kubemark" + KUBEMARK_BIN="$(kube::util::find-binary-for-platform kubemark linux/amd64)" + if [[ -z "${KUBEMARK_BIN}" ]]; then + echo 'Cannot find cmd/kubemark binary' + exit 1 fi + echo "Copying kubemark binary to ${MAKE_DIR}" + cp "${KUBEMARK_BIN}" "${MAKE_DIR}" + CURR_DIR=$(pwd) + cd "${MAKE_DIR}" + REGISTRY=${KUBEMARK_IMAGE_REGISTRY} IMAGE_TAG=${KUBEMARK_IMAGE_TAG} run-cmd-with-retries "${build_cmd[@]}" + rm kubemark + cd "$CURR_DIR" echo "Created and uploaded the kubemark hollow-node image to docker registry." # Cleanup the kubemark image after the script exits. if [[ "${CLEANUP_KUBEMARK_IMAGE:-}" == "true" ]]; then diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel new file mode 100644 index 00000000000..76cafe6ec7f --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel @@ -0,0 +1,22 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "internal_proto", + srcs = ["stream_chunk.proto"], + deps = ["@com_google_protobuf//:any_proto"], +) + +go_proto_library( + name = "internal_go_proto", + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal", + proto = ":internal_proto", +) + +go_library( + name = "go_default_library", + embed = [":internal_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal", +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel new file mode 100644 index 00000000000..20862228ef8 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel @@ -0,0 +1,84 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "go_default_library", + srcs = [ + "context.go", + "convert.go", + "doc.go", + "errors.go", + "fieldmask.go", + "handler.go", + "marshal_httpbodyproto.go", + "marshal_json.go", + "marshal_jsonpb.go", + "marshal_proto.go", + "marshaler.go", + "marshaler_registry.go", + "mux.go", + "pattern.go", + "proto2_convert.go", + "proto_errors.go", + "query.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime", + deps = [ + "//internal:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library_gen", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", + "@go_googleapis//google/api:httpbody_go_proto", + "@io_bazel_rules_go//proto/wkt:any_go_proto", + "@io_bazel_rules_go//proto/wkt:duration_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//grpclog:go_default_library", + "@org_golang_google_grpc//metadata:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + ], +) + +go_test( + name = "go_default_test", + size = "small", + srcs = [ + "context_test.go", + "errors_test.go", + "fieldmask_test.go", + "handler_test.go", + "marshal_httpbodyproto_test.go", + "marshal_json_test.go", + "marshal_jsonpb_test.go", + "marshal_proto_test.go", + "marshaler_registry_test.go", + "mux_test.go", + "pattern_test.go", + "query_test.go", + ], + embed = [":go_default_library"], + deps = [ + "//examples/proto/examplepb:go_default_library", + "//internal:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library_gen", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//ptypes:go_default_library_gen", + "@go_googleapis//google/api:httpbody_go_proto", + "@go_googleapis//google/rpc:errdetails_go_proto", + "@io_bazel_rules_go//proto/wkt:duration_go_proto", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", + "@io_bazel_rules_go//proto/wkt:struct_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//metadata:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + ], +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel new file mode 100644 index 00000000000..7109d793231 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "pattern.go", + "readerfactory.go", + "trie.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/utilities", +) + +go_test( + name = "go_default_test", + size = "small", + srcs = ["trie_test.go"], + embed = [":go_default_library"], +)