Fix: add deploy as built-in step to avoid parse in offline mode (#6201)

This commit is contained in:
Jianbo Sun
2023-07-11 17:23:32 +08:00
committed by GitHub
parent 9edd6ebc30
commit 2117554d53
2 changed files with 11 additions and 1 deletions

View File

@@ -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...)}),
},
})
@@ -190,6 +190,7 @@ func IsBuiltinWorkflowStepType(wfType string) bool {
wftypes.WorkflowStepTypeApplyComponent,
wftypes.WorkflowStepTypeBuiltinApplyComponent,
wftypes.WorkflowStepTypeStepGroup,
DeployWorkflowStep,
} {
if _type == wfType {
return true

View File

@@ -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"
@@ -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"))
}