Skip to content
Snippets Groups Projects
Commit 8d3cf6ba authored by Christian Boettcher's avatar Christian Boettcher
Browse files

Merge branch 'mptest' into 'master'

Merge CI/CD settings and get current progress on docker-compose

See merge request rybicki1/datacatalog!2
parents f301702f 42a24484
Branches
Tags
1 merge request!2Merge CI/CD settings and get current progress on docker-compose
Pipeline #71866 passed
default: default:
image: python:3-slim image: python:3-slim
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
APP_VERSION: "beta"
stages: stages:
- test - test
- build
- publish - publish
- deploy - deploy
test: test:
stage: test stage: test
script: script:
- pip install -r testing_requirements.txt - pip install -r testing_requirements.txt
- nosetests --with-coverage --cover-package=apiserver --cover-xml - nosetests --with-coverage --cover-package=apiserver
artifacts: artifacts:
reports: reports:
cobertura: coverage.xml cobertura: coverage.xml
build:sites:
cache: {}
stage: build
script:
- pip install -r requirements.txt
- python frontend/createStatic.py
- echo "static web content has been created"
artifacts:
paths:
- site
pages:
stage: deploy
image: alpine:latest
dependencies:
- build:sites
script:
- mkdir public
- cp -r site/* public/
- echo "Deployment finished. Missing API server"
artifacts:
paths:
- public
deploy: deploy:
stage: deploy stage: deploy
variables: variables:
...@@ -24,7 +55,17 @@ deploy: ...@@ -24,7 +55,17 @@ deploy:
OS_INTERFACE: public OS_INTERFACE: public
script: script:
- echo "Doing nothing for now" - echo "Doing nothing for now"
- pip install python-openstackclient
- openstack image list
# - openstack server create --flavor s1 --image 149a65b5-aeb8-499f-aaa6-ec966bd28dd6 pipeline-inst
# - reassign floating ip
# - login on the new instance pipeline-inst
# - sudo docker network create net #net is the docker internal network.. put it in a Variable?
# - sudo docker-compose up -d
# - docker build --no-cache=true --pull -f ./apiserver/Dockerfile -t api-test . #pull from $CI_REGISTRY
# - sudo docker run --name api-test-cloud --network net -e VIRTUAL_HOST="zam10028.zam.kfa-juelich.de" -e LETSENCRYPT_HOST="zam10028.zam.kfa-juelich.de" -d api-test
# - openstack server destroy pipeline-inst #old
publishgit-do: publishgit-do:
image: python:3-slim image: python:3-slim
stage: publish stage: publish
...@@ -32,10 +73,44 @@ publishgit-do: ...@@ -32,10 +73,44 @@ publishgit-do:
- tags - tags
tags: [stable] tags: [stable]
script: script:
- apt-get update - apt-get update
- apt-get install -y git - apt-get install -y git
- git remote set-url gith "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/eflows4hpc/datacatalog.git" - git remote set-url gith "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/eflows4hpc/datacatalog.git"
- git remote -v - git remote -v
- git show-ref - git show-ref
- git push gith $CI_COMMIT_REF_NAME - git push gith $CI_COMMIT_REF_NAME
# This is an automatic push of the docker image into gitLab container repository
transfer_image:
stage: build
image: docker:19.03.12
services:
- docker:19.03.12-dind
variables:
IMAGE_COMMIT_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --no-cache=true --pull -f ./apiserver/Dockerfile -t $IMAGE_COMMIT_TAG .
- docker push $IMAGE_COMMIT_TAG
tag_release:
stage: publish
needs: ["transfer_image"]
image: docker:19.03.12
services:
- docker:19.03.12-dind
variables:
IMAGE_LATEST_TAG: $CI_REGISTRY_IMAGE:latest
IMAGE_STABLE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
IMAGE_COMMIT_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
only:
- tags
tags: [stable]
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker pull $IMAGE_COMMIT_TAG
- docker tag $IMAGE_COMMIT_TAG $IMAGE_STABLE_TAG
- docker tag $IMAGE_COMMIT_TAG $IMAGE_LATEST_TAG
- docker push $IMAGE_STABLE_TAG
- docker push $IMAGE_LATEST_TAG
version: "3.7"
services:
reverse-proxy:
image: "jwilder/nginx-proxy:latest"
container_name: "reverse-proxy"
volumes:
- "html:/usr/share/nginx/html"
- "dhparam:/etc/nginx/dhparam"
- "vhost:/etc/nginx/vhost.d"
- "certs:/etc/nginx/certs"
- "/run/docker.sock:/tmp/docker.sock:ro"
restart: "always"
networks:
- "net"
ports:
- "80:80"
- "443:443"
letsencrypt:
image: "jrcs/letsencrypt-nginx-proxy-companion:latest"
container_name: "letsencrypt-helper"
volumes:
- "html:/usr/share/nginx/html"
- "dhparam:/etc/nginx/dhparam"
- "vhost:/etc/nginx/vhost.d"
- "certs:/etc/nginx/certs"
- "/run/docker.sock:/var/run/docker.sock:ro"
environment:
NGINX_PROXY_CONTAINER: "reverse-proxy"
DEFAULT_EMAIL: "m.petrova@fz-juelich.de"
restart: "always"
depends_on:
- "reverse-proxy"
networks:
- "net"
volumes:
certs:
html:
vhost:
dhparam:
networks:
net:
external: true
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment