woodpecker/pipeline/backend
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
..
common GenerateScript should not return encoded script (#1397) 2022-11-06 13:36:34 +01:00
docker fix: docker backend should not close 'engine.Tail' result (#1616) 2023-03-12 16:01:09 +01:00
kubernetes Ensure the SharedInformerFactory closes eventually (#1585) 2023-02-16 00:54:33 +01:00
local Use modern error handling and enforce it via lint (#1327) 2023-02-02 00:08:02 +01:00
ssh GenerateScript should not return encoded script (#1397) 2022-11-06 13:36:34 +01:00
types Add option to ignore failures on steps (#1219) 2022-11-15 19:47:27 +01:00
backend.go Adding initial version of Kubernetes backend (#552) 2022-09-05 06:01:14 +02:00