summaryrefslogtreecommitdiff
path: root/remoteexec/remoteexec.go
diff options
context:
space:
mode:
author Anas Sulaiman <mrahs@google.com> 2023-10-18 16:34:37 +0000
committer Anas Sulaiman <mrahs@google.com> 2023-10-18 19:37:24 +0000
commit9c4936405ed2aba6b2ecdb78b168a8a478686b20 (patch)
treec560ad4db2bc04d75feffc82083ef33bdedf7ac9 /remoteexec/remoteexec.go
parentd7471ec5cc3ff3167dc5d184a0be6fb5f3fbc51e (diff)
support toggling compare mode for rbe actions
This allows me to set metalava actions to run remotely (already toggleable) with local comparison (this CL). Change-Id: I66b006d5ee11b3192ef81a2e5cefc07e9f3d10a2
Diffstat (limited to 'remoteexec/remoteexec.go')
-rw-r--r--remoteexec/remoteexec.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/remoteexec/remoteexec.go b/remoteexec/remoteexec.go
index 9e7a0f1e3..150d62c04 100644
--- a/remoteexec/remoteexec.go
+++ b/remoteexec/remoteexec.go
@@ -15,6 +15,7 @@
package remoteexec
import (
+ "fmt"
"sort"
"strings"
)
@@ -84,6 +85,12 @@ type REParams struct {
// EnvironmentVariables is a list of environment variables whose values should be passed through
// to the remote execution.
EnvironmentVariables []string
+ // Boolean indicating whether to compare chosen exec strategy with local execution.
+ Compare bool
+ // Number of times the action should be rerun locally.
+ NumLocalRuns int
+ // Number of times the action should be rerun remotely.
+ NumRemoteRuns int
}
func init() {
@@ -135,6 +142,10 @@ func (r *REParams) wrapperArgs() string {
}
args += " --exec_strategy=" + strategy
+ if r.Compare && r.NumLocalRuns >= 0 && r.NumRemoteRuns >= 0 {
+ args += fmt.Sprintf(" --compare=true --num_local_reruns=%d --num_remote_reruns=%d", r.NumLocalRuns, r.NumRemoteRuns)
+ }
+
if len(r.Inputs) > 0 {
args += " --inputs=" + strings.Join(r.Inputs, ",")
}