add cleanup job to clear build directory

This commit is contained in:
Cat Flynn 2021-02-01 14:06:31 +00:00
parent bad0b70319
commit b5e904c835
1 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,6 @@
stages: stages:
- build - build
- cleanup-build
- deploy - deploy
variables: variables:
@ -15,18 +16,29 @@ variables:
build: build:
stage: build stage: build
variables: variables:
# instance # 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-$CI_JOB_ID GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_NAME-build-$CI_PIPELINE_ID
script: script:
- echo "cloned to $GIT_CLONE_PATH" - echo "cloned to $GIT_CLONE_PATH"
- chmod +x ./ci/build.sh - chmod +x ./ci/build.sh
- ./ci/build.sh $UNITY_VERSION - ./ci/build.sh $UNITY_VERSION
after_script:
- rm -r $GIT_CLONE_PATH
artifacts: artifacts:
name: $CI_PROJECT_NAME-$CI_PIPELINE_ID name: $CI_PROJECT_NAME-$CI_PIPELINE_ID
paths: paths:
- $BUILD_DIR - $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 to internal testing track
deploy-dev: deploy-dev: