Refactor ActionRunJob parsing into a reusable function#35623
Refactor ActionRunJob parsing into a reusable function#35623lunny merged 5 commits intogo-gitea:mainfrom
Conversation
|
Made some changes in 0c14f30 . Since |
| if wfJobs, _ := jobparser.Parse(actionRunJob.WorkflowPayload); len(wfJobs) == 1 { | ||
| _, wfJob := wfJobs[0].Job() | ||
| hasIf = len(wfJob.If.Value) > 0 | ||
| // FIXME evaluate this on the server side |
There was a problem hiding this comment.
Could you elaborate more details? For example, what wrong would happen and how to evaluate on server side?
There was a problem hiding this comment.
I plan to create a more detailed refactoring proposal issue collection soon. 1
how to evaluate on server side?
This is similar to what concurrency for jobs is currently doing, Gitea references gitea/act that has all code for doing this kind of thing.
what wrong would happen
- a to be skipped job lands in the concurrency group and prevents a non skipped job of the same group from running
- a to be skipped job waits for a runner to become online to update the job status to skipped
- gitea can just update the status to skipped without additional db writes, by skipping the Status Waiting.
- all contexts should be available to the server
- needs
- vars
- github/gitea
- (env) extension
More refactoring is needed for those examples:
- strategy (matrix) is evaluated even if the condition is false (extension matrix in if then strategy must evaluate earlier)
- e.g. the expression in strategy depends on outputs not being set or you want to skip all
- Reusable Workflows without runs-on should run on server as well and they should be able to deliver jobs to multiple different runners
- job
if: ${{ cancelled() }}should be able to ignore cancel requests to be delivered to the runner- currently gitea force cancels every job, without a grace period of 5min
Footnotes
-
The problems I describe are platform differences between GitHub and Gitea Actions that I would like to remove, already existing enhancements towards Actions should be unaffected ↩
Sounds good, would improve logging |
* giteaofficial/main: [skip ci] Updated translations via Crowdin Update JS deps, misc tweaks (go-gitea#35643) Bump actions/checkout to v5 (go-gitea#35644) nix flake update (go-gitea#35639) Cleanup ActionRun creation (go-gitea#35624) bump archives&rar dep (go-gitea#35637) Fix merge panic (go-gitea#35606) Bump happy-dom from 19.0.2 to 20.0.0 (go-gitea#35625) Refactor ActionRunJob parsing into a reusable function (go-gitea#35623) Fix code tag style problem and LFS view bug (go-gitea#35628) Support Actions `concurrency` syntax (go-gitea#32751) The status icon of the Action step is consistent with GitHub (go-gitea#35618) Mock external service in hcaptcha TestCaptcha (go-gitea#35604) Fix inputing review comment will remove reviewer (go-gitea#35591) [skip ci] Updated translations via Crowdin Fix diffpatch API endpoint (go-gitea#35610) Print PR-Title into tooltip for actions (go-gitea#35579)
Use a helper method around the jobparser for parsing a single job structure from an ActionRunJob