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

Fix bugs in rerunning jobs #29955

Merged
merged 9 commits into from
Mar 22, 2024
Merged

Fix bugs in rerunning jobs #29955

merged 9 commits into from
Mar 22, 2024

Conversation

Zettat123
Copy link
Contributor

@Zettat123 Zettat123 commented Mar 21, 2024

Fix #28761
Fix #27884
Fix #28093

Changes

Rerun all jobs

When rerun all jobs, status of the jobs with needs will be set to blocked instead of waiting. Therefore, these jobs will not run until the required jobs are completed.

Rerun a single job

When a single job is rerun, its dependents should also be rerun, just like GitHub does (#28761 (comment)). In this case, only the specified job will be set to waiting, its dependents will be set to blocked to wait the job.

Show warning if every job has needs

If every job in a workflow has needs, all jobs will be blocked and no job can be run. So I add a warning message.

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

lunny commented Mar 21, 2024

It's better to have some tests.

@Zettat123
Copy link
Contributor Author

It's better to have some tests.

Yes. I will add some tests and more explanation later

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 21, 2024
@Zettat123 Zettat123 marked this pull request as ready for review March 21, 2024 07:51
@Zettat123 Zettat123 changed the title WIP: Fix bugs in rerunning jobs Fix bugs in rerunning jobs Mar 21, 2024
@lunny lunny added the backport/v1.21 This PR should be backported to Gitea 1.21 label Mar 21, 2024
@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 Mar 21, 2024
@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 Mar 21, 2024
@lunny
Copy link
Member

lunny commented Mar 21, 2024

Looks like when rerunning a job, it will return an error.

image

@lunny lunny self-requested a review March 21, 2024 15:59
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Mar 21, 2024
@silverwind silverwind self-requested a review March 21, 2024 16:06
@GiteaBot GiteaBot added lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 21, 2024
@Zettat123
Copy link
Contributor Author

Looks like when rerunning a job, it will return an error.

image

Caused by a missing ctx.JSON. Fixed in 5021f55

@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 Mar 22, 2024
@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 Mar 22, 2024
@wolfogre wolfogre added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 22, 2024
@lunny lunny enabled auto-merge (squash) March 22, 2024 02:37
@lunny lunny merged commit 2f060c5 into go-gitea:main Mar 22, 2024
26 checks passed
@GiteaBot GiteaBot added this to the 1.23.0 milestone Mar 22, 2024
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 22, 2024
GiteaBot pushed a commit to GiteaBot/gitea that referenced this pull request Mar 22, 2024
Fix go-gitea#28761
Fix go-gitea#27884
Fix go-gitea#28093

## Changes

### Rerun all jobs
When rerun all jobs, status of the jobs with `needs` will be set to
`blocked` instead of `waiting`. Therefore, these jobs will not run until
the required jobs are completed.

### Rerun a single job
When a single job is rerun, its dependents should also be rerun, just
like GitHub does
(go-gitea#28761 (comment)).
In this case, only the specified job will be set to `waiting`, its
dependents will be set to `blocked` to wait the job.

### Show warning if every job has `needs`
If every job in a workflow has `needs`, all jobs will be blocked and no
job can be run. So I add a warning message.

<img
src="https://github.com/go-gitea/gitea/assets/15528715/88f43511-2360-465d-be96-ee92b57ff67b"
width="480px" />
@GiteaBot GiteaBot added the backport/done All backports for this PR have been created label Mar 22, 2024
lunny added a commit that referenced this pull request Mar 22, 2024
Backport #29955 by @Zettat123

Fix #28761
Fix #27884
Fix #28093

## Changes

### Rerun all jobs
When rerun all jobs, status of the jobs with `needs` will be set to
`blocked` instead of `waiting`. Therefore, these jobs will not run until
the required jobs are completed.

### Rerun a single job
When a single job is rerun, its dependents should also be rerun, just
like GitHub does
(#28761 (comment)).
In this case, only the specified job will be set to `waiting`, its
dependents will be set to `blocked` to wait the job.

### Show warning if every job has `needs`
If every job in a workflow has `needs`, all jobs will be blocked and no
job can be run. So I add a warning message.

<img
src="https://github.com/go-gitea/gitea/assets/15528715/88f43511-2360-465d-be96-ee92b57ff67b"
width="480px" />

---------

Co-authored-by: Zettat123 <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 22, 2024
* giteaofficial/main:
  Fix bugs in rerunning jobs (go-gitea#29955)
  remove PATH and GOPATH modification in Makefile (go-gitea#29978)
  Refactor external URL detection (go-gitea#29973)
  Refactor repo header/list (go-gitea#29969)
  Fix various loading states, remove `.loading` class (go-gitea#29920)
  Update register application URL for GitLab (go-gitea#29959)
  Refactor StringsToInt64s (go-gitea#29967)
  Switch to happy-dom for testing (go-gitea#29948)
  Performance improvements for pull request list page (go-gitea#29900)
@lunny lunny modified the milestones: 1.23.0, 1.22.0 Mar 22, 2024
silverwind pushed a commit to silverwind/gitea that referenced this pull request Mar 22, 2024
Fix go-gitea#28761
Fix go-gitea#27884
Fix go-gitea#28093

## Changes

### Rerun all jobs
When rerun all jobs, status of the jobs with `needs` will be set to
`blocked` instead of `waiting`. Therefore, these jobs will not run until
the required jobs are completed.

### Rerun a single job
When a single job is rerun, its dependents should also be rerun, just
like GitHub does
(go-gitea#28761 (comment)).
In this case, only the specified job will be set to `waiting`, its
dependents will be set to `blocked` to wait the job.

### Show warning if every job has `needs`
If every job in a workflow has `needs`, all jobs will be blocked and no
job can be run. So I add a warning message.

<img
src="https://github.com/go-gitea/gitea/assets/15528715/88f43511-2360-465d-be96-ee92b57ff67b"
width="480px" />
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jun 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created backport/v1.21 This PR should be backported to Gitea 1.21 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 modifies/translation size/L Denotes a PR that changes 100-499 lines, ignoring generated files. topic/gitea-actions related to the actions of Gitea type/bug
Projects
None yet
5 participants