Skip to content

Make local backend work with cli exec#4102

Merged
6543 merged 33 commits into
woodpecker-ci:mainfrom
6543-forks:make-cli-exec-work-with-local-backend
Oct 27, 2025
Merged

Make local backend work with cli exec#4102
6543 merged 33 commits into
woodpecker-ci:mainfrom
6543-forks:make-cli-exec-work-with-local-backend

Conversation

@6543
Copy link
Copy Markdown
Member

@6543 6543 commented Sep 11, 2024

Currently if you try to exec a pipeline via the cli tool and use the local backend, all files are missing.
This will detect this specific case and use the new added option in the local backend to specify a execution directory upfront.

Test usecase

  1. create new directory with .woodpecker.yaml config and echo.txt file:
steps:
  echo:
    image: bash
    commands: cat echo.txt
hello devs
  1. exec with cli via docker backend -> should work
image 3. exec with cli via local backend

3.1 without patch shuld fail
image
3.2 with patch shuld work
image


Sponsored by Kithara Software GmbH

@6543 6543 added enhancement improve existing features cli backend/local labels Sep 11, 2024
@woodpecker-bot
Copy link
Copy Markdown
Contributor

woodpecker-bot commented Sep 11, 2024

Surge PR preview deployment was removed

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 11, 2024

Codecov Report

❌ Patch coverage is 19.23077% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 21.19%. Comparing base (e4e208d) to head (a99dabc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pipeline/backend/local/local.go 23.80% 15 Missing and 1 partial ⚠️
cli/exec/exec.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4102      +/-   ##
==========================================
- Coverage   21.19%   21.19%   -0.01%     
==========================================
  Files         425      425              
  Lines       38349    38367      +18     
==========================================
+ Hits         8128     8130       +2     
- Misses      29466    29482      +16     
  Partials      755      755              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread docs/docs/30-administration/22-backends/20-local.md Outdated
@6543
Copy link
Copy Markdown
Member Author

6543 commented Sep 12, 2024

@anbraten if you know an better way to do:

woodpecker-cli.exe exec --backend-engine local --pipeline-event push --commit-branch main

to test local backend via cli in windows / linux please tell :)

@anbraten
Copy link
Copy Markdown
Member

Will do some testing. Fyi #3967 might be quite interesting for you.

@6543
Copy link
Copy Markdown
Member Author

6543 commented Sep 12, 2024

Yes thus might allow more :)

Should i hide the flag and undocument it so we have it working now and can improve it later?

@anbraten
Copy link
Copy Markdown
Member

The usage of the local property was somehow not compatible with the local backend. This fixes it for me so I was able to run:

go run ../cmd/cli/ exec --pipeline-event push --commit-branch main --backend-engine local --local

https://github.com/woodpecker-ci/woodpecker/compare/main...anbraten:local-path?expand=1

@6543
Copy link
Copy Markdown
Member Author

6543 commented Sep 30, 2024

I looked at your solution, this has 2 problems:

  1. the 'repo-path' is now (miss-)used at the local backend even if it never was registered there (the lib we have do handle that but its outside of our convention)
  2. artifacts that should not be there like temporary exec files are now stored inside the current repo, witch differs completly on how the backend is executed with server&agent combi
  3. the bug mentioned in 2. affects docker backend if exec via cli now too (because of the removed volume)

the only thing i could addopt in my patch from your suggestion would be 1. witch breaks the convention ...
... not sure if this makes maintaining this harder...

@6543
Copy link
Copy Markdown
Member Author

6543 commented Sep 30, 2024

what i could do and did, is to hide that option from the user: 7101cdb

@6543 6543 requested a review from anbraten September 30, 2024 09:32
@6543
Copy link
Copy Markdown
Member Author

6543 commented Oct 30, 2024

@anbraten are you still blocking this?

@pat-s pat-s marked this pull request as draft January 5, 2025 21:14
@6543 6543 marked this pull request as ready for review March 27, 2025 14:02
@6543
Copy link
Copy Markdown
Member Author

6543 commented Mar 27, 2025

@anbraten I can not find side effects you had concerns when we talked about this ...

... anyway I renamed the flag so it is clear that it is for internal usage only ...

Comment thread cli/exec/exec.go Outdated
@6543 6543 requested a review from xoxys October 22, 2025 12:24
@6543
Copy link
Copy Markdown
Member Author

6543 commented Oct 22, 2025

ok @xoxys found a better way that does not expose stuff

@6543
Copy link
Copy Markdown
Member Author

6543 commented Oct 22, 2025

Test usecase

  1. create new directory with .woodpecker.yaml config and echo.txt file:
steps:
  echo:
    image: bash
    commands: cat echo.txt
hello devs
  1. exec with cli via docker backend -> should work
image 3. exec with cli via local backend

3.1 without patch shuld fail
image
3.2 with patch shuld work
image

@6543
Copy link
Copy Markdown
Member Author

6543 commented Oct 22, 2025

@anbraten i still want your opinion and dont overule you ...

@6543
Copy link
Copy Markdown
Member Author

6543 commented Oct 27, 2025

@anbraten will merge after ci pased

@6543 6543 merged commit 393a598 into woodpecker-ci:main Oct 27, 2025
8 of 9 checks passed
@6543 6543 deleted the make-cli-exec-work-with-local-backend branch October 27, 2025 12:12
@woodpecker-bot woodpecker-bot mentioned this pull request Oct 27, 2025
1 task
@anbraten
Copy link
Copy Markdown
Member

As this does not introduce new config settings, I am also fine with it. Will give it a test at some point and we can check now if we can further streamline the use-cases of the cli exec command here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend/local cli enhancement improve existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants