[commit: ghc] wip/windows-cleanup: gitlab-ci: Cleanup Windows builds (3f61f67)

git at git.haskell.org git at git.haskell.org
Sun Jan 6 04:30:21 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/windows-cleanup
Link       : http://ghc.haskell.org/trac/ghc/changeset/3f61f6794af899cf49deb524c2755c1d04b8c01f/ghc

>---------------------------------------------------------------

commit 3f61f6794af899cf49deb524c2755c1d04b8c01f
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sat Jan 5 23:28:49 2019 -0500

    gitlab-ci: Cleanup Windows builds
    
    See Note [Cleanup on Windows].


>---------------------------------------------------------------

3f61f6794af899cf49deb524c2755c1d04b8c01f
 .gitlab-ci.yml | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ab79622..1fc00b4 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
@@ -23,7 +24,6 @@ stages:
 #         x86_64-linux to ensure low-latency availability.
 #
 
-
 ############################################################
 # Linting
 ############################################################
@@ -370,6 +370,31 @@ 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
+  script:
+    - echo "Time to clean up"
+  after_script:
+    - set "BUILD_DIR=%CI_PROJECT_DIR%"
+    - set "BUILD_DIR=%BUILD_DIR:/=\%"
+    - echo "Cleaning %BUILD_DIR%"
+    - rmdir /S /Q %BUILD_DIR%
+    - exit /b 0
+
 ############################################################
 # Validation via CircleCI
 ############################################################



More information about the ghc-commits mailing list