Skip to content

Commit b07b6f6

Browse files
committed
fix: merge conflict
2 parents 5ad07e8 + 9a2c994 commit b07b6f6

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ jobs:
164164
with:
165165
builder: ${{ steps.buildx.outputs.name }}
166166
context: .
167+
build-args: |
168+
ANSIBLE_VERSION=9.4.0
167169
file: deployment/docker/runner/Dockerfile
168170
platforms: linux/amd64,linux/arm64 #,linux/arm/v6
169171
push: ${{ github.event_name != 'pull_request' }}

services/tasks/TaskRunner_logging.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ func (t *TaskRunner) logPipe(reader io.Reader) {
153153
}()
154154

155155
scanner := bufio.NewScanner(reader)
156+
const maxCapacity = 10 * 1024 * 1024 // 10 MB
157+
buf := make([]byte, maxCapacity)
158+
scanner.Buffer(buf, maxCapacity)
156159

157160
for scanner.Scan() {
158161
line := scanner.Text()
@@ -161,7 +164,28 @@ func (t *TaskRunner) logPipe(reader io.Reader) {
161164

162165
close(linesCh)
163166

164-
if scanner.Err() != nil && scanner.Err().Error() != "EOF" {
165-
util.LogDebugF(scanner.Err(), log.Fields{"error": "Failed to read TaskRunner output"})
167+
if scanner.Err() != nil {
168+
if scanner.Err().Error() == "EOF" {
169+
return // it is ok
170+
}
171+
172+
msg := "Failed to read TaskRunner output"
173+
174+
switch scanner.Err().Error() {
175+
case "EOF", "os: process already finished":
176+
return // it is ok
177+
case "bufio.Scanner: token too long":
178+
msg = "TaskRunner output exceeds the maximum allowed size of 10MB"
179+
break
180+
}
181+
182+
t.kill() // kill the job because stdout cannot be read.
183+
184+
log.WithError(scanner.Err()).WithFields(log.Fields{
185+
"task_id": t.Task.ID,
186+
"context": "task_logger",
187+
}).Error(msg)
188+
189+
t.Log("Fatal error: " + msg)
166190
}
167191
}

0 commit comments

Comments
 (0)