From c933ffd1c7f840886dfa59fdf3b284ba45187f05 Mon Sep 17 00:00:00 2001 From: s3lph Date: Thu, 2 Aug 2018 22:08:47 +0200 Subject: [PATCH] GitLab CI: Use CI variables instead of git ref-parse. --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2392411..9ea447d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,10 +24,10 @@ build: stage: build script: - docker build -t "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)" . - - docker tag "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)" "registry.gitlab.com/s3lph/matemat:latest-$([[ $(git symbolic-ref --short HEAD) == "master" ]] && echo stable || echo staging)" + - docker tag "registry.gitlab.com/s3lph/matemat:$CI_COMMIT_SHA" "registry.gitlab.com/s3lph/matemat:latest-$([[ $CI_COMMIT_REF_NAME == "master" ]] && echo stable || echo staging)" - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_TOKEN registry.gitlab.com - - docker push "registry.gitlab.com/s3lph/matemat:$(git rev-parse HEAD)" - - docker push registry.gitlab.com/s3lph/matemat:latest-$([[ $(git symbolic-ref --short HEAD) == "master" ]] && echo stable || echo staging) + - docker push "registry.gitlab.com/s3lph/matemat:$CI_COMMIT_SHA" + - docker push registry.gitlab.com/s3lph/matemat:latest-$([[ $CI_COMMIT_REF_NAME == "master" ]] && echo stable || echo staging) only: - staging - master @@ -37,7 +37,7 @@ staging: script: - eval $(ssh-agent -s) - ssh-add - <<<"$STAGING_SSH_PRIVATE_KEY" - - echo "$(git rev-parse HEAD)" | ssh -p 20022 -oStrictHostKeyChecking=no matemat@kernelpanic.lol + - echo "$CI_COMMIT_SHA" | ssh -p 20022 -oStrictHostKeyChecking=no matemat@kernelpanic.lol environment: name: staging url: https://matemat.kernelpanic.lol/