summaryrefslogtreecommitdiffstats
path: root/pkg/runner
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/runner')
-rw-r--r--pkg/runner/action.go6
-rw-r--r--pkg/runner/run_context.go2
-rw-r--r--pkg/runner/runner_test.go38
-rw-r--r--pkg/runner/step.go2
-rw-r--r--pkg/runner/testdata/skip/skip.yml9
5 files changed, 52 insertions, 5 deletions
diff --git a/pkg/runner/action.go b/pkg/runner/action.go
index 416e5e4..fd52c0b 100644
--- a/pkg/runner/action.go
+++ b/pkg/runner/action.go
@@ -619,17 +619,17 @@ func shouldRunPostStep(step actionStep) common.Conditional {
stepResult := stepResults[step.getStepModel().ID]
if stepResult == nil {
- log.WithField("stepResult", model.StepStatusSkipped).Debugf("skipping post step for '%s'; step was not executed", step.getStepModel())
+ log.WithField("stepResult", model.StepStatusSkipped).Infof("skipping post step for '%s'; step was not executed", step.getStepModel())
return false
}
if stepResult.Conclusion == model.StepStatusSkipped {
- log.WithField("stepResult", model.StepStatusSkipped).Debugf("skipping post step for '%s'; main step was skipped", step.getStepModel())
+ log.WithField("stepResult", model.StepStatusSkipped).Infof("skipping post step for '%s'; main step was skipped", step.getStepModel())
return false
}
if step.getActionModel() == nil {
- log.WithField("stepResult", model.StepStatusSkipped).Debugf("skipping post step for '%s': no action model available", step.getStepModel())
+ log.WithField("stepResult", model.StepStatusSkipped).Infof("skipping post step for '%s': no action model available", step.getStepModel())
return false
}
diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go
index 8ecdb2b..6aaf2d8 100644
--- a/pkg/runner/run_context.go
+++ b/pkg/runner/run_context.go
@@ -911,7 +911,7 @@ func (rc *RunContext) isEnabled(ctx context.Context) (bool, error) {
}
if !runJob {
- l.WithField("jobResult", "skipped").Debugf("Skipping job '%s' due to '%s'", job.Name, job.If.Value)
+ l.WithField("jobResult", "skipped").Infof("Skipping job '%s' due to '%s'", job.Name, job.If.Value)
return false, nil
}
diff --git a/pkg/runner/runner_test.go b/pkg/runner/runner_test.go
index 70e9634..ecb5ce5 100644
--- a/pkg/runner/runner_test.go
+++ b/pkg/runner/runner_test.go
@@ -187,6 +187,7 @@ func (j *TestJobFileInfo) runTest(ctx context.Context, t *testing.T, cfg *Config
GitHubInstance: "github.com",
ContainerArchitecture: cfg.ContainerArchitecture,
Matrix: cfg.Matrix,
+ JobLoggerLevel: cfg.JobLoggerLevel,
}
runner, err := New(runnerConfig)
@@ -490,6 +491,43 @@ func TestRunDifferentArchitecture(t *testing.T) {
tjfi.runTest(context.Background(), t, &Config{ContainerArchitecture: "linux/arm64"})
}
+type runSkippedHook struct {
+ found bool
+}
+
+func (h *runSkippedHook) Levels() []log.Level {
+ return []log.Level{log.InfoLevel}
+}
+
+func (h *runSkippedHook) Fire(entry *log.Entry) error {
+ if v, ok := entry.Data["stepResult"]; ok {
+ h.found = (v == model.StepStatusSkipped)
+ }
+ return nil
+}
+
+func TestRunSkipped(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping integration test")
+ }
+
+ tjfi := TestJobFileInfo{
+ workdir: workdir,
+ workflowPath: "skip",
+ eventName: "push",
+ errorMessage: "",
+ platforms: platforms,
+ }
+
+ h := &runSkippedHook{}
+ ctx := common.WithLoggerHook(context.Background(), h)
+
+ jobLoggerLevel := log.InfoLevel
+ tjfi.runTest(ctx, t, &Config{ContainerArchitecture: "linux/arm64", JobLoggerLevel: &jobLoggerLevel})
+
+ assert.True(t, h.found)
+}
+
type maskJobLoggerFactory struct {
Output bytes.Buffer
}
diff --git a/pkg/runner/step.go b/pkg/runner/step.go
index c67b5b0..ec3cfe2 100644
--- a/pkg/runner/step.go
+++ b/pkg/runner/step.go
@@ -94,7 +94,7 @@ func runStepExecutor(step step, stage stepStage, executor common.Executor) commo
if !runStep {
stepResult.Conclusion = model.StepStatusSkipped
stepResult.Outcome = model.StepStatusSkipped
- logger.WithField("stepResult", stepResult.Outcome).Debugf("Skipping step '%s' due to '%s'", stepModel, ifExpression)
+ logger.WithField("stepResult", stepResult.Outcome).Infof("Skipping step '%s' due to '%s'", stepModel, ifExpression)
return nil
}
diff --git a/pkg/runner/testdata/skip/skip.yml b/pkg/runner/testdata/skip/skip.yml
new file mode 100644
index 0000000..7f6d303
--- /dev/null
+++ b/pkg/runner/testdata/skip/skip.yml
@@ -0,0 +1,9 @@
+name: skip
+on: push
+
+jobs:
+ check:
+ runs-on: ubuntu-latest
+ steps:
+ - if: false
+ run: echo nothing