Skip to content

Commit

Permalink
Revert "Revert kubernetes#20651: Use bazel 3.4.1 in test-infra"
Browse files Browse the repository at this point in the history
This reverts commit 8be8dbb.
  • Loading branch information
fejta committed Feb 8, 2021
1 parent b769e42 commit 4d67911
Show file tree
Hide file tree
Showing 30 changed files with 3,591 additions and 3,430 deletions.
6 changes: 2 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
common --experimental_allow_incremental_repository_updates

# populate env used for stamping builds etc
build --workspace_status_command=./hack/print-workspace-status.sh
run --workspace_status_command=./hack/print-workspace-status.sh

# https://github.com/kubernetes/test-infra/issues/13140
build --incompatible_disable_deprecated_attr_params=false
query --incompatible_disable_deprecated_attr_params=false

# enable data race detection
test --features=race --test_output=errors

Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.0
3.4.1
13 changes: 4 additions & 9 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,18 @@ load("@io_bazel_rules_k8s//k8s:k8s.bzl", "k8s_repositories")

k8s_repositories()

load("@build_bazel_rules_nodejs//:defs.bzl", "yarn_install")
# TODO(fejta): node repositories
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")

yarn_install(
name = "npm",
# Updating yarn.lock? Set frozen_lockfile=False,
frozen_lockfile = True,
package_json = "//:package.json",
quiet = True,
yarn_lock = "//:yarn.lock",
)

load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")

install_bazel_dependencies()

load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")

ts_setup_workspace()

load("@rules_python//python:pip.bzl", "pip_import")

