Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ All notable changes to `src-cli` are documented in this file.

### Fixed

- For internal use only: `-text-only` silently ignored an error when trying to print log messages and did not print a `EXECUTING_TASKS` message.

### Removed

## 3.30.2
Expand Down
12 changes: 9 additions & 3 deletions internal/batches/ui/json_lines.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ func logOperationProgress(op, msg string) {

func logEvent(e batchesLogEvent) {
e.Timestamp = time.Now().UTC().Truncate(time.Millisecond)
json.NewEncoder(os.Stdout).Encode(e)
err := json.NewEncoder(os.Stdout).Encode(e)
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
}

// TODO: Until we've figured out what exactly we want to expose, we create
Expand All @@ -223,18 +226,21 @@ type taskExecutionJSONLines struct {

func (ui *taskExecutionJSONLines) Start(tasks []*executor.Task) {
ui.linesTasks = make(map[*executor.Task]jsonLinesTask, len(tasks))
var linesTasks []jsonLinesTask
for _, t := range tasks {
ui.linesTasks[t] = jsonLinesTask{
linesTask := jsonLinesTask{
Repository: t.Repository.Name,
Workspace: t.Path,
Steps: t.Steps,
CachedStepResultsFound: t.CachedResultFound,
StartStep: t.CachedResult.StepIndex,
}
ui.linesTasks[t] = linesTask
linesTasks = append(linesTasks, linesTask)
}

logEvent(batchesLogEvent{Operation: "EXECUTING_TASKS", Status: "STARTED", Metadata: map[string]interface{}{
"tasks": ui.linesTasks,
"tasks": linesTasks,
}})
}

Expand Down