@@ -44,6 +44,11 @@ func (ao *ApplyOperation) Apply(req *ApplyRequest) (rsp *ApplyResponse, s v1.Sta
4444 log .Infof ("engine: Apply start!" )
4545 o := ao .Operation
4646
47+ // keep release state
48+ rsp = & ApplyResponse {
49+ Release : req .Release ,
50+ }
51+
4752 defer func () {
4853 close (o .MsgCh )
4954
@@ -62,12 +67,12 @@ func (ao *ApplyOperation) Apply(req *ApplyRequest) (rsp *ApplyResponse, s v1.Sta
6267 }()
6368
6469 if s = validateApplyRequest (req ); v1 .IsErr (s ) {
65- return nil , s
70+ return rsp , s
6671 }
6772
6873 // Update the operation semaphore.
6974 if err := o .UpdateSemaphore (); err != nil {
70- return nil , v1 .NewErrorStatus (err )
75+ return rsp , v1 .NewErrorStatus (err )
7176 }
7277
7378 // 1. init & build Indexes
@@ -81,22 +86,22 @@ func (ao *ApplyOperation) Apply(req *ApplyRequest) (rsp *ApplyResponse, s v1.Sta
8186
8287 runtimesMap , s := runtimeinit .Runtimes (* req .Release .Spec , * req .Release .State )
8388 if v1 .IsErr (s ) {
84- return nil , s
89+ return rsp , s
8590 }
8691 o .RuntimeMap = runtimesMap
8792
8893 // 2. build & walk DAG
8994 applyGraph , s := newApplyGraph (req .Release .Spec , priorState )
9095 if v1 .IsErr (s ) {
91- return nil , s
96+ return rsp , s
9297 }
9398 log .Infof ("Apply Graph:\n %s" , applyGraph .String ())
9499 // Get dependencies and dependents of each node to be populated into resource graph.
95100 resourceGraph := populateResourceGraph (applyGraph , req .Graph )
96101
97102 rel , s := copyRelease (req .Release )
98103 if v1 .IsErr (s ) {
99- return nil , s
104+ return rsp , s
100105 }
101106 applyOperation := & ApplyOperation {
102107 Operation : models.Operation {
@@ -122,10 +127,10 @@ func (ao *ApplyOperation) Apply(req *ApplyRequest) (rsp *ApplyResponse, s v1.Sta
122127 // Wait
123128 if diags := w .Wait (); diags .HasErrors () {
124129 s = v1 .NewErrorStatus (diags .Err ())
125- return nil , s
126130 }
127-
128- return & ApplyResponse {Release : applyOperation .Release , Graph : resourceGraph }, nil
131+ rsp .Release = applyOperation .Release
132+ rsp .Graph = resourceGraph
133+ return rsp , s
129134}
130135
131136func (ao * ApplyOperation ) walkFun (v dag.Vertex ) (diags tfdiags.Diagnostics ) {
0 commit comments