Fix container volumes being reused sometimes (#283)
This commit is contained in:
@@ -83,7 +83,6 @@ func TestEvaluate(t *testing.T) {
|
||||
{"matrix.os", "Linux", ""},
|
||||
{"matrix.foo", "bar", ""},
|
||||
{"env.key", "value", ""},
|
||||
|
||||
}
|
||||
|
||||
for _, table := range tables {
|
||||
@@ -121,8 +120,8 @@ func TestInterpolate(t *testing.T) {
|
||||
},
|
||||
}
|
||||
ee := rc.NewExpressionEvaluator()
|
||||
tables := []struct{
|
||||
in string
|
||||
tables := []struct {
|
||||
in string
|
||||
out string
|
||||
}{
|
||||
{" ${{1}} to ${{2}} ", " 1 to 2 "},
|
||||
|
@@ -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 {
|
||||
|
@@ -16,8 +16,8 @@ func TestRunContext_EvalBool(t *testing.T) {
|
||||
Workdir: ".",
|
||||
},
|
||||
Env: map[string]string{
|
||||
"TRUE": "true",
|
||||
"FALSE": "false",
|
||||
"TRUE": "true",
|
||||
"FALSE": "false",
|
||||
"SOME_TEXT": "text",
|
||||
},
|
||||
Run: &model.Run{
|
||||
@@ -52,8 +52,8 @@ func TestRunContext_EvalBool(t *testing.T) {
|
||||
rc.ExprEval = rc.NewExpressionEvaluator()
|
||||
|
||||
tables := []struct {
|
||||
in string
|
||||
out bool
|
||||
in string
|
||||
out bool
|
||||
}{
|
||||
// The basic ones
|
||||
{"true", true},
|
||||
|
Reference in New Issue
Block a user