Update .gitlab-ci.yml file

This commit is contained in:
Aaron Riedel 2022-03-09 07:16:27 +00:00
parent 6c7aeafecf
commit 46e75415d4

View file

@ -24,6 +24,7 @@ docker-build-push:
fi fi
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- docker push "$CI_REGISTRY_IMAGE${tag}" - docker push "$CI_REGISTRY_IMAGE${tag}"
allow_failure: false
only: only:
- master - master
- dev - dev
@ -37,6 +38,7 @@ docker-build:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" . - docker build --pull -t "$CI_REGISTRY_IMAGE" .
allow_failure: false
except: except:
- master - master
- dev - dev
@ -47,17 +49,19 @@ container_scanning:
variables: variables:
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE${tag}" DOCKER_IMAGE: "$CI_REGISTRY_IMAGE${tag}"
stage: test stage: test
allow_failure: false
deploy_staging: deploy_staging:
stage: deploy stage: deploy
image: debian image: debian
script: before_script:
- apt-get update -qq - apt-get update -qq
- 'which ssh-agent || ( apt-get install -qq openssh-client )' - 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY") - ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh - mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh $SSH_SERVER "cd /root && docker-compose pull shbot && docker-compose up -d shbot && exit" - ssh $SSH_SERVER "cd /root && docker-compose pull shbot && docker-compose up -d shbot && exit"
only: only:
- master - master