-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
roachprod: implement --dry-run and --verbose #137874
base: master
Are you sure you want to change the base?
Conversation
Your pull request contains more than 1000 changes. It is strongly encouraged to split big PRs into smaller chunks. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
c37f9cf
to
d249a7a
Compare
d249a7a
to
e77e603
Compare
I'll do a bit more smoke testing, but it's ready for review now. Apologies for a fairly large PR. Most of the changes are fairly shallow and hopefully quick to review; e.g., we need to thread the logger through every func. which may invoke a command. The rest is refactoring, by moving command invocation logic into its own package (see |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! Both options will be very helpful, and the cli
package is the cherry on the cake!
e77e603
to
622e229
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of commands that don't fully work (e.g. destroy
errors out trying to unmarshal DNS records, create
errors out setting up SSH), but the approach SGTM and I think it's fine since it's just an "experimental" feature.
Thanks, I'll have a look at those. Not everything is going to work since some commands may require changes (or side-effects), but methinks destroy should be doable. |
So, |
Debugging roachprod in a remote (user) environment can be challenging. On several occassions, simply printing all executed (cloud) commands was sufficient to reproduce and root cause an issue. This change implements two mutually exclusive modes, namely `dry-run` and `verbose`. The latter merely logs every command before it's executed. The former suppresses execution of any command which can modify the (cloud) infrastructure; i.e., `dry-run` executes read-only commands; it logs every command, executed or not. Also note that `dry-run` leaves temporary files like VM startup scripts on disk, so that they can be readily examined. Thus, `dry-run` is primarily for dumping _all_ commands without the risk of modifying anything; `verbose` is primarily for live debugging. Release note: None Epic: none Fixes: cockroachdb#99091
622e229
to
7fd4b99
Compare
Debugging roachprod in a remote (user) environment can be challenging.
On several occassions, simply printing all executed (cloud) commands
was sufficient to reproduce and root cause an issue.
This change implements two mutually exclusive
modes, namely
dry-run
andverbose
. The lattermerely logs every command before it's executed.
The former suppresses execution of any command
which can modify the (cloud) infrastructure;
i.e.,
dry-run
executes read-only commands; it logsevery command, executed or not. Also note that
dry-run
leaves temporary files like VM startupscripts on disk, so that they can be readily examined.
Thus,
dry-run
is primarily for dumping allcommands without the risk of modifying anything;
verbose
is primarily for live debugging.Release note: None
Epic: none
Fixes: #99091