diff --git a/apis/core.oam.dev/v1beta1/applicationrevision_types.go b/apis/core.oam.dev/v1beta1/applicationrevision_types.go index 211fcfa3b..4065858ee 100644 --- a/apis/core.oam.dev/v1beta1/applicationrevision_types.go +++ b/apis/core.oam.dev/v1beta1/applicationrevision_types.go @@ -135,6 +135,8 @@ type ApplicationRevisionStatus struct { Succeeded bool `json:"succeeded"` // Workflow the running status of the workflow Workflow *common.WorkflowStatus `json:"workflow,omitempty"` + // Record the context values to the revision. + WorkflowContext map[string]string `json:"workflowContext,omitempty"` } // +kubebuilder:object:root=true diff --git a/apis/core.oam.dev/v1beta1/zz_generated.deepcopy.go b/apis/core.oam.dev/v1beta1/zz_generated.deepcopy.go index da7290cbc..6e758b61f 100644 --- a/apis/core.oam.dev/v1beta1/zz_generated.deepcopy.go +++ b/apis/core.oam.dev/v1beta1/zz_generated.deepcopy.go @@ -293,6 +293,13 @@ func (in *ApplicationRevisionStatus) DeepCopyInto(out *ApplicationRevisionStatus *out = new(common.WorkflowStatus) (*in).DeepCopyInto(*out) } + if in.WorkflowContext != nil { + in, out := &in.WorkflowContext, &out.WorkflowContext + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationRevisionStatus. diff --git a/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml b/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml index 1a0c43dda..33569b6c8 100644 --- a/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml +++ b/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml @@ -5042,6 +5042,11 @@ spec: - suspend - terminated type: object + workflowContext: + additionalProperties: + type: string + description: Record the context values to the revision. + type: object required: - succeeded type: object diff --git a/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml b/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml index 1a0c43dda..33569b6c8 100644 --- a/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml +++ b/charts/vela-minimal/crds/core.oam.dev_applicationrevisions.yaml @@ -5042,6 +5042,11 @@ spec: - suspend - terminated type: object + workflowContext: + additionalProperties: + type: string + description: Record the context values to the revision. + type: object required: - succeeded type: object diff --git a/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml b/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml index 8b4688a74..4952cdf6a 100644 --- a/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml +++ b/legacy/charts/vela-core-legacy/crds/core.oam.dev_applicationrevisions.yaml @@ -5042,6 +5042,11 @@ spec: - suspend - terminated type: object + workflowContext: + additionalProperties: + type: string + description: Record the context values to the revision. + type: object required: - succeeded type: object diff --git a/pkg/controller/core.oam.dev/v1alpha2/application/revision.go b/pkg/controller/core.oam.dev/v1alpha2/application/revision.go index fe4f1302b..4b996db22 100644 --- a/pkg/controller/core.oam.dev/v1alpha2/application/revision.go +++ b/pkg/controller/core.oam.dev/v1alpha2/application/revision.go @@ -1025,6 +1025,16 @@ func (h *AppHandler) UpdateApplicationRevisionStatus(ctx context.Context, appRev } appRev.Status.Succeeded = succeed appRev.Status.Workflow = wfStatus + + // Versioned the context backend values. + if wfStatus.ContextBackend != nil { + var cm corev1.ConfigMap + if err := h.r.Client.Get(ctx, ktypes.NamespacedName{Namespace: wfStatus.ContextBackend.Namespace, Name: wfStatus.ContextBackend.Name}, &cm); err != nil { + klog.Error(err, "[UpdateApplicationRevisionStatus] failed to load the context values", "ApplicationRevision", appRev.Name) + } + appRev.Status.WorkflowContext = cm.Data + } + if err := h.r.Client.Status().Update(ctx, appRev); err != nil { if logCtx, ok := ctx.(monitorContext.Context); ok { logCtx.Error(err, "[UpdateApplicationRevisionStatus] failed to update application revision status", "ApplicationRevision", appRev.Name)