Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
138922: roachprod: wipe start scripts r=DarrylWong a=herkolategan

Previously, cockroach start scripts would remain after the cluster has been wiped. To avoid issues when restarting a node (which will re-use an existing start script), the start scripts are also cleaned up during a wipe.

Release note: None
Epic: None

Co-authored-by: Herko Lategan <[email protected]>
  • Loading branch information
craig[bot] and herkolategan committed Jan 16, 2025
2 parents f02e671 + 67527ba commit 9434611
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/roachprod/install/cluster_synced.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,18 +619,23 @@ func (c *SyncedCluster) Wipe(ctx context.Context, l *logger.Logger, preserveCert
var cmd string
if c.IsLocal() {
// Not all shells like brace expansion, so we'll do it here
dirs := []string{"data*", "logs*"}
paths := []string{
"data*",
"logs*",
"cockroach-*.sh",
}
if !preserveCerts {
dirs = append(dirs, fmt.Sprintf("%s*", CockroachNodeCertsDir))
dirs = append(dirs, fmt.Sprintf("%s*", CockroachNodeTenantCertsDir))
paths = append(paths, fmt.Sprintf("%s*", CockroachNodeCertsDir))
paths = append(paths, fmt.Sprintf("%s*", CockroachNodeTenantCertsDir))
}
for _, dir := range dirs {
for _, dir := range paths {
cmd += fmt.Sprintf(`rm -fr %s/%s ;`, c.localVMDir(node), dir)
}
} else {
rmCmds := []string{
fmt.Sprintf(`sudo find /mnt/data* -maxdepth 1 -type f -not -name %s -exec rm -f {} \;`, vm.InitializedFile),
`sudo rm -fr /mnt/data*/{auxiliary,local,tmp,cassandra,cockroach,cockroach-temp*,mongo-data}`,
`sudo rm -fr cockroach-*.sh`,
`sudo rm -fr logs* data*`,
}
if !preserveCerts {
Expand Down

0 comments on commit 9434611

Please sign in to comment.