Merge pull request #19941 from hashicorp/svh/f-early-logging
backend/remote: log early to indicate execution started
This commit is contained in:
commit
bb1edadcf0
|
@ -225,7 +225,7 @@ func (b *Remote) opApply(stopCtx, cancelCtx context.Context, op *backend.Operati
|
||||||
const applyDefaultHeader = `
|
const applyDefaultHeader = `
|
||||||
[reset][yellow]Running apply in the remote backend. Output will stream here. Pressing Ctrl-C
|
[reset][yellow]Running apply in the remote backend. Output will stream here. Pressing Ctrl-C
|
||||||
will cancel the remote apply if its still pending. If the apply started it
|
will cancel the remote apply if its still pending. If the apply started it
|
||||||
will stop streaming the logs, but will not stop the apply running remotely.
|
will stop streaming the logs, but will not stop the apply running remotely.[reset]
|
||||||
To view this run in a browser, visit:
|
|
||||||
https://%s/app/%s/%s/runs/%s[reset]
|
Preparing the remote apply...
|
||||||
`
|
`
|
||||||
|
|
|
@ -117,6 +117,14 @@ func (b *Remote) opPlan(stopCtx, cancelCtx context.Context, op *backend.Operatio
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Remote) plan(stopCtx, cancelCtx context.Context, op *backend.Operation, w *tfe.Workspace) (*tfe.Run, error) {
|
func (b *Remote) plan(stopCtx, cancelCtx context.Context, op *backend.Operation, w *tfe.Workspace) (*tfe.Run, error) {
|
||||||
|
if b.CLI != nil {
|
||||||
|
header := planDefaultHeader
|
||||||
|
if op.Type == backend.OperationTypeApply {
|
||||||
|
header = applyDefaultHeader
|
||||||
|
}
|
||||||
|
b.CLI.Output(b.Colorize().Color(strings.TrimSpace(header) + "\n"))
|
||||||
|
}
|
||||||
|
|
||||||
configOptions := tfe.ConfigurationVersionCreateOptions{
|
configOptions := tfe.ConfigurationVersionCreateOptions{
|
||||||
AutoQueueRuns: tfe.Bool(false),
|
AutoQueueRuns: tfe.Bool(false),
|
||||||
Speculative: tfe.Bool(op.Type == backend.OperationTypePlan),
|
Speculative: tfe.Bool(op.Type == backend.OperationTypePlan),
|
||||||
|
@ -232,12 +240,8 @@ func (b *Remote) plan(stopCtx, cancelCtx context.Context, op *backend.Operation,
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.CLI != nil {
|
if b.CLI != nil {
|
||||||
header := planDefaultHeader
|
|
||||||
if op.Type == backend.OperationTypeApply {
|
|
||||||
header = applyDefaultHeader
|
|
||||||
}
|
|
||||||
b.CLI.Output(b.Colorize().Color(strings.TrimSpace(fmt.Sprintf(
|
b.CLI.Output(b.Colorize().Color(strings.TrimSpace(fmt.Sprintf(
|
||||||
header, b.hostname, b.organization, op.Workspace, r.ID)) + "\n"))
|
runHeader, b.hostname, b.organization, op.Workspace, r.ID)) + "\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
r, err = b.waitForRun(stopCtx, cancelCtx, op, "plan", r, w)
|
r, err = b.waitForRun(stopCtx, cancelCtx, op, "plan", r, w)
|
||||||
|
@ -286,8 +290,13 @@ func (b *Remote) plan(stopCtx, cancelCtx context.Context, op *backend.Operation,
|
||||||
|
|
||||||
const planDefaultHeader = `
|
const planDefaultHeader = `
|
||||||
[reset][yellow]Running plan in the remote backend. Output will stream here. Pressing Ctrl-C
|
[reset][yellow]Running plan in the remote backend. Output will stream here. Pressing Ctrl-C
|
||||||
will stop streaming the logs, but will not stop the plan running remotely.
|
will stop streaming the logs, but will not stop the plan running remotely.[reset]
|
||||||
To view this run in a browser, visit:
|
|
||||||
|
Preparing the remote plan...
|
||||||
|
`
|
||||||
|
|
||||||
|
const runHeader = `
|
||||||
|
[reset][yellow]To view this run in a browser, visit:
|
||||||
https://%s/app/%s/%s/runs/%s[reset]
|
https://%s/app/%s/%s/runs/%s[reset]
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue