Skip to content

Commit

Permalink
Merge #85085 #85088
Browse files Browse the repository at this point in the history
85085: build: fix dev ui watch r=michae2 a=sjbarag

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 dc5fb3e, restoring dev ui watch.

[1] dc5fb3e (dev: add ./dev generate js subcommand, 2022-07-20)

Release note: None

85088: roachtest: fix tests to not use `go get` r=ZhouXing19 a=rafiss

fixes #85058
fixes #85047
fixes #85045
fixes #85044

`go get` no longer works the same in go1.18.

Release note: None

Co-authored-by: Sean Barag <[email protected]>
Co-authored-by: Rafi Shamim <[email protected]>
  • Loading branch information
3 people committed Jul 27, 2022
3 parents 811ca1f + 2ddf1fe + f448cfa commit c4e9819
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 66 deletions.
24 changes: 0 additions & 24 deletions pkg/cmd/dev/testdata/datadriven/ui
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
44 changes: 6 additions & 38 deletions pkg/cmd/dev/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -323,23 +323,22 @@ 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`
// running between changes, since Jest won't find changes. But having ibazel
// 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
Expand Down Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/gopg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/gorm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/libpq.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/roachtest/tests/pgx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit c4e9819

Please sign in to comment.