Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

woodpecker exec intermittently switches between local and docker backends #1617

Closed
alexmt opened this issue Mar 12, 2023 · 0 comments · Fixed by #1618
Closed

woodpecker exec intermittently switches between local and docker backends #1617

alexmt opened this issue Mar 12, 2023 · 0 comments · Fixed by #1618
Labels
bug Something isn't working

Comments

@alexmt
Copy link
Contributor

alexmt commented Mar 12, 2023

Component

cli

Describe the bug

The woodpecker exec command is not consistent when run on the machine with docker installed. . It intermittently switches between local and docker backends.

Steps to reproduce:

To reproduce try to execute the following pipeline multiple times:

.woodpecker.yaml

pipeline:
  step1:
    image: golang
    commands:
      - echo step1
while true; do  woodpecker exec .woodpecker.yaml; done
[step1:L0:0s] + echo step1
[step1:L1:0s] step1
[step1:L0:0s] + echo step1
[step1:L1:0s] step1
[step1:L0:0s] + echo step1
[step1:L1:0s] step1
[step1:L0:0s] + echo step1
[step1:L1:0s] step1
[step1:L0:0s] Backend engine error while running step: exec: "golang": executable file not found in $PATH1:48PM FTL error running cli error="exec: \"golang\": executable file not found in $PATH"
[step1:L0:0s] + echo step1
[step1:L1:0s] step1
[step1:L0:0s] Backend engine error while running step: exec: "golang": executable file not found in $PATH1:48PM FTL error running cli error="exec: \"golang\": executable file not found in $PATH"
[step1:L0:0s] Backend engine error while running step: exec: "golang": executable file not found in $PATH1:48PM FTL error running cli error="exec: \"golang\": executable file not found in $PATH"

Periodically woodpecker chooses to use the local backend.

Expected Behavior:

CLI should consistently choose the same backend. IMHO docker backend should take priority over local backend.

System Info

woodpecker-cli --version                                                                                    
woodpecker-cli version 0.15.6


### Additional context

_No response_

### Validations

- [X] Read the [Contributing Guidelines](https://github.com/woodpecker-ci/woodpecker/blob/master/CONTRIBUTING.md).
- [X] Read the [docs](https://woodpecker-ci.org/docs/intro).
- [X] Check that there isn't [already an issue](https://github.com/woodpecker-ci/woodpecker/issues) that reports the same bug to avoid creating a duplicate.
- [X] Checked that the bug isn't fixed in the `next` version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
- [X] Check that this is a concrete bug. For Q&A join our [Discord Chat Server](https://discord.gg/fcMQqSMXJy) or the [Matrix room](https://matrix.to/#/#woodpecker:matrix.org).
@alexmt alexmt added the bug Something isn't working label Mar 12, 2023
lafriks pushed a commit that referenced this issue Mar 13, 2023
Closes #1617

The `woodpecker exec` auto-detects the backend by iterating over a map
of backends. However, since Go 1 the runtime randomizes map iteration
order, so a random backend might be chosen during each execution.

PR changes to auto-detection to iterate over the backends list with
predefined priority: `docker`, `local`, `ssh`, `kubernetes`.

---------

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant