diff --git a/channels/BUILD.bazel b/channels/BUILD.bazel new file mode 100644 index 0000000000000..f98644d07c536 --- /dev/null +++ b/channels/BUILD.bazel @@ -0,0 +1,8 @@ +filegroup( + name = "channeldata", + srcs = [ + "alpha", + "stable", + ], + visibility = ["//visibility:public"], +) diff --git a/cmd/kops/BUILD.bazel b/cmd/kops/BUILD.bazel index a2f9563c97f1b..3d2d771dd6124 100644 --- a/cmd/kops/BUILD.bazel +++ b/cmd/kops/BUILD.bazel @@ -115,6 +115,10 @@ go_binary( name = "kops", library = ":go_default_library", visibility = ["//visibility:public"], + x_defs = { + "k8s.io/kops.Version": "1.8.0-alpha.1", # keep + "k8s.io/kops.GitVersion": "{BUILD_SCM_REVISION}", # keep + }, ) go_test( @@ -126,6 +130,10 @@ go_test( "delete_confirm_test.go", "integration_test.go", ], + data = [ + "//channels:channeldata", # keep + "//tests/integration:exported_testdata", # keep + ], library = ":go_default_library", deps = [ "//cmd/kops/util:go_default_library", diff --git a/nodeup/pkg/model/BUILD.bazel b/nodeup/pkg/model/BUILD.bazel index 901ddd0c326f6..d8d3c5760e2dc 100644 --- a/nodeup/pkg/model/BUILD.bazel +++ b/nodeup/pkg/model/BUILD.bazel @@ -60,6 +60,7 @@ go_test( "kube_apiserver_test.go", "kubelet_test.go", ], + data = glob(["tests/**"]), #keep library = ":go_default_library", deps = [ "//nodeup/pkg/distros:go_default_library", diff --git a/pkg/model/BUILD.bazel b/pkg/model/BUILD.bazel index 4e1cd506427b8..2a74321d6ba77 100644 --- a/pkg/model/BUILD.bazel +++ b/pkg/model/BUILD.bazel @@ -52,6 +52,7 @@ go_test( "bootstrapscript_test.go", "context_test.go", ], + data = glob(["tests/**"]), #keep library = ":go_default_library", deps = [ "//pkg/apis/kops:go_default_library", diff --git a/pkg/model/iam/BUILD.bazel b/pkg/model/iam/BUILD.bazel index cc299dba2af43..80c4540ca2d8e 100644 --- a/pkg/model/iam/BUILD.bazel +++ b/pkg/model/iam/BUILD.bazel @@ -17,6 +17,7 @@ go_library( go_test( name = "go_default_test", srcs = ["iam_builder_test.go"], + data = glob(["tests/*"]), #keep library = ":go_default_library", deps = [ "//pkg/apis/kops:go_default_library", diff --git a/pkg/util/templater/BUILD.bazel b/pkg/util/templater/BUILD.bazel index 10df39589d1a7..41c21673a1ab4 100644 --- a/pkg/util/templater/BUILD.bazel +++ b/pkg/util/templater/BUILD.bazel @@ -10,6 +10,7 @@ go_library( go_test( name = "go_default_test", srcs = ["templater_test.go"], + data = glob(["integration_tests.yml"]), #keep library = ":go_default_library", deps = [ "//pkg/diff:go_default_library", diff --git a/protokube/tests/integration/build_etcd_manifest/BUILD.bazel b/protokube/tests/integration/build_etcd_manifest/BUILD.bazel index 1375eb88a22b5..7e52c7cb9e73b 100644 --- a/protokube/tests/integration/build_etcd_manifest/BUILD.bazel +++ b/protokube/tests/integration/build_etcd_manifest/BUILD.bazel @@ -3,6 +3,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_test") go_test( name = "go_default_test", srcs = ["integration_test.go"], + data = glob(["main/*"]), #keep deps = [ "//pkg/apis/kops:go_default_library", "//pkg/diff:go_default_library", diff --git a/tests/integration/BUILD.bazel b/tests/integration/BUILD.bazel new file mode 100644 index 0000000000000..12028374dce7b --- /dev/null +++ b/tests/integration/BUILD.bazel @@ -0,0 +1,5 @@ +filegroup( + name = "exported_testdata", + srcs = glob(["**"]), + visibility = ["//visibility:public"], +) diff --git a/tools/bazel.rc b/tools/bazel.rc new file mode 100644 index 0000000000000..b2b416f7649cb --- /dev/null +++ b/tools/bazel.rc @@ -0,0 +1 @@ +build --workspace_status_command=./tools/get_workspace_status \ No newline at end of file diff --git a/tools/get_workspace_status b/tools/get_workspace_status new file mode 100755 index 0000000000000..ff75b2dbf2026 --- /dev/null +++ b/tools/get_workspace_status @@ -0,0 +1,30 @@ +#!/bin/bash + +# This script will be run bazel when building process starts to +# generate key-value information that represents the status of the +# workspace. The output should be like +# +# KEY1 VALUE1 +# KEY2 VALUE2 +# +# If the script exits with non-zero code, it's considered as a failure +# and the output will be discarded. + +# The code below presents an implementation that works for git repository +git_rev=$(git rev-parse HEAD) +if [[ $? != 0 ]]; +then + exit 1 +fi +echo "BUILD_SCM_REVISION ${git_rev}" + +# Check whether there are any uncommited changes +git diff-index --quiet HEAD -- +if [[ $? == 0 ]]; +then + tree_status="Clean" +else + tree_status="Modified" +fi +echo "BUILD_SCM_STATUS ${tree_status}" + diff --git a/upup/pkg/fi/cloudup/awsup/BUILD.bazel b/upup/pkg/fi/cloudup/awsup/BUILD.bazel index 49ec7ffbc789b..8f5bcda80e130 100644 --- a/upup/pkg/fi/cloudup/awsup/BUILD.bazel +++ b/upup/pkg/fi/cloudup/awsup/BUILD.bazel @@ -6,6 +6,7 @@ go_library( "aws_apitarget.go", "aws_cloud.go", "aws_utils.go", + "instancegroups.go", "logging_retryer.go", "machine_types.go", "mock_aws_cloud.go", diff --git a/upup/pkg/fi/cloudup/gce/BUILD.bazel b/upup/pkg/fi/cloudup/gce/BUILD.bazel index b1834c641240f..494e55b8bdab1 100644 --- a/upup/pkg/fi/cloudup/gce/BUILD.bazel +++ b/upup/pkg/fi/cloudup/gce/BUILD.bazel @@ -6,11 +6,13 @@ go_library( "gce_apitarget.go", "gce_cloud.go", "gce_url.go", + "instancegroups.go", "labels.go", "mock_gce_cloud.go", "op.go", "status.go", "utils.go", + "wrappers.go", ], visibility = ["//visibility:public"], deps = [