mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
Fix container volumes being reused sometimes (#283)
This commit is contained in:
parent
555cdcebbb
commit
f84aa60a04
4 changed files with 33 additions and 10 deletions
|
@ -115,7 +115,7 @@ func (rc *RunContext) startJobContainer() common.Executor {
|
|||
|
||||
return common.NewPipelineExecutor(
|
||||
rc.JobContainer.Pull(rc.Config.ForcePull),
|
||||
rc.JobContainer.Remove().IfBool(!rc.Config.ReuseContainers),
|
||||
rc.stopJobContainer(),
|
||||
rc.JobContainer.Create(),
|
||||
rc.JobContainer.Start(false),
|
||||
rc.JobContainer.CopyDir(copyToPath, rc.Config.Workdir+"/.").IfBool(copyWorkspace),
|
||||
|
@ -136,6 +136,8 @@ func (rc *RunContext) execJobContainer(cmd []string, env map[string]string) comm
|
|||
return rc.JobContainer.Exec(cmd, env)(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// stopJobContainer removes the job container (if it exists) and its volume (if it exists) if !rc.Config.ReuseContainers
|
||||
func (rc *RunContext) stopJobContainer() common.Executor {
|
||||
return func(ctx context.Context) error {
|
||||
if rc.JobContainer != nil && !rc.Config.ReuseContainers {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue