woodpecker/pipeline
Alexander Matyushentsev 5e1171d7a7
fix: docker backend should not close 'engine.Tail' result (#1616)
Closes https://github.com/woodpecker-ci/woodpecker/issues/1615

The error described in
https://github.com/woodpecker-ci/woodpecker/issues/1615 is happening
because `Tail` method of the docker backend closes the instance of
`io.ReadCloser` it returns in `defer` function. As a result anything
that try to read data returned by `Tail` method eventually will attempt
to read from closes reader and get an error:


2171212c5a/pipeline/backend/docker/docker.go (L229)

The fix is just don't close returned reader and let the consumer of
`Tail` method do it. Good thing is that `Tail` is used only in one place
and reader is correctly closed:


2171212c5a/pipeline/pipeline.go (L231-L237)

Example of `woodpecker exec` output using pipeline from
https://github.com/woodpecker-ci/woodpecker/issues/1615 with the fix:

```
woodpecker exec .woodpecker.yaml
[step1:L0:0s] + echo step1
[step1:L1:0s] step1
[step2:L0:0s] + echo step2
[step2:L1:0s] step2
```

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2023-03-12 16:01:09 +01:00
..
backend fix: docker backend should not close 'engine.Tail' result (#1616) 2023-03-12 16:01:09 +01:00
frontend Use modern error handling and enforce it via lint (#1327) 2023-02-02 00:08:02 +01:00
multipart Dedup code and migrate away from deprecated funcs (#1141) 2022-08-30 01:14:07 +02:00
rpc Store an agents list and add agent heartbeats (#1189) 2023-01-28 14:13:04 +01:00
samples Replace DRONE_ with CI_ variables in pipeline steps (#427) 2021-11-25 20:43:31 +01:00
schema Add option to ignore failures on steps (#1219) 2022-11-15 19:47:27 +01:00
shared Fix multiline secrets replacer (#700) 2022-01-16 22:57:37 +01:00
drone_compatibility.go Fix wrong drone env vars (#1419) 2022-11-22 23:57:12 +01:00
error.go Fix invalid service names for Kubernetes (#1234) 2022-10-05 13:39:48 +02:00
error_test.go Move cncd/pipeline/pipeline/ to pipeline/ (#347) 2021-09-24 13:18:34 +02:00
logger.go Renamed procs/jobs to steps in code (#1331) 2022-10-28 17:38:53 +02:00
option.go Make pipeline runtime log with description (#970) 2022-06-15 18:11:20 +02:00
option_test.go Move cncd/pipeline/pipeline/ to pipeline/ (#347) 2021-09-24 13:18:34 +02:00
pipeline.go Refactor agent: split code in subfunctions (#1441) 2022-11-23 15:35:24 +01:00
stepBuilder.go Split and refactor (#1394) 2022-11-06 12:44:04 +01:00
stepBuilder_test.go Split and refactor (#1394) 2022-11-06 12:44:04 +01:00
tracer.go Fix wrong drone env vars (#1419) 2022-11-22 23:57:12 +01:00