chore(cleanup): delete a network scheduled for deletion even if there is no service #189

Merged
earl-warren merged 1 commit from earl-warren/act:wip-network into main 2025-07-22 06:08:31 +00:00
Contributor

In the current implementation, the network will only be created and be scheduled to be deleted when there is a service:

func (rc *RunContext) networkName() (string, bool) {
	if len(rc.Run.Job().Services) > 0 || rc.Config.ContainerNetworkMode == "" {
		return fmt.Sprintf("%s-%s-network", rc.jobContainerName(), rc.Run.JobID), true
	}
	return string(rc.Config.ContainerNetworkMode), false
}

Therefore it does not currently make a difference. However, in case the network creation logic changes and a network is created even if a service is not present, it would be incorrect not to delete it.

In the current implementation, the network will only be created and be scheduled to be deleted when there is a service: ```go func (rc *RunContext) networkName() (string, bool) { if len(rc.Run.Job().Services) > 0 || rc.Config.ContainerNetworkMode == "" { return fmt.Sprintf("%s-%s-network", rc.jobContainerName(), rc.Run.JobID), true } return string(rc.Config.ContainerNetworkMode), false } ``` Therefore it does not currently make a difference. However, in case the network creation logic changes and a network is created even if a service is not present, it would be incorrect not to delete it.
Contributor

cascading-pr updated at forgejo/runner#721

cascading-pr updated at https://code.forgejo.org/forgejo/runner/pulls/721
Author
Contributor

Although this is evidently the right thing to do, it is still unclear why it is necessary. The network is deleted as it should so it has to happen somewhere else and this removal of the network is not actually necessary.

<del>Although this is evidently the right thing to do, it is still unclear why it is necessary. The network is deleted as it should so it has to happen somewhere else and this removal of the network is not actually necessary.</del>
earl-warren changed title from fix: remove a network created for a job that has no services to cleanup: remove a network created for a job that has no services 2025-07-21 23:39:49 +00:00
earl-warren force-pushed wip-network from f6367f08af
All checks were successful
checks / unit (pull_request) Successful in 2m40s
checks / integration (pull_request) Successful in 1m44s
/ cascade (pull_request_target) Successful in 35m5s
to 8a85d452d0
Some checks failed
checks / unit (pull_request) Successful in 2m30s
checks / integration (pull_request) Successful in 1m51s
/ cascade (pull_request_target) Failing after 28s
2025-07-21 23:43:58 +00:00
Compare
earl-warren changed title from cleanup: remove a network created for a job that has no services to chore(cleanup): delete a network scheduled for deletion even if there is no service 2025-07-21 23:44:12 +00:00
Contributor

cascading-pr updated at forgejo/runner#721

cascading-pr updated at https://code.forgejo.org/forgejo/runner/pulls/721
viceice approved these changes 2025-07-22 04:58:31 +00:00
earl-warren deleted branch wip-network 2025-07-22 06:08:32 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No milestone
No project
No assignees
3 participants
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/act!189
No description provided.