Skip to content
Snippets Groups Projects
Commit a6777e6f authored by ale's avatar ale
Browse files

Split turnup/provisioning into separate tasks

Hopefully this way Gitlab will understand that the environment is up
even when "float run" fails.
parent e25a1974
Branches
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@
stages:
- deploy
- run
- cleanup
# These are all configurable, globally and per-build.
......@@ -43,7 +44,9 @@ variables:
variables:
# Internal, do not change.
DEPLOY_ENV_FILE: "deploy-${VM_TAG}.env"
BUILD_DIR: "$CI_PROJECT_DIR/build-$CI_JOB_ID"
# This can be any temporary directory as long as it is unique
# (multiple jobs may be running off the same CI_PROJECT_DIR).
BUILD_DIR: "${CI_PROJECT_DIR}/env-${VM_TAG}-${CI_JOB_ID}"
VMINE_STATE_FILE: ".vmine_state_${CI_MERGE_REQUEST_ID}_${VM_TAG}"
before_script:
- mkdir -p $BUILD_DIR
......@@ -69,22 +72,33 @@ variables:
${BUILD_DIR}
- with-ssh-key floatup $FLOATUP_ARGS --inventory $BUILD_DIR/hosts.yml --ram $VM_RAM --cpu $VM_CPU --image $VM_IMAGE --state-file $VMINE_STATE_FILE --env $DEPLOY_ENV_FILE --ttl $VM_TTL --dashboard-url $VM_DASHBOARD_URL up
- with-ssh-key $BUILD_DIR/float/test-driver init --no-vagrant $BUILD_DIR
- with-ssh-key $BUILD_DIR/float/test-driver run $BUILD_DIR
after_script:
- with-ssh-key $BUILD_DIR/float/test-driver cleanup --no-vagrant $BUILD_DIR
- echo BUILD_DIR=$BUILD_DIR >> $DEPLOY_ENV_FILE
allow_failure: true
artifacts:
when: always
expire_in: "1 day"
reports:
dotenv: "$DEPLOY_ENV_FILE"
paths:
- "${BUILD_DIR}/logs"
- "${BUILD_DIR}"
- "$VMINE_STATE_FILE"
environment:
name: "review/$CI_COMMIT_REF_SLUG"
url: "$VMINE_GROUP_URL"
auto_stop_in: "3 hours"
.run_template:
stage: run
image: registry.git.autistici.org/ai3/docker/float-runner:master
script:
- with-ssh-key $BUILD_DIR/float/test-driver run $BUILD_DIR
after_script:
- with-ssh-key $BUILD_DIR/float/test-driver cleanup --no-vagrant $BUILD_DIR
artifacts:
when: always
paths:
- "${BUILD_DIR}/logs"
.stop_deploy_template:
stage: cleanup
image: registry.git.autistici.org/ai3/docker/float-runner:master
......@@ -103,6 +117,9 @@ deploy:
environment:
on_stop: "stop_deploy"
run:
extends: .run_template
stop_deploy:
extends: .stop_deploy_template
rules:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment