Commit 4b5b8561 authored by David Foucher's avatar David Foucher

Add deploy in gitlab-ci

parent bee82485
......@@ -2,6 +2,24 @@
variables:
TREFLE_OLD_VERSION: "api-v0.6.1"
test:
image: python:3.6
cache:
paths:
- ~/.cache/pip/
before_script:
- python setup.py develop
- pip install -r requirements-dev.txt
stage: test
script:
- py.test -v --cov
- behave -D coverage-format=long
only:
- branches
- master
except:
- /^WIP-.*$/
api publish:
image:
name: gcr.io/kaniko-project/executor:debug
......@@ -12,6 +30,27 @@ api publish:
- /kaniko/executor --context ${CI_PROJECT_DIR}/docker --dockerfile $CI_PROJECT_DIR/docker/dockerfile_trefle --build-arg TREFLE_VERSION=$CI_COMMIT_TAG --build-arg TREFLE_GIT=${CI_PROJECT_URL} --destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
only:
- /^api-v[0-9.]+$/
- /^testing$/
deploy API to staging:
type: deploy
environment:
name: recette
url: http://trefle.beta.pole-emploi.fr
before_script:
- apt-get update -qq
- apt-get install -qq git
# Setup SSH deploy keys
- 'which ssh-agent || ( apt-get install -qq openssh-client )'
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- ssh gitlab@trefle.beta.pole-emploi.fr "cd /home/docker && VERSION=${CI_COMMIT_TAG} /bin/bash update.sh trefle && echo \"VERSION=${CI_COMMIT_TAG}\" >> update.log"
only:
- /^api-v[0-9.]+$/
- /^testing$/
backoffice publish:
image:
......@@ -20,24 +59,6 @@ backoffice publish:
stage: build
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${CI_PROJECT_DIR}/docker --dockerfile ${CI_PROJECT_DIR}/docker/dockerfile_backoffice --build-arg TREFLE_BACK_VERSION=${CI_COMMIT_TAG} --build-arg TREFLE_OLD_VERSION=${TREFLE_OLD_VERSION} --build-arg TREFLE_GIT=${CI_PROJECT_URL} --destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
- /kaniko/executor --context ${CI_PROJECT_DIR}/docker --dockerfile ${CI_PROJECT_DIR}/docker/dockerfile_web --build-arg TREFLE_BACK_VERSION=${CI_COMMIT_TAG} --build-arg TREFLE_OLD_VERSION=${TREFLE_OLD_VERSION} --build-arg TREFLE_GIT=${CI_PROJECT_URL} --destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
only:
- /^backoffice-v[0-9.]+$/
test:
image: python:3.6
cache:
paths:
- ~/.cache/pip/
before_script:
- python setup.py develop
- pip install -r requirements-dev.txt
stage: test
script:
- py.test -v --cov
- behave -D coverage-format=long
only:
- branches
- master
except:
- /^WIP-.*$/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment