Skip to content

Commit 985cbfc

Browse files
committed
Do not write operations log to state files on errors by default
1 parent a3ea72f commit 985cbfc

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

cmd/hub/cmd/deploy.go

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var (
3030
hubSaveStackInstanceOutputs bool
3131
hubSyncStackInstance bool
3232
hubSyncSkipParametersAndOplog bool
33+
writeOplogToStateOnError bool
3334
)
3435

3536
var deployCmd = &cobra.Command{
@@ -141,6 +142,7 @@ func lifecycleRequest(args []string, verb string) (*lifecycle.Request, error) {
141142
Application: hubApplication,
142143
SyncStackInstance: hubSyncStackInstance,
143144
SyncSkipParametersAndOplog: hubSyncSkipParametersAndOplog,
145+
WriteOplogToStateOnError: writeOplogToStateOnError,
144146
}
145147

146148
return request, nil
@@ -174,6 +176,8 @@ func initDeployUndeployFlags(cmd *cobra.Command, verb string) {
174176
"Sync Stack Instance state to SuperHub (--hub-stack-instance must be set)")
175177
cmd.Flags().BoolVarP(&hubSyncSkipParametersAndOplog, "hub-sync-skip-parameters-and-oplog", "", false,
176178
"Sync skip syncing Stack Instance parameters and operation log")
179+
cmd.Flags().BoolVar(&writeOplogToStateOnError, "write-oplog-to-state-on-error", false,
180+
"Write operations log to state files on error")
177181
initCommonLifecycleFlags(cmd, verb)
178182
initCommonApiFlags(cmd)
179183
}

cmd/hub/lifecycle/deploy.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ NEXT_COMPONENT:
386386

387387
var rawOutputs parameters.RawOutputs
388388
if err != nil {
389-
if stateManifest != nil {
389+
if stateManifest != nil && request.WriteOplogToStateOnError {
390390
stateManifest = state.AppendOperationLog(stateManifest, operationLogId,
391391
fmt.Sprintf("%v%s", err, formatStdoutStderr(stdout, stderr)))
392392
}

cmd/hub/lifecycle/types.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ type Request struct {
2222
Application string
2323
SyncStackInstance bool
2424
SyncSkipParametersAndOplog bool
25+
WriteOplogToStateOnError bool
2526
}

0 commit comments

Comments
 (0)