File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,8 @@ jobs:
164
164
with :
165
165
builder : ${{ steps.buildx.outputs.name }}
166
166
context : .
167
+ build-args : |
168
+ ANSIBLE_VERSION=9.4.0
167
169
file : deployment/docker/runner/Dockerfile
168
170
platforms : linux/amd64,linux/arm64 # ,linux/arm/v6
169
171
push : ${{ github.event_name != 'pull_request' }}
Original file line number Diff line number Diff line change @@ -153,6 +153,9 @@ func (t *TaskRunner) logPipe(reader io.Reader) {
153
153
}()
154
154
155
155
scanner := bufio .NewScanner (reader )
156
+ const maxCapacity = 10 * 1024 * 1024 // 10 MB
157
+ buf := make ([]byte , maxCapacity )
158
+ scanner .Buffer (buf , maxCapacity )
156
159
157
160
for scanner .Scan () {
158
161
line := scanner .Text ()
@@ -161,7 +164,28 @@ func (t *TaskRunner) logPipe(reader io.Reader) {
161
164
162
165
close (linesCh )
163
166
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 )
166
190
}
167
191
}
You can’t perform that action at this time.
0 commit comments