Remove the network when there is no service (#103)
Reviewed-on: https://gitea.com/gitea/act/pulls/103 Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: Zettat123 <zettat123@gmail.com> Co-committed-by: Zettat123 <zettat123@gmail.com>
This commit is contained in:
@@ -382,15 +382,15 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
|||||||
if err := rc.stopServiceContainers()(ctx); err != nil {
|
if err := rc.stopServiceContainers()(ctx); err != nil {
|
||||||
logger.Errorf("Error while cleaning services: %v", err)
|
logger.Errorf("Error while cleaning services: %v", err)
|
||||||
}
|
}
|
||||||
if createAndDeleteNetwork {
|
}
|
||||||
// clean network if it has been created by act
|
if createAndDeleteNetwork {
|
||||||
// if using service containers
|
// clean network if it has been created by act
|
||||||
// it means that the network to which containers are connecting is created by `act_runner`,
|
// if using service containers
|
||||||
// so, we should remove the network at last.
|
// it means that the network to which containers are connecting is created by `act_runner`,
|
||||||
logger.Infof("Cleaning up network for job %s, and network name is: %s", rc.JobName, networkName)
|
// so, we should remove the network at last.
|
||||||
if err := container.NewDockerNetworkRemoveExecutor(networkName)(ctx); err != nil {
|
logger.Infof("Cleaning up network for job %s, and network name is: %s", rc.JobName, networkName)
|
||||||
logger.Errorf("Error while cleaning network: %v", err)
|
if err := container.NewDockerNetworkRemoveExecutor(networkName)(ctx); err != nil {
|
||||||
}
|
logger.Errorf("Error while cleaning network: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user