Skip to content

Commit ce89b16

Browse files
Expire long-running e2e containers in Drone CI (cortexproject#4157)
By adding the `io.drone.expires` label to all e2e containers, they will be cleaned up if they are left dangling following a failed test drone-gc cleanup code: https://github.com/drone/drone-gc/blob/3ac5240928e6f6b00d1930262d2f833e36c8dfcb/gc/util.go#L55 Signed-off-by: Julien Duchesne <julien.duchesne@grafana.com>
1 parent 3181a60 commit ce89b16

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

integration/e2e/service.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ func (s *ConcreteService) WaitReady() (err error) {
294294
func (s *ConcreteService) buildDockerRunArgs(networkName, sharedDir string) []string {
295295
args := []string{"run", "--rm", "--net=" + networkName, "--name=" + networkName + "-" + s.name, "--hostname=" + s.name}
296296

297+
// For Drone CI users, expire the container after 6 hours using drone-gc
298+
args = append(args, "--label", fmt.Sprintf("io.drone.expires=%d", time.Now().Add(6*time.Hour).Unix()))
299+
297300
// Mount the shared/ directory into the container
298301
args = append(args, "-v", fmt.Sprintf("%s:%s:z", sharedDir, ContainerSharedDir))
299302

0 commit comments

Comments
 (0)