From 2ddf1fe1b145022c1ef982ae1a4eb515e69941dc Mon Sep 17 00:00:00 2001 From: Sean Barag Date: Tue, 26 Jul 2022 13:20:03 -0700 Subject: [PATCH 1/2] build: fix dev ui watch A previous commit [1] added a few extra cp commands to an internal helper of the ./dev ui subcommands, but its use in dev ui watch resulted in an attempt to package output before it was created. Revert the unnecessary parts of dc5fb3e958, restoring dev ui watch. [1] dc5fb3e958 (dev: add ./dev generate js subcommand, 2022-07-20) Release note: None --- pkg/cmd/dev/testdata/datadriven/ui | 24 ---------------- pkg/cmd/dev/ui.go | 44 ++++-------------------------- 2 files changed, 6 insertions(+), 62 deletions(-) diff --git a/pkg/cmd/dev/testdata/datadriven/ui b/pkg/cmd/dev/testdata/datadriven/ui index a0e7cfece4e5..32753b14d029 100644 --- a/pkg/cmd/dev/testdata/datadriven/ui +++ b/pkg/cmd/dev/testdata/datadriven/ui @@ -9,12 +9,8 @@ cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.js crdb-checkout/pkg/ui/wo cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.js crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.js cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/src/js/protos.d.ts cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts -rm -rf crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist -cp -r sandbox/pkg/ui/workspaces/eslint-plugin-crdb/dist crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist rm -rf crdb-checkout/pkg/ui/workspaces/cluster-ui/dist cp -r sandbox/pkg/ui/workspaces/cluster-ui/dist crdb-checkout/pkg/ui/workspaces/cluster-ui/dist -rm -rf crdb-checkout/pkg/ui/workspaces/db-console/dist -cp -r sandbox/pkg/ui/workspaces/db-console/dist crdb-checkout/pkg/ui/workspaces/db-console/dist bazel info workspace --color=no bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/cluster-ui build:watch bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/db-console webpack-dev-server --config webpack.config.js --mode development --env.WEBPACK_SERVE --env.dist=ccl --env.target=http://localhost:8080 --port 3000 @@ -28,12 +24,8 @@ bazel info bazel-bin --color=no bazel info workspace --color=no cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.js crdb-checkout/pkg/ui/workspaces/db-console/src/js/protos.js cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/src/js/protos.d.ts -rm -rf crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist -cp -r sandbox/pkg/ui/workspaces/eslint-plugin-crdb/dist crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist rm -rf crdb-checkout/pkg/ui/workspaces/cluster-ui/dist cp -r sandbox/pkg/ui/workspaces/cluster-ui/dist crdb-checkout/pkg/ui/workspaces/cluster-ui/dist -rm -rf crdb-checkout/pkg/ui/workspaces/db-console/dist -cp -r sandbox/pkg/ui/workspaces/db-console/dist crdb-checkout/pkg/ui/workspaces/db-console/dist bazel info workspace --color=no bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/cluster-ui build:watch bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/db-console webpack-dev-server --config webpack.config.js --mode development --env.WEBPACK_SERVE --env.dist=oss --env.target=http://localhost:8080 --port 3000 @@ -49,12 +41,8 @@ cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.js crdb-checkout/pkg/ui/wo cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.js crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.js cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/src/js/protos.d.ts cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts -rm -rf crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist -cp -r sandbox/pkg/ui/workspaces/eslint-plugin-crdb/dist crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist rm -rf crdb-checkout/pkg/ui/workspaces/cluster-ui/dist cp -r sandbox/pkg/ui/workspaces/cluster-ui/dist crdb-checkout/pkg/ui/workspaces/cluster-ui/dist -rm -rf crdb-checkout/pkg/ui/workspaces/db-console/dist -cp -r sandbox/pkg/ui/workspaces/db-console/dist crdb-checkout/pkg/ui/workspaces/db-console/dist bazel info workspace --color=no bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/cluster-ui build:watch bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/db-console webpack-dev-server --config webpack.config.js --mode development --env.WEBPACK_SERVE --env.dist=ccl --env.target=http://localhost:8080 --port 3000 --https @@ -70,12 +58,8 @@ cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.js crdb-checkout/pkg/ui/wo cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.js crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.js cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/src/js/protos.d.ts cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts -rm -rf crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist -cp -r sandbox/pkg/ui/workspaces/eslint-plugin-crdb/dist crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist rm -rf crdb-checkout/pkg/ui/workspaces/cluster-ui/dist cp -r sandbox/pkg/ui/workspaces/cluster-ui/dist crdb-checkout/pkg/ui/workspaces/cluster-ui/dist -rm -rf crdb-checkout/pkg/ui/workspaces/db-console/dist -cp -r sandbox/pkg/ui/workspaces/db-console/dist crdb-checkout/pkg/ui/workspaces/db-console/dist bazel info workspace --color=no bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/cluster-ui build:watch bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/db-console webpack-dev-server --config webpack.config.js --mode development --env.WEBPACK_SERVE --env.dist=ccl --env.target=http://example.crdb.io:4848 --port 3000 @@ -91,12 +75,8 @@ cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.js crdb-checkout/pkg/ui/wo cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.js crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.js cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/src/js/protos.d.ts cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts -rm -rf crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist -cp -r sandbox/pkg/ui/workspaces/eslint-plugin-crdb/dist crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist rm -rf crdb-checkout/pkg/ui/workspaces/cluster-ui/dist cp -r sandbox/pkg/ui/workspaces/cluster-ui/dist crdb-checkout/pkg/ui/workspaces/cluster-ui/dist -rm -rf crdb-checkout/pkg/ui/workspaces/db-console/dist -cp -r sandbox/pkg/ui/workspaces/db-console/dist crdb-checkout/pkg/ui/workspaces/db-console/dist bazel info workspace --color=no bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/cluster-ui build:watch bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/db-console webpack-dev-server --config webpack.config.js --mode development --env.WEBPACK_SERVE --env.dist=ccl --env.target=http://localhost:8080 --port 12345 @@ -131,12 +111,8 @@ cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.js crdb-checkout/pkg/ui/wo cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.js crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.js cp sandbox/pkg/ui/workspaces/db-console/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/src/js/protos.d.ts cp sandbox/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts crdb-checkout/pkg/ui/workspaces/db-console/ccl/src/js/protos.d.ts -rm -rf crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist -cp -r sandbox/pkg/ui/workspaces/eslint-plugin-crdb/dist crdb-checkout/pkg/ui/workspaces/eslint-plugin-crdb/dist rm -rf crdb-checkout/pkg/ui/workspaces/cluster-ui/dist cp -r sandbox/pkg/ui/workspaces/cluster-ui/dist crdb-checkout/pkg/ui/workspaces/cluster-ui/dist -rm -rf crdb-checkout/pkg/ui/workspaces/db-console/dist -cp -r sandbox/pkg/ui/workspaces/db-console/dist crdb-checkout/pkg/ui/workspaces/db-console/dist bazel info workspace --color=no bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/db-console bazel run @yarn//:yarn -- --silent --cwd crdb-checkout/pkg/ui/workspaces/cluster-ui jest --watch diff --git a/pkg/cmd/dev/ui.go b/pkg/cmd/dev/ui.go index 886094bad555..cfdb94316087 100644 --- a/pkg/cmd/dev/ui.go +++ b/pkg/cmd/dev/ui.go @@ -127,7 +127,7 @@ Replaces 'make ui-watch'.`, return err } - if err := copyBuildOutputToWorkspace(d /* ossOnly */, isOss); err != nil { + if err := arrangeFilesForWatchers(d /* ossOnly */, isOss); err != nil { log.Fatalf("failed to arrange files for watchers: %v", err) return err } @@ -323,10 +323,9 @@ func makeUICleanCmd(d *dev) *cobra.Command { return cleanCmd } -// copyBuildOutputToWorkspace moves files from Bazel's build output directory +// arrangeFilesForWatchers moves files from Bazel's build output directory // into the locations they'd be found during a non-Bazel build, so that test -// watchers and developer tooling can successfully operate outside of the Bazel -// sandbox. +// watchers can successfully operate outside of the Bazel sandbox. // // Unfortunately, Bazel's reliance on symlinks conflicts with Jest's refusal to // traverse symlinks during `--watch` mode. Ibazel is unable to keep `jest` @@ -334,12 +333,12 @@ func makeUICleanCmd(d *dev) *cobra.Command { // kill Jest when a file changes defeat the purpose of Jest's watch mode, and // makes devs pay the cost of node + jest startup times after every file change. // Similar issues apply to webpack's watch-mode, as compiled output doesn't -// exist outside of the Bazel sandbox. As a workaround, copyBuildOutputToWorkspace +// exist outside of the Bazel sandbox. As a workaround, arrangeFilesForWatchers // copies files out of the Bazel sandbox and allows Jest or webpack (in watch // mode) to be executed from directly within a pkg/ui/workspaces/... directory. // // See https://github.com/bazelbuild/rules_nodejs/issues/2028 -func copyBuildOutputToWorkspace(d *dev, ossOnly bool) error { +func arrangeFilesForWatchers(d *dev, ossOnly bool) error { bazelBin, err := d.getBazelBin(d.cli.Context()) if err != nil { return err @@ -377,21 +376,6 @@ func copyBuildOutputToWorkspace(d *dev, ossOnly bool) error { } } - // Delete eslint-plugin output tree that was previously copied out of the sandbox - err = d.os.RemoveAll(filepath.Join(dstDirs.eslintPlugin, "dist")) - if err != nil { - return err - } - - // Copy the eslint-plugin output tree back out of the sandbox - err = d.os.CopyAll( - filepath.Join(bazelBin, "pkg", "ui", "workspaces", "eslint-plugin-crdb", "dist"), - filepath.Join(dstDirs.eslintPlugin, "dist"), - ) - if err != nil { - return err - } - // Delete cluster-ui output tree that was previously copied out of the sandbox err = d.os.RemoveAll(filepath.Join(dstDirs.clusterUI, "dist")) if err != nil { @@ -407,22 +391,6 @@ func copyBuildOutputToWorkspace(d *dev, ossOnly bool) error { return err } - // Delete db-console output tree that was previously copied out of the sandbox - err = d.os.RemoveAll(filepath.Join(dstDirs.dbConsole, "dist")) - if err != nil { - return err - } - - // Copy the db-console output tree back out of the sandbox - err = d.os.CopyAll( - filepath.Join(bazelBin, "pkg", "ui", "workspaces", "db-console", "dist"), - filepath.Join(dstDirs.dbConsole, "dist"), - ) - - if err != nil { - return err - } - return nil } @@ -470,7 +438,7 @@ Replaces 'make ui-test' and 'make ui-test-watch'.`, return err } - err = copyBuildOutputToWorkspace(d /* ossOnly */, false) + err = arrangeFilesForWatchers(d /* ossOnly */, false) if err != nil { // nolint:errwrap return fmt.Errorf("unable to arrange files properly for watch-mode testing: %+v", err) From f448cfab173bd1541e55973e1923e88a5225b1af Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Tue, 26 Jul 2022 16:52:05 -0400 Subject: [PATCH 2/2] roachtest: fix tests to not use `go get` `go get` no longer works the same in g1.18. Release note: None --- pkg/cmd/roachtest/tests/gopg.go | 2 +- pkg/cmd/roachtest/tests/gorm.go | 2 +- pkg/cmd/roachtest/tests/libpq.go | 2 +- pkg/cmd/roachtest/tests/pgx.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/roachtest/tests/gopg.go b/pkg/cmd/roachtest/tests/gopg.go index f3075f43153d..b1e54a4ac741 100644 --- a/pkg/cmd/roachtest/tests/gopg.go +++ b/pkg/cmd/roachtest/tests/gopg.go @@ -147,7 +147,7 @@ func registerGopg(r registry.Registry) { // We pipe the test output into go-junit-report tool which will output // it in XML format. fmt.Sprintf(`cd %s && - GOPATH=%s go get -u github.com/jstemmer/go-junit-report && + GOPATH=%s go install github.com/jstemmer/go-junit-report@latest && cat %s | %s/bin/go-junit-report`, destPath, goPath, resultsFilePath, goPath), ) diff --git a/pkg/cmd/roachtest/tests/gorm.go b/pkg/cmd/roachtest/tests/gorm.go index 4a7b25ca804c..7e1ed7d5d772 100644 --- a/pkg/cmd/roachtest/tests/gorm.go +++ b/pkg/cmd/roachtest/tests/gorm.go @@ -72,7 +72,7 @@ func registerGORM(r registry.Registry) { // Install go-junit-report to convert test results to .xml format we know // how to work with. if err := repeatRunE( - ctx, t, c, node, "install go-junit-report", fmt.Sprintf("GOPATH=%s go get -u github.com/jstemmer/go-junit-report", goPath), + ctx, t, c, node, "install go-junit-report", fmt.Sprintf("GOPATH=%s go install github.com/jstemmer/go-junit-report@latest", goPath), ); err != nil { t.Fatal(err) } diff --git a/pkg/cmd/roachtest/tests/libpq.go b/pkg/cmd/roachtest/tests/libpq.go index babc76cb48eb..17eb126f482d 100644 --- a/pkg/cmd/roachtest/tests/libpq.go +++ b/pkg/cmd/roachtest/tests/libpq.go @@ -70,7 +70,7 @@ func registerLibPQ(r registry.Registry) { // Install go-junit-report to convert test results to .xml format we know // how to work with. err = repeatRunE(ctx, t, c, node, "install go-junit-report", - fmt.Sprintf("GOPATH=%s go get -u github.com/jstemmer/go-junit-report", goPath), + fmt.Sprintf("GOPATH=%s go install github.com/jstemmer/go-junit-report@latest", goPath), ) require.NoError(t, err) diff --git a/pkg/cmd/roachtest/tests/pgx.go b/pkg/cmd/roachtest/tests/pgx.go index 9f81b2ac2c11..6144ad3583ef 100644 --- a/pkg/cmd/roachtest/tests/pgx.go +++ b/pkg/cmd/roachtest/tests/pgx.go @@ -76,7 +76,7 @@ func registerPgx(r registry.Registry) { t.Status("installing go-junit-report") if err := repeatRunE( - ctx, t, c, node, "install go-junit-report", "go get -u github.com/jstemmer/go-junit-report", + ctx, t, c, node, "install go-junit-report", "go install github.com/jstemmer/go-junit-report@latest", ); err != nil { t.Fatal(err) }