-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Refactor ActionRunJob parsing into a reusable function #35623
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
base: main
Are you sure you want to change the base?
Refactor ActionRunJob parsing into a reusable function #35623
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Use a helper method around the jobparser for parsing a single job structure from an ActionRunJob