@@ -59,11 +59,11 @@ type ProcessOptions struct {
5959 SkipEngineEnvVar bool
6060
6161 // If true, call corresponding phase:
62- FastValidate bool
63- Validate bool
64- Build bool
65- DeployPrepare bool
66- Deploy bool
62+ FastValidate bool
63+ Validate bool
64+ Build bool
65+ PreDeployChecks bool
66+ Deploy bool
6767
6868 // Indicate whether the bundle operation originates from the pipelines CLI
6969 IsPipelinesCLI bool
@@ -152,7 +152,7 @@ func ProcessBundleRet(cmd *cobra.Command, opts ProcessOptions) (*bundle.Bundle,
152152
153153 var stateDesc * statemgmt.StateDesc
154154
155- shouldReadState := opts .ReadState || opts .AlwaysPull || opts .InitIDs || opts .ErrorOnEmptyState || opts .DeployPrepare || opts .Deploy
155+ shouldReadState := opts .ReadState || opts .AlwaysPull || opts .InitIDs || opts .ErrorOnEmptyState || opts .PreDeployChecks || opts .Deploy
156156
157157 if shouldReadState {
158158 // PullResourcesState depends on stateFiler which needs b.Config.Workspace.StatePath which is set in phases.Initialize
@@ -206,9 +206,11 @@ func ProcessBundleRet(cmd *cobra.Command, opts ProcessOptions) (*bundle.Bundle,
206206 }
207207 }
208208
209- if opts .Build {
209+ var libs phases.LibLocationMap
210+
211+ if opts .Build || opts .Deploy {
210212 t2 := time .Now ()
211- phases .Build (ctx , b )
213+ libs = phases .Build (ctx , b )
212214 b .Metrics .ExecutionTimes = append (b .Metrics .ExecutionTimes , protos.IntMapEntry {
213215 Key : "phases.Build" ,
214216 Value : time .Since (t2 ).Milliseconds (),
@@ -219,12 +221,13 @@ func ProcessBundleRet(cmd *cobra.Command, opts ProcessOptions) (*bundle.Bundle,
219221 }
220222 }
221223
222- if opts .DeployPrepare {
223- if opts .Deploy {
224- panic ("Deploy already calls DeployPrepare internally" )
225- }
224+ if opts .PreDeployChecks {
226225 downgradeWarningToError := ! opts .Deploy
227- _ = phases .DeployPrepare (ctx , b , downgradeWarningToError , stateDesc .Engine )
226+ phases .PreDeployChecks (ctx , b , downgradeWarningToError , stateDesc .Engine )
227+
228+ if logdiag .HasError (ctx ) {
229+ return b , stateDesc , root .ErrAlreadyPrinted
230+ }
228231 }
229232
230233 if opts .Deploy {
@@ -236,7 +239,7 @@ func ProcessBundleRet(cmd *cobra.Command, opts ProcessOptions) (*bundle.Bundle,
236239 }
237240
238241 t3 := time .Now ()
239- phases .Deploy (ctx , b , outputHandler , stateDesc .Engine )
242+ phases .Deploy (ctx , b , outputHandler , stateDesc .Engine , libs )
240243 b .Metrics .ExecutionTimes = append (b .Metrics .ExecutionTimes , protos.IntMapEntry {
241244 Key : "phases.Deploy" ,
242245 Value : time .Since (t3 ).Milliseconds (),
0 commit comments