From 1ea81518a48024fad7d742fda7661eadd26f1f13 Mon Sep 17 00:00:00 2001 From: Varac <varac@varac.net> Date: Thu, 7 Mar 2019 12:56:34 +0100 Subject: [PATCH] Use CI_PIPELINE_IID instead of CI_JOB_ID for droplet name --- .gitlab-ci.yml | 4 ++-- test/ci-bootstrap.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 41f08589a..4e584ae9f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,7 +52,7 @@ bootstrap: - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null - ANSIBLE_HOST_KEY_CHECKING=False python3 -u ./ci-bootstrap.py --create_droplet # Wait for proper LE cert to get served - - timeout -t 1200 sh -c 'while ! curl --cacert ./letsencrypt_staging_bundle.pem -s https://auth.ci-${CI_JOB_ID}.ci.openappstack.net/auth/ > /dev/null; do date; echo "Waiting for LE cert..."; sleep 5; done' + - timeout -t 1200 sh -c 'while ! curl --cacert ./letsencrypt_staging_bundle.pem -s https://auth.ci-${CI_PIPELINE_IID}.ci.openappstack.net/auth/ > /dev/null; do date; echo "Waiting for LE cert..."; sleep 5; done' cache: key: "$CI_PIPELINE_ID" paths: @@ -105,4 +105,4 @@ terminate: script: # Remove droplet after successful tests - cd test/ - - python3 -c "import cosmos; cosmos.terminate_droplets_by_name(\"^ci-${CI_JOB_ID}\$\")" + - python3 -c "import cosmos; cosmos.terminate_droplets_by_name(\"^ci-${CI_PIPELINE_IID}\$\")" diff --git a/test/ci-bootstrap.py b/test/ci-bootstrap.py index f58099421..bc05a2cea 100755 --- a/test/ci-bootstrap.py +++ b/test/ci-bootstrap.py @@ -116,11 +116,11 @@ if __name__ == "__main__": # - 411: ci, ed25519 # - 407: varac - if "CI_JOB_ID" in os.environ: - instance_id = os.environ['CI_JOB_ID'] + if "CI_PIPELINE_IID" in os.environ: + instance_id = os.environ['CI_PIPELINE_IID'] else: # Use random generated ID in case we're not running in gitlab CI - # and there's no CI_JOB_ID env var + # and there's no CI_PIPELINE_IID env var instance_id = ''.join( random.choice(string.ascii_lowercase + string.digits) for _ in range(10)) -- GitLab