Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package controllers

import (
"context"
"path/filepath"
"testing"
"time"
Expand All @@ -38,6 +39,7 @@ import (

"github.com/kubevela/pkg/util/singleton"
"github.com/kubevela/workflow/api/v1alpha1"
"github.com/kubevela/workflow/pkg/executor"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -86,6 +88,7 @@ var _ = BeforeSuite(func(ctx SpecContext) {
singleton.KubeClient.Set(k8sClient)
fakeDynamicClient := fake.NewSimpleDynamicClient(testScheme)
singleton.DynamicClient.Set(fakeDynamicClient)
executor.InitStepStatusCache(context.Background())

reconciler = &WorkflowRunReconciler{
Client: k8sClient,
Expand Down
7 changes: 4 additions & 3 deletions controllers/workflowrun_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ func (r *WorkflowRunReconciler) matchControllerRequirement(wr *v1alpha1.Workflow

// SetupWithManager sets up the controller with the Manager.
func (r *WorkflowRunReconciler) SetupWithManager(mgr ctrl.Manager) error {
executor.InitStepStatusCache(context.Background())
builder := ctrl.NewControllerManagedBy(mgr)
if feature.DefaultMutableFeatureGate.Enabled(features.EnableWatchEventListener) {
builder = builder.Watches(&triggerv1alpha1.EventListener{}, ctrlHandler.EnqueueRequestsFromMapFunc(findObjectForEventListener))
Expand Down Expand Up @@ -255,7 +256,7 @@ func (r *WorkflowRunReconciler) SetupWithManager(mgr ctrl.Manager) error {
func (r *WorkflowRunReconciler) endWithNegativeCondition(ctx context.Context, wr *v1alpha1.WorkflowRun, condition condition.Condition) (ctrl.Result, error) {
wr.SetConditions(condition)
if err := r.Status().Patch(ctx, wr, client.Merge); err != nil {
executor.StepStatusCache.Store(fmt.Sprintf("%s-%s", wr.Name, wr.Namespace), -1)
executor.StepStatusCache.Put(fmt.Sprintf("%s-%s", wr.Name, wr.Namespace), -1, ReconcileTimeout)
return ctrl.Result{}, errors.WithMessage(err, "failed to patch workflowrun status")
}
return ctrl.Result{}, fmt.Errorf("reconcile WorkflowRun error, msg: %s", condition.Message)
Expand All @@ -266,13 +267,13 @@ func (r *workflowRunPatcher) patchStatus(ctx context.Context, status *v1alpha1.W
wr := r.run
if isUpdate {
if err := r.Status().Update(ctx, wr); err != nil {
executor.StepStatusCache.Store(fmt.Sprintf("%s-%s", wr.Name, wr.Namespace), -1)
executor.StepStatusCache.Put(fmt.Sprintf("%s-%s", wr.Name, wr.Namespace), -1, ReconcileTimeout)
return errors.WithMessage(err, "failed to update workflowrun status")
}
return nil
}
if err := r.Status().Patch(ctx, wr, client.Merge); err != nil {
executor.StepStatusCache.Store(fmt.Sprintf("%s-%s", wr.Name, wr.Namespace), -1)
executor.StepStatusCache.Put(fmt.Sprintf("%s-%s", wr.Name, wr.Namespace), -1, ReconcileTimeout)
return errors.WithMessage(err, "failed to patch workflowrun status")
}
return nil
Expand Down
25 changes: 14 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ go 1.23.8

require (
cuelang.org/go v0.14.1
github.com/agiledragon/gomonkey/v2 v2.4.0
github.com/agiledragon/gomonkey/v2 v2.9.0
github.com/aliyun/aliyun-log-go-sdk v0.1.38
github.com/crossplane/crossplane-runtime v1.16.0
github.com/evanphx/json-patch v5.6.0+incompatible
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
github.com/evanphx/json-patch v5.7.0+incompatible
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8
github.com/google/go-cmp v0.7.0
github.com/hashicorp/go-version v1.6.0
github.com/kubevela/kube-trigger v0.1.1-0.20250711201929-51c837aa9bd2
github.com/kubevela/pkg v1.11.1
github.com/kubevela/pkg v1.11.1-0.20260722232534-455842713731
github.com/onsi/ginkgo/v2 v2.23.3
github.com/onsi/gomega v1.36.2
github.com/pkg/errors v0.9.1
Expand All @@ -21,8 +21,8 @@ require (
github.com/prometheus/common v0.55.0
github.com/robfig/cron/v3 v3.0.1
github.com/spf13/pflag v1.0.7
github.com/stretchr/testify v1.9.0
golang.org/x/time v0.5.0
github.com/stretchr/testify v1.10.0
golang.org/x/time v0.10.0
gomodules.xyz/jsonpatch/v2 v2.4.0
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
k8s.io/api v0.31.10
Expand All @@ -41,7 +41,7 @@ require (
dario.cat/mergo v1.0.0 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
Expand All @@ -51,11 +51,11 @@ require (
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
github.com/emicklei/proto v1.14.2 // indirect
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/frankban/quicktest v1.11.3 // indirect
github.com/frankban/quicktest v1.14.3 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-kit/kit v0.10.0 // indirect
Expand All @@ -65,12 +65,13 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/cel-go v0.20.1 // indirect
github.com/google/gnostic-models v0.6.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
Expand All @@ -85,6 +86,7 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.10 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -108,7 +110,7 @@ require (
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
go.opentelemetry.io/otel v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect
go.opentelemetry.io/otel/metric v1.28.0 // indirect
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.28.0 // indirect
Expand All @@ -125,6 +127,7 @@ require (
golang.org/x/term v0.33.0 // indirect
golang.org/x/text v0.27.0 // indirect
golang.org/x/tools v0.35.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/grpc v1.67.1 // indirect
Expand Down
Loading
Loading