Skip to content

Commit 33d8d14

Browse files
committed
drtprod: artifacts dependencies on remote
Previously, the `drtprod` executable was moved from the `artifacts` directory in which `drtprod` checks for dependencies. Since some of the YAML scripts require `drtprod` as a dependency as well, this should rather be copied. Fixes: #150408 Epic: None Release note: None
1 parent 0545074 commit 33d8d14

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

pkg/cmd/drtprod/cli/commands/yamlprocessor.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,11 @@ func setupAndExecute(
283283
// Move the drtprod binary to /usr/bin to ensure it is available system-wide on the cluster.
284284
err := roachprodRun(ctx, logger, monitorClusterName, "", "", true,
285285
os.Stdout, os.Stderr,
286-
[]string{fmt.Sprintf("sudo mv %s /usr/bin", drtprodLocation)},
286+
[]string{fmt.Sprintf("sudo cp %s /usr/bin", drtprodLocation)},
287+
install.RunOptions{FailOption: install.FailSlow})
288+
if err != nil {
289+
return err
290+
}
287291

288292
// Enable linger for the default user, so that the cloud subprocess is not
289293
// killed when the user logs out.

pkg/cmd/drtprod/cli/commands/yamlprocessor_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ environment:
313313
roachprodRun = func(ctx context.Context, l *logger.Logger, clusterName,
314314
SSHOptions, processTag string, secure bool, stdout, stderr io.Writer,
315315
cmdArray []string, options install.RunOptions) error {
316-
if strings.HasPrefix(cmdArray[0], "sudo mv") {
316+
if strings.HasPrefix(cmdArray[0], "sudo cp") {
317317
return fmt.Errorf("move command failed")
318318
}
319319
return nil
@@ -419,11 +419,11 @@ environment:
419419
runCmds["mkdir"] = make([]string, 0)
420420
}
421421
runCmds["mkdir"] = append(runCmds["mkdir"], cmdArray[0])
422-
} else if strings.HasPrefix(cmdArray[0], "sudo mv") {
423-
if _, ok := runCmds["mv"]; !ok {
424-
runCmds["mv"] = make([]string, 0)
422+
} else if strings.HasPrefix(cmdArray[0], "sudo cp") {
423+
if _, ok := runCmds["cp"]; !ok {
424+
runCmds["cp"] = make([]string, 0)
425425
}
426-
runCmds["mv"] = append(runCmds["mv"], cmdArray[0])
426+
runCmds["cp"] = append(runCmds["cp"], cmdArray[0])
427427
} else if strings.HasPrefix(cmdArray[0], "sudo systemd-run") {
428428
if _, ok := runCmds["systemd"]; !ok {
429429
runCmds["systemd"] = make([]string, 0)
@@ -458,7 +458,7 @@ environment:
458458
t.Log(runCmds)
459459
require.Equal(t, 3, len(runCmds))
460460
require.Equal(t, 4, len(runCmds["mkdir"]))
461-
require.Equal(t, 1, len(runCmds["mv"]))
461+
require.Equal(t, 1, len(runCmds["cp"]))
462462
require.Equal(t, 1, len(runCmds["systemd"]))
463463
require.Equal(t, "sudo systemd-run --unit test-monitor --same-dir --uid $(id -u) --gid $(id -g) drtprod execute ./location/to/test.yaml",
464464
runCmds["systemd"][0])
@@ -493,11 +493,11 @@ environment:
493493
runCmds["mkdir"] = make([]string, 0)
494494
}
495495
runCmds["mkdir"] = append(runCmds["mkdir"], cmdArray[0])
496-
} else if strings.HasPrefix(cmdArray[0], "sudo mv") {
497-
if _, ok := runCmds["mv"]; !ok {
498-
runCmds["mv"] = make([]string, 0)
496+
} else if strings.HasPrefix(cmdArray[0], "sudo cp") {
497+
if _, ok := runCmds["cp"]; !ok {
498+
runCmds["cp"] = make([]string, 0)
499499
}
500-
runCmds["mv"] = append(runCmds["mv"], cmdArray[0])
500+
runCmds["cp"] = append(runCmds["cp"], cmdArray[0])
501501
} else if strings.HasPrefix(cmdArray[0], "sudo systemd-run") {
502502
if _, ok := runCmds["systemd"]; !ok {
503503
runCmds["systemd"] = make([]string, 0)
@@ -532,7 +532,7 @@ environment:
532532
t.Log(runCmds)
533533
require.Equal(t, 3, len(runCmds))
534534
require.Equal(t, 4, len(runCmds["mkdir"]))
535-
require.Equal(t, 1, len(runCmds["mv"]))
535+
require.Equal(t, 1, len(runCmds["cp"]))
536536
require.Equal(t, 1, len(runCmds["systemd"]))
537537
require.Equal(t, "sudo systemd-run --unit test-monitor --same-dir --uid $(id -u) --gid $(id -g) --setenv=DD_API_KEY=the_secret drtprod execute ./location/to/test.yaml",
538538
runCmds["systemd"][0])
@@ -563,11 +563,11 @@ environment:
563563
runCmds["mkdir"] = make([]string, 0)
564564
}
565565
runCmds["mkdir"] = append(runCmds["mkdir"], cmdArray[0])
566-
} else if strings.HasPrefix(cmdArray[0], "sudo mv") {
567-
if _, ok := runCmds["mv"]; !ok {
568-
runCmds["mv"] = make([]string, 0)
566+
} else if strings.HasPrefix(cmdArray[0], "sudo cp") {
567+
if _, ok := runCmds["cp"]; !ok {
568+
runCmds["cp"] = make([]string, 0)
569569
}
570-
runCmds["mv"] = append(runCmds["mv"], cmdArray[0])
570+
runCmds["cp"] = append(runCmds["cp"], cmdArray[0])
571571
} else if strings.HasPrefix(cmdArray[0], "sudo systemd-run") {
572572
if _, ok := runCmds["systemd"]; !ok {
573573
runCmds["systemd"] = make([]string, 0)
@@ -602,7 +602,7 @@ environment:
602602
t.Log(runCmds)
603603
require.Equal(t, 3, len(runCmds))
604604
require.Equal(t, 4, len(runCmds["mkdir"]))
605-
require.Equal(t, 1, len(runCmds["mv"]))
605+
require.Equal(t, 1, len(runCmds["cp"]))
606606
require.Equal(t, 1, len(runCmds["systemd"]))
607607
require.Equal(t, "sudo systemd-run --unit test-monitor --same-dir --uid $(id -u) --gid $(id -g) drtprod execute ./location/to/test.yaml -t target1",
608608
runCmds["systemd"][0])

0 commit comments

Comments
 (0)