Skip to content

Commit c5ab77d

Browse files
authored
Fix configured markdown to be set before interactive commands are executed (#233)
This PR configures the markdown before executing interactive commands, as the final status updates happen before the interactive commands finish executing.
1 parent 5ae57e7 commit c5ab77d

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

internal/engine/environments/azure.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ type AzureDeploymentStatus struct {
3636

3737
func NewAzureDeploymentStatus() AzureDeploymentStatus {
3838
return AzureDeploymentStatus{
39-
Steps: []AzureStep{},
40-
CurrentStep: 0,
41-
Status: "Executing",
42-
ResourceURIs: []string{},
43-
Error: "",
39+
Steps: []AzureStep{},
40+
CurrentStep: 0,
41+
Status: "Executing",
42+
ResourceURIs: []string{},
43+
Error: "",
44+
ConfiguredMarkdown: "",
45+
Output: "",
4446
}
4547
}
4648

@@ -134,6 +136,7 @@ func ReportAzureStatus(status AzureDeploymentStatus, environment string) {
134136
// We add these strings to the output so that the portal can find and parse
135137
// the JSON status.
136138
ocdStatus := fmt.Sprintf("ie_us%sie_ue", statusJson)
139+
logging.GlobalLogger.Tracef("Generated status: %s", ocdStatus)
137140
fmt.Println(ui.OcdStatusUpdateStyle.Render(ocdStatus))
138141
}
139142
}

internal/engine/interactive/interactive.go

+14
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,20 @@ func handleUserInput(
191191
model.environment,
192192
)
193193

194+
environmentVariables, err := lib.LoadEnvironmentStateFile(
195+
lib.DefaultEnvironmentStateFile,
196+
)
197+
if err != nil {
198+
logging.GlobalLogger.Errorf("Failed to load environment state file: %s", err)
199+
model.azureStatus.SetError(err)
200+
}
201+
202+
model.azureStatus.ConfigureMarkdownForDownload(
203+
model.markdownSource,
204+
environmentVariables,
205+
model.environment,
206+
)
207+
194208
commands = append(commands, tea.Sequence(
195209
common.UpdateAzureStatus(model.azureStatus, model.environment),
196210
func() tea.Msg {

0 commit comments

Comments
 (0)