pip_import(
Expand Down
32 changes: 32 additions & 0 deletions def/ts.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2021 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.

load("@npm//@bazel/rollup:index.bzl", _rollup_bundle = "rollup_bundle")
load("@npm//@bazel/terser:index.bzl", _terser_minified = "terser_minified")
load("@npm//@bazel/jasmine:index.bzl", _jasmine_node_test = "jasmine_node_test")
load("@npm//@bazel/typescript:index.bzl", _ts_library = "ts_library")

def rollup_bundle(name, format = "esm", **kw):
_rollup_bundle(name = name, format = format, **kw)
_terser_minified(
name = name + ".min",
src = name + ".js",
sourcemap = False,
)

def jasmine_node_test(**kw):
_jasmine_node_test(**kw)

def ts_library(name, **kw):
_ts_library(name = name, **kw)
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/andygrunwald/go-gerrit v0.0.0-20190120104749-174420ebee6c
github.com/andygrunwald/go-jira v1.13.0
github.com/aws/aws-sdk-go v1.31.12
github.com/bazelbuild/buildtools v0.0.0-20190917191645-69366ca98f89
github.com/bazelbuild/buildtools v0.0.0-20200922170545-10384511ce98
github.com/blang/semver v3.5.1+incompatible
github.com/bwmarrin/snowflake v0.0.0
github.com/clarketm/json v1.13.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ github.com/aws/aws-sdk-go v1.31.12/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZve
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I=
github.com/bazelbuild/buildtools v0.0.0-20190917191645-69366ca98f89 h1:3B/ZE1a6eEJ/4Jf/M6RM2KBouN8yKCUcMmXzSyWqa3g=
github.com/bazelbuild/buildtools v0.0.0-20190917191645-69366ca98f89/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU=
github.com/bazelbuild/buildtools v0.0.0-20200922170545-10384511ce98 h1:OhVnC5zU5QHQ+DUSmgOTPqPnJnrlFmrh2S0HKeHmpbw=
github.com/bazelbuild/buildtools v0.0.0-20200922170545-10384511ce98/go.mod h1:5JP0TXzWDHXv8qvxRC4InIazwdyDseBDbzESUMKk1yU=
github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
Expand Down
6 changes: 2 additions & 4 deletions gopherage/cmd/html/static/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package(default_visibility = ["//visibility:public"])

load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("//def:ts.bzl", "jasmine_node_test", "rollup_bundle", "ts_library")

ts_library(
name = "utils",
Expand All @@ -23,6 +21,7 @@ jasmine_node_test(
srcs = [
":utils_test_lib",
],
templated_args = ["--bazel_patch_module_resolver"],
deps = [
"@npm//jasmine",
],
Expand All @@ -48,7 +47,6 @@ ts_library(

rollup_bundle(
name = "zz.browser_bundle",
enable_code_splitting = False,
entry_point = ":browser.ts",
deps = [
":browser",
Expand Down
5 changes: 2 additions & 3 deletions hack/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@py3_deps//:requirements.bzl", "requirement")
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "nodejs_test")
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "nodejs_test")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -258,7 +258,7 @@ sh_binary(
name = "update-gopherage",
srcs = ["update-gopherage.sh"],
data = [
"//gopherage/cmd/html/static:zz.browser_bundle.es2015.js",
"//gopherage/cmd/html/static:browser_bundle.es2015.js",
],
)

Expand All @@ -267,7 +267,6 @@ sh_test(
srcs = ["verify-gopherage.sh"],
data = [
"//gopherage/cmd/html/static:browser_bundle.es2015.js",
"//gopherage/cmd/html/static:zz.browser_bundle.es2015.js",
],
tags = ["lint"],
)
Expand Down
3 changes: 3 additions & 0 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ listergen=$PWD/$4
go_bindata=$PWD/$5
do_clean=${6:-}

# Ensure correct go binary is on path
PATH=$go_sdk/bin:${PATH:-}

cleanup() {
if [[ -n ${fake_gopath:-} ]]; then chmod u+rwx -R $fake_gopath && rm -rf $fake_gopath; fi
if [[ -n ${TEMP_GOCACHE:-} ]]; then rm -rf $TEMP_GOCACHE; fi
Expand Down
3 changes: 2 additions & 1 deletion hack/update-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ if ! command -v bazel &>/dev/null; then
exit 1
fi

bazel=$(command -v bazelisk || command -v bazel)
set -o xtrace
bazel run @io_k8s_repo_infra//hack:update-deps -- "$@"
"$bazel" run @io_k8s_repo_infra//hack:update-deps -- "$@"
10 changes: 5 additions & 5 deletions load.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def repositories():
if not native.existing_rule("io_k8s_repo_infra"):
http_archive(
name = "io_k8s_repo_infra",
strip_prefix = "repo-infra-0.1.3",
sha256 = "46933bedbd22bc6a26ec6116d0d3e1475ad6b23447648d19abd6493241323311",
sha256 = "2f30f87259fed7262d9b95b2665e3d3ecd928d174a4f0356063bc99056b6f84c",
strip_prefix = "repo-infra-0.2.0",
urls = [
"https://github.com/kubernetes/repo-infra/archive/v0.1.3.tar.gz",
"https://github.com/kubernetes/repo-infra/archive/v0.2.0.tar.gz",
],
)

Expand All @@ -43,8 +43,8 @@ def repositories():
# https://github.com/bazelbuild/rules_nodejs
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "9abd649b74317c9c135f4810636aaa838d5bea4913bfa93a85c2f52a919fdaf3",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.36.0/rules_nodejs-0.36.0.tar.gz"],
sha256 = "dd4dc46066e2ce034cba0c81aa3e862b27e8e8d95871f567359f7a534cccb666",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.1.0/rules_nodejs-3.1.0.tar.gz"],
)

# Python setup
Expand Down
19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,28 @@
"moment": "^2.22.2",
"pako": "^1.0.10"
},
"bazel-update-info": {
"WORKSPACE": "NB: set frozen_lockfile = False"
},
"devDependencies": {
"@bazel/bazel": "0.27.0",
"@bazel/jasmine": "0.36.0",
"@bazel/typescript": "0.36.0",
"@bazel/bazelisk": "^1.5.0",
"@bazel/jasmine": "3.1.0",
"@bazel/rollup": "^3.1.0",
"@bazel/terser": "^3.1.0",
"@bazel/typescript": "^3.1.0",
"@rollup/plugin-commonjs": "14.0.0",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "8.4.0",
"@types/color": "^3.0.0",
"@types/google.visualization": "^0.0.43",
"@types/gtag.js": "^0.0.0",
"@types/jasmine": "~3.3.13",
"@types/pako": "^1.0.1",
"jasmine": "~3.4.0",
"rollup": "2.3.4",
"rollup-plugin-amd": "4.0.0",
"terser": "4.4.0",
"tslint": "^5.12.1",
"typescript": ">=2.8 <2.9"
"typescript": "^3.7.5"
}
}
13 changes: 2 additions & 11 deletions prow/cmd/deck/static/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package(default_visibility = ["//visibility:public"])

load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("//def:ts.bzl", "jasmine_node_test", "rollup_bundle", "ts_library")

ts_library(
name = "api",
Expand Down Expand Up @@ -55,14 +53,14 @@ jasmine_node_test(
srcs = [
":prow_test_lib",
],
templated_args = ["--bazel_patch_module_resolver"],
deps = [
"@npm//jasmine",
],
)

rollup_bundle(
name = "prow_bundle",
enable_code_splitting = False,
entry_point = ":prow/prow.ts",
deps = [
":prow",
Expand All @@ -81,7 +79,6 @@ ts_library(

rollup_bundle(
name = "plugin_help_bundle",
enable_code_splitting = False,
entry_point = ":plugin-help/plugin-help.ts",
deps = [
":plugin_help",
Expand All @@ -101,7 +98,6 @@ ts_library(

rollup_bundle(
name = "pr_bundle",
enable_code_splitting = False,
entry_point = "pr/pr.ts",
deps = [
":pr",
Expand All @@ -121,7 +117,6 @@ ts_library(

rollup_bundle(
name = "tide_bundle",
enable_code_splitting = False,
entry_point = ":tide/tide.ts",
deps = [
":tide",
Expand All @@ -141,7 +136,6 @@ ts_library(

rollup_bundle(
name = "tide_history_bundle",
enable_code_splitting = False,
entry_point = ":tide-history/tide-history.ts",
deps = [
":tide_history",
Expand All @@ -160,7 +154,6 @@ ts_library(

rollup_bundle(
name = "command_help_bundle",
enable_code_splitting = False,
entry_point = ":command-help/command-help.ts",
deps = [
":command_help",
Expand Down Expand Up @@ -192,7 +185,6 @@ ts_library(

rollup_bundle(
name = "spyglass_bundle",
enable_code_splitting = False,
entry_point = ":spyglass/spyglass.ts",
deps = [
":spyglass",
Expand All @@ -202,7 +194,6 @@ rollup_bundle(

rollup_bundle(
name = "spyglass_lens_bundle",
enable_code_splitting = False,
entry_point = ":spyglass/lens.ts",
deps = [
":spyglass_common",
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/deck/static/pr/pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ window.onload = () => {
window.location.search = "?query=" + encodeURIComponent(searchQuery);
}
const request = createXMLHTTPRequest((r) => {
const prData = JSON.parse(r.responseText);
const prData = JSON.parse(r.responseText) as UserData;
redraw(prData);
loadProgress(false);
}, () => {
Expand Down
2 changes: 1 addition & 1 deletion prow/cmd/deck/static/prow/prow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ function redraw(fz: FuzzySearch, pushState: boolean = true): void {
const rerunStatus = getParameterByName("rerun");
const modal = document.getElementById('rerun')!;
const rerunCommand = document.getElementById('rerun-content')!;
window.onclick = (event) => {
window.onclick = (event: any) => {
if (event.target === modal) {
modal.style.display = "none";
}
Expand Down
11 changes: 4 additions & 7 deletions prow/plugins/buildifier/buildifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ func uniqProblems(problems []string) []string {

// problemsInFiles runs buildifier on the files. It returns a map from the file to
// a list of problems with that file.
func problemsInFiles(r git.RepoClient, files map[string]string) (map[string][]string, error) {
problems := make(map[string][]string)
func problemsInFiles(r git.RepoClient, files map[string]string) (map[string]bool, error) {
problems := map[string]bool{}
for f := range files {
src, err := ioutil.ReadFile(filepath.Join(r.Directory(), f))
if err != nil {
Expand All @@ -138,13 +138,10 @@ func problemsInFiles(r git.RepoClient, files map[string]string) (map[string][]st
if err != nil {
return nil, fmt.Errorf("parsing as Bazel file %v", err)
}
beforeRewrite := build.Format(content)
var info build.RewriteInfo
build.Rewrite(content, &info)
beforeRewrite := build.FormatWithoutRewriting(content)
ndata := build.Format(content)
if !bytes.Equal(src, ndata) && !bytes.Equal(src, beforeRewrite) {
// TODO(mattmoor): This always seems to be empty?
problems[f] = uniqProblems(info.Log)
problems[f] = true
}
}
return problems, nil
Expand Down
2 changes: 1 addition & 1 deletion prow/spyglass/lenses/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"])

load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("//def:ts.bzl", "ts_library")

filegroup(
name = "templates",
Expand Down
6 changes: 2 additions & 4 deletions prow/spyglass/lenses/buildlog/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
load("//def:ts.bzl", "rollup_bundle", "ts_library")

go_library(
name = "go_default_library",
Expand All @@ -24,7 +23,6 @@ ts_library(

rollup_bundle(
name = "script_bundle",
enable_code_splitting = False,
entry_point = ":buildlog.ts",
deps = [
":script",
Expand All @@ -35,7 +33,7 @@ filegroup(
name = "resources",
srcs = [
"buildlog.css",
":script_bundle",
":script_bundle.min",
],
visibility = ["//visibility:public"],
)
Expand Down
Loading

0 comments on commit 4d67911

Please sign in to comment.