fix: host-based executor, clarify error message from missing working-directory #1257

Merged
mfenniak merged 1 commit from mfenniak/forgejo-runner:upgrade-missing-workdir-to-error into main 2026-01-05 15:24:14 +00:00
Owner

Setting a step to a working directory that doesn't exist causes a debug-level message, typically filtered out by the log level configuration, and then immediately follows with a confusing error. The working directory is the directory that cannot be found, but the error appears as:

 ⚙️ [runner]: RUN fork/exec /usr/bin/sh: no such file or directory

To address this, I've upgraded the debug-level message to an error that stops execution.

This is not a breaking change as it already would have stopped execution.

Fixes #1256.

  • bug fixes
    • PR: fix: host-based executor, clarify error message from missing working-directory
Setting a step to a working directory that doesn't exist causes a `debug`-level message, typically filtered out by the log level configuration, and then immediately follows with a confusing error. The working directory is the directory that cannot be found, but the error appears as: ``` ⚙️ [runner]: RUN fork/exec /usr/bin/sh: no such file or directory ``` To address this, I've upgraded the `debug`-level message to an error that stops execution. This is not a breaking change as it already would have stopped execution. Fixes #1256. <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/1257): <!--number 1257 --><!--line 0 --><!--description Zml4OiBob3N0LWJhc2VkIGV4ZWN1dG9yLCBjbGFyaWZ5IGVycm9yIG1lc3NhZ2UgZnJvbSBtaXNzaW5nIHdvcmtpbmctZGlyZWN0b3J5-->fix: host-based executor, clarify error message from missing working-directory<!--description--> <!--end release-notes-assistant-->
aahlenst left a comment
Member

Stat() would succeed on a file, but still be invalid. Might make sense to handle that case. As a nice side-effect, it would enable a nicer error message, for example, "working directory is a file" or "working directory does not exist". "failed to stat working directory" is not user-friendly.

`Stat()` would succeed on a file, but still be invalid. Might make sense to handle that case. As a nice side-effect, it would enable a nicer error message, for example, "working directory is a file" or "working directory does not exist". "failed to stat working directory" is not user-friendly.
mfenniak force-pushed upgrade-missing-workdir-to-error from 028ad74992
Some checks are pending
issue-labels / release-notes (pull_request_target) Waiting to run
checks / build and test (pull_request) Waiting to run
checks / runner exec tests (pull_request) Blocked by required conditions
checks / integration tests (docker-latest) (pull_request) Waiting to run
checks / integration tests (docker-stable) (pull_request) Waiting to run
checks / runner integration tests (pull_request) Blocked by required conditions
checks / validate mocks (pull_request) Waiting to run
checks / validate pre-commit-hooks file (pull_request) Waiting to run
cascade / debug (pull_request_target) Waiting to run
cascade / forgejo (pull_request_target) Waiting to run
cascade / end-to-end (pull_request_target) Waiting to run
to 00d01f0989
All checks were successful
checks / validate pre-commit-hooks file (pull_request) Successful in 1m21s
checks / validate mocks (pull_request) Successful in 1m36s
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / build and test (pull_request) Successful in 4m55s
checks / runner exec tests (pull_request) Successful in 49s
checks / runner integration tests (pull_request) Successful in 9m18s
checks / integration tests (docker-latest) (pull_request) Successful in 16m25s
checks / integration tests (docker-stable) (pull_request) Successful in 19m40s
cascade / debug (pull_request_target) Has been skipped
cascade / end-to-end (pull_request_target) Successful in 7s
cascade / forgejo (pull_request_target) Successful in 1m45s
2026-01-05 14:53:29 +00:00
Compare
Author
Owner

That's a good call; the error message would otherwise be quite confusing there as well since it still seems associated with the shell:

⚙️ [runner]: RUN fork/exec /usr/bin/sh: not a directory

I've added a !IsDir() check and manually tested it:

⚙️ [runner]: working directory /home/mfenniak/.cache/act/3a5d8a793d4519cf/hostexecutor/workspace is not a directory
That's a good call; the error message would otherwise be quite confusing there as well since it still seems associated with the shell: ``` ⚙️ [runner]: RUN fork/exec /usr/bin/sh: not a directory ``` I've added a `!IsDir()` check and manually tested it: ``` ⚙️ [runner]: working directory /home/mfenniak/.cache/act/3a5d8a793d4519cf/hostexecutor/workspace is not a directory ```
aahlenst approved these changes 2026-01-05 15:04:11 +00:00
aahlenst left a comment
Member

Thanks, great!

Thanks, great!
mfenniak deleted branch upgrade-missing-workdir-to-error 2026-01-05 15:24:14 +00:00
viceice approved these changes 2026-01-05 23:14:24 +00:00
Owner

a test would have been nice 🙂

a test would have been nice 🙂
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/runner!1257
No description provided.