Skip to content

Commit

Permalink
Fix: add deploy as built-in step to avoid parse in offline mode (#6201)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderflow committed Jul 11, 2023
1 parent 9edd6eb commit 2117554
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/workflow/step/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (g *DeployWorkflowStepGenerator) Generate(app *v1beta1.Application, existin
steps = append(steps, workflowv1alpha1.WorkflowStep{
WorkflowStepBase: workflowv1alpha1.WorkflowStepBase{
Name: "deploy",
Type: "deploy",
Type: DeployWorkflowStep,
Properties: util.Object2RawExtension(map[string]interface{}{"policies": append([]string{}, overrides...)}),
},
})
Expand All @@ -190,6 +190,7 @@ func IsBuiltinWorkflowStepType(wfType string) bool {
wftypes.WorkflowStepTypeApplyComponent,
wftypes.WorkflowStepTypeBuiltinApplyComponent,
wftypes.WorkflowStepTypeStepGroup,
DeployWorkflowStep,
} {
if _type == wfType {
return true
Expand Down
9 changes: 9 additions & 0 deletions pkg/workflow/step/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -290,3 +291,11 @@ func TestWorkflowStepGenerator(t *testing.T) {
})
}
}

func TestIsBuiltinWorkflowStepType(t *testing.T) {
assert.True(t, IsBuiltinWorkflowStepType("deploy"))
assert.True(t, IsBuiltinWorkflowStepType("suspend"))
assert.True(t, IsBuiltinWorkflowStepType("apply-component"))
assert.True(t, IsBuiltinWorkflowStepType("step-group"))
assert.True(t, IsBuiltinWorkflowStepType("builtin-apply-component"))
}

0 comments on commit 2117554

Please sign in to comment.