From b8eb09d27b7be293b56f7c4630b651ec7526d7f7 Mon Sep 17 00:00:00 2001 From: zc Date: Sat, 30 Mar 2024 20:30:01 +0800 Subject: [PATCH] fix nil check --- core/worker/hooks/docker/convert.go | 7 ++++--- core/worker/worker.go | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/worker/hooks/docker/convert.go b/core/worker/hooks/docker/convert.go index ebf85e8..94e108a 100644 --- a/core/worker/hooks/docker/convert.go +++ b/core/worker/hooks/docker/convert.go @@ -71,9 +71,10 @@ func toHostConfig(spec *worker.Workflow, step *worker.Step) *container.HostConfi Type: "json-file", }, } - // windows do not support privileged, so we hard-code - // this value to false. - if spec.Worker != nil && spec.Worker.Platform.OS == "windows" { + + // windows do not support privileged, + // so we hard-code this value to false. + if spec.Worker != nil && spec.Worker.Platform != nil && spec.Worker.Platform.OS == "windows" { config.Privileged = false } if len(step.Network) > 0 { diff --git a/core/worker/worker.go b/core/worker/worker.go index 7c1ef98..7add80e 100644 --- a/core/worker/worker.go +++ b/core/worker/worker.go @@ -214,7 +214,7 @@ func execute( secretValueSet := sets.New[string]() for _, secret := range secrets { - if err := secret.Decrypt(); err == nil { + if err := secret.Decrypt(); err != nil { status.Phase = v1.PhaseFailed status.Error = err.Error() for _, step := range status.Steps {