Commit d29a6874 authored by Andreas Böttger's avatar Andreas Böttger 😬

Update .gitlab-ci.yml

[skip-ci]
parent 2764d2c3
Pipeline #14608 failed with stage
in 32 seconds
variables:
REVIEW_IMAGE: docker.rz.tu-harburg.de:5000/docker/jekyll:latest
DOCKER_CONTAINER_NAME: ${CI_PROJECT_PATH_SLUG}-${CI_ENVIRONMENT_SLUG}
REVIEW_IMAGE: docker.rz.tu-harburg.de:5000/docker/nginx--review-apps:latest
BUILD_IMAGE: docker.rz.tu-harburg.de:5000/docker/jekyll-hoou-glr:latest
before_script:
- sudo docker pull ${BUILD_IMAGE}
- sudo docker pull ${REVIEW_IMAGE}
stages:
- review
......@@ -8,14 +12,14 @@ stages:
review:start:
stage: review
retry: 2
script:
- pwd
- whoami
- sudo docker pull ${REVIEW_IMAGE}
- sudo docker run --detach --rm --env VIRTUAL_HOST=${CI_ENVIRONMENT_SLUG} --name ${DOCKER_CONTAINER_NAME} ${REVIEW_IMAGE} || true
- sudo docker cp . ${DOCKER_CONTAINER_NAME}:/opt/app
- sudo docker exec ${DOCKER_CONTAINER_NAME} bundle install --gemfile=/opt/app/Gemfile
#when: manual
- sudo docker run --rm -v $(pwd):/source ${BUILD_IMAGE} install
- sudo docker run --rm -v $(pwd):/source ${BUILD_IMAGE} build
- sudo docker cp ./_book/. ${DOCKER_CONTAINER_NAME}:/usr/share/nginx/html
- if [ ! -z "${REVIEW_CREDENTIALS}" ]; then mkdir -p ./nginx && echo "${REVIEW_CREDENTIALS}" > ./nginx/credentials && sudo docker cp ./nginx/credentials ${DOCKER_CONTAINER_NAME}:/etc/nginx/htpasswd/credentials; rm -f ./nginx/credentials; fi
environment:
name: review/${CI_COMMIT_REF_NAME}
url: http://${CI_ENVIRONMENT_SLUG}.collaborating.tuhh.de
......@@ -57,11 +61,10 @@ deploy:
when: manual
script:
- pwd
- sudo docker pull docker.rz.tu-harburg.de:5000/docker/jekyll-glr:latest
# `_layouts/home.html` kann datumsabhängig mit einer Datei aus `backlogs` überschrieben werden
- find backlog -regextype egrep -regex "backlog/[0-9]{8,8}_.*" | sort | awk -F'/|_' -v date=$(date +%Y%m%d) '{if ($2 <= date) {print("cp backlog/"$2"_home.html _layouts/home.html"); system("cp backlog/"$2"_home.html _layouts/home.html")}}'
- sudo docker run --rm -v $(pwd):/source docker.rz.tu-harburg.de:5000/docker/jekyll-glr:latest install
- sudo docker run --rm -v $(pwd):/source docker.rz.tu-harburg.de:5000/docker/jekyll-glr:latest build
- sudo docker run --rm -v $(pwd):/source ${BUILD_IMAGE} install
- sudo docker run --rm -v $(pwd):/source ${BUILD_IMAGE} build
- sshpass -p "$SSH_PASSWD" ssh -p "$SSH_PORT" $SSH_USER@$HOST_NAME "mkdir -p /usr/share/nginx/html/production"
- sshpass -p "$SSH_PASSWD" scp -P "$SSH_PORT" -r _site/* $SSH_USER@$HOST_NAME:/usr/share/nginx/html/production
environment:
......@@ -77,11 +80,10 @@ deploy:on-schedule:
- production
script:
- pwd
- sudo docker pull docker.rz.tu-harburg.de:5000/docker/jekyll-glr:latest
# `_layouts/home.html` kann datumsabhängig mit einer Datei aus `backlogs` überschrieben werden
- find backlog -regextype egrep -regex "backlog/[0-9]{8,8}_.*" | sort | awk -F'/|_' -v date=$(date +%Y%m%d) '{if ($2 <= date) {print("cp backlog/"$2"_home.html _layouts/home.html"); system("cp backlog/"$2"_home.html _layouts/home.html")}}'
- sudo docker run --rm -v $(pwd):/source docker.rz.tu-harburg.de:5000/docker/jekyll-glr:latest install
- sudo docker run --rm -v $(pwd):/source docker.rz.tu-harburg.de:5000/docker/jekyll-glr:latest build
- sudo docker run --rm -v $(pwd):/source ${BUILD_IMAGE} install
- sudo docker run --rm -v $(pwd):/source ${BUILD_IMAGE} build
- sshpass -p "$SSH_PASSWD" ssh -p "$SSH_PORT" $SSH_USER@$HOST_NAME "mkdir -p /usr/share/nginx/html/production"
- sshpass -p "$SSH_PASSWD" scp -P "$SSH_PORT" -r _site/* $SSH_USER@$HOST_NAME:/usr/share/nginx/html/production
environment:
......
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