Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/prow-job-executor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/go-logr/logr v1.4.3
github.com/google/uuid v1.6.0
github.com/spf13/cobra v1.10.2
google.golang.org/protobuf v1.36.11
k8s.io/apimachinery v0.35.3
sigs.k8s.io/prow v0.0.0-20251030184004-0e4d5be4200d
sigs.k8s.io/yaml v1.6.0
Expand Down Expand Up @@ -170,7 +171,6 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
google.golang.org/grpc v1.78.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
9 changes: 7 additions & 2 deletions tools/prow-job-executor/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func DefaultExecuteOptions() *RawExecuteOptions {
BaseRef: defaultBaseRef,
Org: defaultOrg,
Repo: defaultRepo,
AbortOnCancel: true,
}
}

Expand All @@ -83,6 +84,7 @@ func (o *RawExecuteOptions) BindFlags(cmd *cobra.Command) error {
cmd.Flags().StringVar(&o.ProwURL, "prow-url", o.ProwURL, "Prow API URL for job status monitoring")
cmd.Flags().BoolVar(&o.DryRun, "dry-run", o.DryRun, "Print which job would be started, but do not start one.")
cmd.Flags().BoolVar(&o.GatePromotion, "gate-promotion", o.GatePromotion, "Exit with an error code if the job fails.")
cmd.Flags().BoolVar(&o.AbortOnCancel, "abort-on-cancel", o.AbortOnCancel, "Abort the running Prow job if the executor is cancelled (e.g. the rollout is cancelled and the process receives SIGTERM).")
cmd.Flags().StringVar(&o.BaseSha, "base-sha", o.BaseSha, "Git commit SHA to test against. When set, the job is triggered as a postsubmit with this specific commit instead of HEAD.")
cmd.Flags().StringVar(&o.BaseRef, "base-ref", o.BaseRef, "Git base ref (branch) for the postsubmit job (requires --base-sha)")
cmd.Flags().StringVar(&o.Org, "org", o.Org, "GitHub org for the postsubmit job (requires --base-sha)")
Expand Down Expand Up @@ -121,6 +123,7 @@ type RawExecuteOptions struct {
ProwURL string
DryRun bool
GatePromotion bool
AbortOnCancel bool

// Git ref options for postsubmit execution pinned to a specific commit.
// When BaseSha is set, the job is triggered as a postsubmit instead of a periodic.
Expand Down Expand Up @@ -160,6 +163,7 @@ type completedExecuteOptions struct {
ProwURL string
DryRun bool
GatePromotion bool
AbortOnCancel bool

// Git ref options for postsubmit execution
BaseSha string
Expand Down Expand Up @@ -291,6 +295,7 @@ func (o *ValidatedExecuteOptions) Complete(ctx context.Context) (*ExecuteOptions
ProwURL: o.ProwURL,
DryRun: o.DryRun,
GatePromotion: o.GatePromotion,
AbortOnCancel: o.AbortOnCancel,
BaseSha: o.BaseSha,
BaseRef: o.BaseRef,
Org: o.Org,
Expand All @@ -309,7 +314,7 @@ func (o *ExecuteOptions) Execute(ctx context.Context) error {
client := prowjob.NewClient(o.ProwToken, o.GangwayURL, o.ProwURL)

// Create job monitor
monitor := prowjob.NewMonitor(client, o.PollInterval, o.Timeout, o.DryRun, o.GatePromotion)
monitor := prowjob.NewMonitor(client, o.PollInterval, o.Timeout, o.DryRun, o.GatePromotion, o.AbortOnCancel)

// Prepare environment variables, including the region
envs := make(map[string]string)
Expand Down Expand Up @@ -509,7 +514,7 @@ func (o *ValidatedMonitorOptions) Complete(ctx context.Context) (*MonitorOptions
func (o *MonitorOptions) Monitor(ctx context.Context, logger logr.Logger) error {
// Create Prow client and monitor
client := prowjob.NewClient(o.ProwToken, o.GangwayURL, o.ProwURL)
monitor := prowjob.NewMonitor(client, o.PollInterval, o.Timeout, false, false)
monitor := prowjob.NewMonitor(client, o.PollInterval, o.Timeout, false, false, false)

// Monitor existing job using shared polling logic
logger.Info("Starting to monitor existing job", "jobExecutionID", o.JobExecutionID)
Expand Down
Loading