From b5e904c835152d695ceb45cf3cfd5af837a8b872 Mon Sep 17 00:00:00 2001 From: Cat Flynn Date: Mon, 1 Feb 2021 14:06:31 +0000 Subject: [PATCH] add cleanup job to clear build directory --- .gitlab-ci.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4f20406..8289f1e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,6 @@ stages: - build +- cleanup-build - deploy variables: @@ -15,18 +16,29 @@ variables: build: stage: build variables: - # instance - GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_NAME-$CI_JOB_ID + # instance the build job to avoid multiple jobs running in the same project folder + GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_NAME-build-$CI_PIPELINE_ID script: - echo "cloned to $GIT_CLONE_PATH" - chmod +x ./ci/build.sh - ./ci/build.sh $UNITY_VERSION - after_script: - - rm -r $GIT_CLONE_PATH + artifacts: name: $CI_PROJECT_NAME-$CI_PIPELINE_ID paths: - $BUILD_DIR + +# remove the directory created by the build job. in a separate job +cleanup-build: + stage: cleanup-build + variables: + CLEANUP_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_NAME-build-$CI_PIPELINE_ID + script: + - echo "cleaning up build directory" + - rm -r $CLEANUP_PATH + dependencies: + - build + # deploy to internal testing track deploy-dev: