summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-01-05 23:28:49 -0500
committerBen Gamari <ben@well-typed.com>2019-01-14 09:30:40 -0500
commit69947d58c29cc0b047cc34fb4873e12f47e9674c (patch)
treee916e234abfa74a01eff38de832e654c9182634d
parent2f07a97ce9cbdb17e511897d514a6cffb678a843 (diff)
downloadhaskell-69947d58c29cc0b047cc34fb4873e12f47e9674c.tar.gz
gitlab-ci: Cleanup Windows builds
See Note [Cleanup on Windows].
-rw-r--r--.gitlab-ci.yml30
1 files changed, 30 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 67b28305f0..162c19ccb6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,6 +11,7 @@ stages:
- lint
- build
- full-build
+ - cleanup # See Note [Cleanup on Windows]
############################################################
# Runner Tags
@@ -368,6 +369,35 @@ validate-x86_64-windows:
tags:
- x86_64-windows
+# Note [Cleanup on Windows]
+# ~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# As noted in [1], gitlab-runner's shell executor doesn't clean up its working
+# directory after builds. Unfortunately, we are forced to use the shell executor
+# on Windows. To avoid running out of disk space we add a stage at the end of
+# the build to remove the \GitLabRunner\builds directory. Since we only run a
+# single build at a time on Windows this should be safe.
+#
+# [1] https://gitlab.com/gitlab-org/gitlab-runner/issues/3856
+
+# See Note [Cleanup on Windows]
+cleanup-windows:
+ stage: cleanup
+ tags:
+ - x86_64-windows
+ when: always
+ before_script:
+ - echo "Time to clean up"
+ script:
+ - echo "Let's go"
+ after_script:
+ - set "BUILD_DIR=%CI_PROJECT_DIR%"
+ - set "BUILD_DIR=%BUILD_DIR:/=\%"
+ - echo "Cleaning %BUILD_DIR%"
+ - cd \GitLabRunner
+ - rmdir /S /Q %BUILD_DIR%/*
+ - exit /b 0
+
############################################################
# Validation via CircleCI
############################################################