[commit: ghc] wip/T16185: gitlab-ci: Cleanup Windows builds (69947d5)

git at git.haskell.org git at git.haskell.org
Tue Jan 15 17:43:22 UTC 2019


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

On branch  : wip/T16185
Link       : http://ghc.haskell.org/trac/ghc/changeset/69947d58c29cc0b047cc34fb4873e12f47e9674c/ghc

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

commit 69947d58c29cc0b047cc34fb4873e12f47e9674c
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].


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

69947d58c29cc0b047cc34fb4873e12f47e9674c
 .gitlab-ci.yml | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 67b2830..162c19c 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
 ############################################################



More information about the ghc-commits mailing list