Skip to content

dev: introduce a general purpose dev-tool for crdb engineers#56965

Merged
craig[bot] merged 4 commits intocockroachdb:masterfrom
irfansharif:201120.introduce-larva
Dec 31, 2020
Merged

dev: introduce a general purpose dev-tool for crdb engineers#56965
craig[bot] merged 4 commits intocockroachdb:masterfrom
irfansharif:201120.introduce-larva

Conversation

@irfansharif
Copy link
Copy Markdown
Contributor

@irfansharif irfansharif commented Nov 20, 2020

Our Makefile UX has grown organically over the last six years, and is
now home to various scripts that are orthogonal to simply building the
crdb binary. These include the ability to run linters, building various
useful binaries (such as roachprod, roachtest), running different kinds
of tests (unit tests, logic tests, acceptance tests), and much more.

Now that we're exploring a move towards Bazel for our build system
(#55687), we have a chance to tuck away Bazel specific under a general
purpose dev-tool, larva.

The intent here is to house all day-to-day dev operations under this
tool, written in Go. This will be the component that actually replaces
our Makefile in its entirety. It'll be (predictably) powered by bazel
underneath, but with much nicer UX. It should capturing all common usage
patterns in high-level docs.

Strawman UX (I've only really deliberated on the test subcommand):

	larva test --pkg=kv/kvserver --filter=TestReplicaGC* -v -show-logs --timeout=1m
	larva test --stress --race ...
	larva test --logic --files=prepare|fk --subtests=20042 --config=local
	larva test --fuzz --pkg=... --filter=Decimal`
	larva bench --pkg=sql/parser --filter=BenchmarkParse
	larva build cockroach --tags=deadlock
	larva build cockroach-oss
	larva build {opt,exec}gen
	larva generate bazel
	larva generate protobuf
	larva generate {opt,exec}gen
        larva lint --filter=TestLowercaseFunctionNames --short --timeout=1m

Aside: The naming here is cause of this tool's infancy, relation to
cockroaches, and it starting with the letter "l" (which is featured
prominently in "bazel"/"blaze"). Whatever.

Release note: None

@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@irfansharif
Copy link
Copy Markdown
Contributor Author

irfansharif commented Nov 20, 2020

@petermattis, @otan, @knz, @jlinder: what do youse think of this?

@knz
Copy link
Copy Markdown
Contributor

knz commented Nov 20, 2020

before I can build an opinion, can you include in the PR description a table that maps side by side some of our key make invocations and the new invocation

I'd like to see at least:

  • build, buildshort, buildoss
  • the same, but with additional custom tags (e.g. "deadlock")
  • test PKG=.... TESTFLAGS=... w/ and w/o additional build tags
  • testbuild PKG=..... w/ and w/o additional build tags
  • stress PKG=.... w/ and w/o additional test flags
  • bench BENCHES=.... w/ and w/o additional test flags
  • testlogic FILES=a,b,c
  • lint TESTS=a,b,c (nb: there's a subtle remapping for lint test lists)

@irfansharif
Copy link
Copy Markdown
Contributor Author

@knz: Done (they were previously included in the help text for each of the subcommands).

@knz
Copy link
Copy Markdown
Contributor

knz commented Nov 20, 2020

ok sure that works for me 👍

Copy link
Copy Markdown
Collaborator

@petermattis petermattis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm 👍 on doing this. One suggestion, which you're sort of following below: we want to replicate the functionality of the make targets, but we shouldn't constrain ourselves to make this tool behave identically. For instance, larva test should not take a PKG and TESTS flags. Possibly it shouldn't take --pkg either, but allow packages to be specified as positional parameters. That means there will necessarily be some amount of bikeshedding on what the UX is for these commands. So be it.

I'm not keen on the name larva. I had a similar wrapper tool around blaze at Google and named it b as building is one of the most common operations a developer does. This is another good bikeshed topic.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@knz
Copy link
Copy Markdown
Contributor

knz commented Nov 20, 2020

I think the name of the program does not matter (too) much because every user can use alias in their shell.

Generally single-letter commands have a higher risk of colliding with whatever alias folk alrady have defined in their workflow.

I don't know about larva in particular but FWIW I like command names that are self-explanatory. For example build.

@otan
Copy link
Copy Markdown
Contributor

otan commented Nov 20, 2020

Heh liking it! Few things:

  • Prefer generate to be just gen, or an alias of it. Minimise them characters. Also by default larva gen should run all the generators, and larva gen [targets...] runs all generators for each target directory. Would prefer this over special casing each generator.
  • Ideally, the existing bazel commands would work "out of the box" -- e.g. for every bazel build command i can also run larva build with the same arguments.
  • There's some extra functionality I really hope to achieve:
    • larva tool .... -- runs bazel run without needing --.
    • larva roachprod scp,run,....: wrappers around roachprod that allow building a target and then uploading it to machines for remote execution.
  • Not a big fan of the word "larva", i much prefer "bob"/"bobthebuilder" :3 (ok maybe too pop culty). bzl is not a bad one.
    🅱️ for meme value.

@irfansharif
Copy link
Copy Markdown
Contributor Author

irfansharif commented Nov 20, 2020

This is a bikeshedding friendly PR, so keep 'em coming. I'll drop larva (unless @spencerkimball decides to back me up here). I don't really want to tie the UX here super tightly with bazel, I really want it to be crdb first/Golang-esque in its usage. I'm thinking of dev instead. I've seen it used at a previous gig and it's nice and pithy and relevant to what it's doing.

(for posterity my other names were molt, beetle, ant, komo, tardi)

@knz
Copy link
Copy Markdown
Contributor

knz commented Nov 20, 2020

ooh I now get it 💡 I did not previously understand "larva" was a followup on "cockroach"

I do not dislike the idea but then let's make it a bit more grammatically intuitive: the command is the agent that "makes" the cockroach, it's not a command that forks into a cockroach process.

So I'd be more inclined to go for "lay", "grow", "infest" or whatever.

@knz
Copy link
Copy Markdown
Contributor

knz commented Nov 20, 2020

or "hatch"

@jlinder
Copy link
Copy Markdown
Collaborator

jlinder commented Nov 21, 2020

Sweet!

Names that popped out for me: molt, bob, bzl. molt is particularly interesting since it the code is molting into a cockroach.

I don't think it should be any of these:

  • ant (that's already a java build tool)
  • dev (it's too overloaded already, like, the dev environment, dev accounts, dev of dev/staging/prod, ...)

@irfansharif irfansharif force-pushed the 201120.introduce-larva branch from 6ffa600 to f762d40 Compare November 23, 2020 15:22
@kenliu
Copy link
Copy Markdown

kenliu commented Nov 25, 2020

Since we're bikeshedding here...I will add that we could do without some of the gross verbs associated with cockroach reproduction. dev sounds fantastic 😆

@tbg tbg changed the title larva: introduce a general purpose dev-tool for crdb engineers dev: introduce a general purpose dev-tool for crdb engineers Dec 2, 2020
@rickystewart
Copy link
Copy Markdown
Collaborator

@irfansharif I understand this is a pretty barebones PR, but can we get it merged anyway? Can't start iterating/improving on this until it's checked in :)

@irfansharif
Copy link
Copy Markdown
Contributor Author

yup, mind stamping it as is?

@knz
Copy link
Copy Markdown
Contributor

knz commented Dec 30, 2020

you'll need to rebase though

Our Makefile UX has grown organically over the last six years, and is
now home to various scripts that are orthogonal to simply building the
crdb binary. These include the ability to run linters, building various
useful binaries (such as roachprod, roachtest), running different kinds
of tests (unit tests, logic tests, acceptance tests), and much more.

Now that we're exploring a move towards Bazel for our build system
(cockroachdb#55687), we have a chance to tuck away Bazel specific under a general
purpose dev-tool.

The intent here is to house all day-to-day dev operations under this
tool, written in Go. This will be the component that actually replaces
our Makefile in its entirety. It'll be (predictably) powered by bazel
underneath, but with much nicer UX. It should capturing all common usage
patterns in high-level docs.

This diff only introduces the scaffolding for this CLI.

Release note: None
This is still pretty bare-bones, but better something than nothing.

Release note: None
This is still pretty bare-bones, but better something than nothing.

Release note: None
This is still pretty bare-bones, but better something than nothing.

Release note: None
@irfansharif irfansharif force-pushed the 201120.introduce-larva branch from 24e6807 to a04c929 Compare December 31, 2020 00:53
@irfansharif
Copy link
Copy Markdown
Contributor Author

TFTR! I had a few more (unpolished) commits locally that fleshed out test/gen/build, and I've pushed them out. Merging it as is without review as it's all going to change anyway.

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 31, 2020

Build failed:

@irfansharif
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Dec 31, 2020

Build succeeded!

And happy new year! 🎉

@craig craig bot merged commit b93fd53 into cockroachdb:master Dec 31, 2020
@irfansharif irfansharif deleted the 201120.introduce-larva branch December 31, 2020 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants