Skip to content

Commit

Permalink
fix agent panic in RunStep
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zhao <[email protected]>
  • Loading branch information
PetrusZ committed Jan 21, 2025
1 parent feabc99 commit b088d67
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/cli/zadig-agent/internal/agent/step/step.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package step

import (
"context"
"errors"
"fmt"

"github.com/koderover/zadig/v2/pkg/cli/zadig-agent/helper/log"
Expand Down Expand Up @@ -48,6 +49,11 @@ func RunStep(ctx context.Context, jobCtx *jobctl.JobContext, step *commonmodels.
var stepInstance Step
var err error

if step == nil {
log.Errorf("step is nil")
return errors.New("step is nil")
}

switch step.StepType {
case "batch_file":
stepInstance, err = script.NewBatchFileStep(jobCtx.Outputs, step.Spec, dirs, envs, secretEnvs, logger)
Expand Down

0 comments on commit b088d67

Please sign in to comment.