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

Improve the handling of jobs.<job_id>.if #31070

Merged
merged 5 commits into from
May 27, 2024

Conversation

Zettat123
Copy link
Contributor

Fix #25897
Fix #30322

#29464 cannot handle some complex if conditions correctly because it only checks always() literally. In fact, it's not easy to evaluate the if condition on the Gitea side because evaluating it requires a series of contexts. But act_runner is able to evaluate the if condition before running the job (for more information, see gitea/act) . So we can use act_runner to check the if condition.

In this PR, how to handle a blocked job depends on its needs and if:

  • If not all jobs in needs completed successfully and the job's if is empty, set the job status to StatusSkipped
  • In other cases, the job status will be set to StatusWaiting, and then act_runner will check the if condition and run the job if the condition is met

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 24, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 24, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label May 24, 2024
@Zettat123 Zettat123 added type/bug topic/gitea-actions related to the actions of Gitea labels May 24, 2024
@lunny
Copy link
Member

lunny commented May 25, 2024

Whether this PR depends on a PR of act runner?

@Zettat123
Copy link
Contributor Author

Whether this PR depends on a PR of act runner?

No. We don't need to modify act_runner

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels May 25, 2024
@lunny lunny added the backport/v1.22 This PR should be backported to Gitea 1.22 label May 25, 2024
Copy link
Member

@wolfogre wolfogre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. But I'm not sure to backport it to 1.21. I'll say it's an improvement, not a bugfix, and it will change some behaviors with Actions, we need time to see how it affects.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 26, 2024
@lunny lunny removed type/bug backport/v1.22 This PR should be backported to Gitea 1.22 labels May 26, 2024
@yp05327 yp05327 added this to the 1.23.0 milestone May 27, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 27, 2024
@lunny lunny merged commit 31a0c4d into go-gitea:main May 27, 2024
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 27, 2024
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/M Denotes a PR that changes 30-99 lines, ignoring generated files. topic/gitea-actions related to the actions of Gitea
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Job status seems to be unavailable in workflow [Bug] Gitea Actions - Job if statements are ignored
5 participants