Commit 03134f7e authored by Nicolas Schmid's avatar Nicolas Schmid
Browse files

devops: remove comments and testing environment

parent 8abb53ec
Pipeline #2354 failed with stages
in 1 minute and 21 seconds
......@@ -13,8 +13,7 @@ stages:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME != "develop"'
when: always
.add-ssh:
&add-ssh ## Install ssh-agent if not already installed.
.add-ssh: &add-ssh ## Install ssh-agent if not already installed.
- "command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )"
## Run ssh-agent
- eval $(ssh-agent -s)
......@@ -36,7 +35,6 @@ flake8-job:
py38-test-job:
stage: test
environment: testing
extends: .test-rules
needs: ["flake8-job"]
image: python:3.8
......@@ -63,53 +61,52 @@ py38-test-job:
cobertura: coverage.xml
variables:
TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
DOCKER_TLS_CERTDIR: ""
TAG_LATEST: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:latest
TAG_COMMIT: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHORT_SHA
DOCKER_TLS_CERTDIR: ""
publish:
only:
- master
tags:
- deployment
needs: ["py38-test-job"]
image: docker:19.03.12
stage: publish
services:
- name: docker:19.03.12-dind
command:
- /bin/sh
- -c
- |
echo "$CI_SERVER_TLS_CA_FILE" > /etc/ssl/certs/ca-cert-gitlab.seismo.ethz.ch.crt || exit
dockerd-entrypoint.sh || exit
script:
- docker build -t $TAG_COMMIT -t $TAG_LATEST .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push $TAG_COMMIT
- docker push $TAG_LATEST
only:
- master
tags:
- deployment
needs: ["py38-test-job"]
image: docker:19.03.12
stage: publish
services:
- name: docker:19.03.12-dind
command:
- /bin/sh
- -c
- |
echo "$CI_SERVER_TLS_CA_FILE" > /etc/ssl/certs/ca-cert-gitlab.seismo.ethz.ch.crt || exit
dockerd-entrypoint.sh || exit
script:
- docker build -t $TAG_COMMIT -t $TAG_LATEST .
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker push $TAG_COMMIT
- docker push $TAG_LATEST
deploy:
only:
- master
needs: ["publish"]
environment:
name: ramsis
image: alpine:latest
stage: deploy
tags:
- deployment
script:
- sed -i '$a\' $ENV && echo "TAG_COMMIT=$TAG_COMMIT" >> $ENV
- chmod og= $SERVER_RSA
- apk update && apk add openssh-client
- ssh -i $SERVER_RSA -o StrictHostKeyChecking=no $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY"
- ssh -i $SERVER_RSA -o StrictHostKeyChecking=no $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch "docker pull $TAG_COMMIT"
only:
- master
needs: ["publish"]
environment:
name: ramsis
image: alpine:latest
stage: deploy
tags:
- deployment
script:
- sed -i '$a\' $ENV && echo "TAG_COMMIT=$TAG_COMMIT" >> $ENV
- chmod og= $SERVER_RSA
- apk update && apk add openssh-client
- scp -i $SERVER_RSA -o StrictHostKeyChecking=no $ENV $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch:~/.env
- scp -i $SERVER_RSA -o StrictHostKeyChecking=no docker-compose.yml $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch:~/docker-compose.yml
- ssh -i $SERVER_RSA -o StrictHostKeyChecking=no $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch "docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY"
- ssh -i $SERVER_RSA -o StrictHostKeyChecking=no $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch "docker pull $TAG_COMMIT"
- ssh -i $SERVER_RSA -o StrictHostKeyChecking=no $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch "docker compose down"
- ssh -i $SERVER_RSA -o StrictHostKeyChecking=no $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch "docker compose up -d"
- scp -i $SERVER_RSA -o StrictHostKeyChecking=no $ENV $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch:~/.env
- scp -i $SERVER_RSA -o StrictHostKeyChecking=no docker-compose.yml $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch:~/docker-compose.yml
- ssh -i $SERVER_RSA -o StrictHostKeyChecking=no $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch "docker compose down"
- ssh -i $SERVER_RSA -o StrictHostKeyChecking=no $SERVER_USER@$CI_ENVIRONMENT_NAME.ethz.ch "docker compose up -d"
......@@ -2,9 +2,6 @@ version: "3.8"
services:
web:
image: ${TAG_COMMIT}
# build:
# context: "."
# target: "app"
env_file:
- ".env"
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
......
Supports Markdown
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