From 4ac2e33def0e7f14f07a21c6d43c8abc57590acb Mon Sep 17 00:00:00 2001 From: shreyas-goenka <88374338+shreyas-goenka@users.noreply.github.com> Date: Tue, 21 Mar 2023 13:17:15 +0100 Subject: [PATCH] Throw error when job run is skipped due to max_concurrent_runs (#257) Tested manually: Before we did not have get any errors/logs and silently failed in this case ``` shreyas.goenka@THW32HFW6T job-output % bricks bundle run foo Error: run skipped: Skipping this run because the limit of 1 maximum concurrent runs has been reached. ``` --- bundle/run/job.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bundle/run/job.go b/bundle/run/job.go index fa48379d..976668e4 100644 --- a/bundle/run/job.go +++ b/bundle/run/job.go @@ -190,6 +190,10 @@ func (r *jobRunner) Run(ctx context.Context, opts *Options) error { if err != nil { return err } + if run.State.LifeCycleState == jobs.RunLifeCycleStateSkipped { + log.Infof(ctx, "Run was skipped!") + return fmt.Errorf("run skipped: %s", run.State.StateMessage) + } switch run.State.ResultState { // The run was canceled at user request.