mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #99923 from BenTheElder/cleanup-the-scripts
cleanup more bazel references
This commit is contained in:
commit
04e0e52271
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 )
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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"
|
||||
|
@ -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" <<EOF
|
||||
# This dummy BUILD file prevents Bazel from trying to descend through the
|
||||
# infinite loop created by the symlink at
|
||||
# ${go_pkg_dir}
|
||||
EOF
|
||||
}
|
||||
|
||||
# Ensure the go tool exists and is a viable version.
|
||||
|
@ -219,16 +219,6 @@ kube::util::find-binary-for-platform() {
|
||||
);
|
||||
fi
|
||||
|
||||
# Also search for binary in bazel build tree if bazel-out/ exists.
|
||||
if [[ -d "${KUBE_ROOT}/bazel-out" ]]; then
|
||||
while IFS=$'\n' read -r bin_build_mode; do
|
||||
if grep -q "${platform}" "${bin_build_mode}"; then
|
||||
# drop the extension to get the real binary path.
|
||||
locations+=("${bin_build_mode%.*}")
|
||||
fi
|
||||
done < <(find "${KUBE_ROOT}/bazel-out/" -name "${lookfor}.go_build_mode")
|
||||
fi
|
||||
|
||||
# List most recently-updated location.
|
||||
local -r bin=$( (ls -t "${locations[@]}" 2>/dev/null || true) | head -1 )
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 <file with list of URLs to mirror>)"
|
||||
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"
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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())
|
||||
|
@ -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
|
||||
}
|
@ -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)
|
||||
|
@ -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")
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
22
vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel
generated
vendored
Normal file
22
vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel
generated
vendored
Normal file
@ -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",
|
||||
)
|
84
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel
generated
vendored
Normal file
84
vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel
generated
vendored
Normal file
@ -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",
|
||||
],
|
||||
)
|
21
vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel
generated
vendored
Normal file
21
vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel
generated
vendored
Normal file
@ -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"],
|
||||
)
|
Loading…
Reference in New Issue
Block a user