grim/convey

Parents 6576e6a608d4
Children 837098fd33e6
Fix an issue where an expired timeout would cause the network and workspace to not be cleaned up. Fixed #137
--- a/ChangeLog Sun Jan 14 06:42:12 2018 -0600
+++ b/ChangeLog Sun Jan 14 06:51:58 2018 -0600
@@ -3,6 +3,8 @@
* Added an example for multi stage image builds. Fixed #155
* Fixed an issue where you couldn't set workdir for a docker/run task to
${CONVEY_WORKSPACE}. Fixed #135
+ * Fixed an issue where expired timeouts would cause the workspace and network
+ to not be removed. Fixed #137
0.13.0: 20180114
* Fixed an issue in docker.ParseImage where something like convey/workspace
--- a/docker/network.go Sun Jan 14 06:42:12 2018 -0600
+++ b/docker/network.go Sun Jan 14 06:51:58 2018 -0600
@@ -17,6 +17,8 @@
package docker
import (
+ "time"
+
"github.com/aphistic/gomol"
"bitbucket.org/rw_grim/convey/logging"
@@ -88,5 +90,12 @@
"Name": network.name,
}
+ // monkey with the timeout so our cleanup always runs
+ oldTimeout := network.state.PlanTimeout
+ defer func() {
+ network.state.PlanTimeout = oldTimeout
+ }()
+ network.state.PlanTimeout = 15 * time.Minute
+
return Docker("remove network", networkDestroyTemplate, params, network.state)
}
--- a/docker/workspace.go Sun Jan 14 06:42:12 2018 -0600
+++ b/docker/workspace.go Sun Jan 14 06:51:58 2018 -0600
@@ -18,6 +18,7 @@
import (
"strings"
+ "time"
"github.com/aphistic/gomol"
@@ -101,5 +102,12 @@
"Name": ws.name,
}
+ // monkey with the timeout so our cleanup always runs
+ oldTimeout := ws.state.PlanTimeout
+ defer func() {
+ ws.state.PlanTimeout = oldTimeout
+ }()
+ ws.state.PlanTimeout = 15 * time.Minute
+
return Docker("remove workspace", wsDestroyTemplate, params, ws.state)
}