Commit 827cd35d authored by TUHH GitLab Administrator (Andreas Böttger)'s avatar TUHH GitLab Administrator (Andreas Böttger)
Browse files

Update .gitlab-ci.yml

parent 3e80304a
Pipeline #76340 failed with stages
in 6 seconds
variables:
COLON: ':'
image: docker.rz.tu-harburg.de:5000/docker/gitbook:node
stages:
- setup
- test
- build
- review
- deploy
- clean
- linkchecker
#pdfs:
# stage: build
# only:
# - branches
# tags:
# - development
# script:
# - pwd
# - sudo docker pull docker.rz.tu-harburg.de:5000/docker/pandoc4gitbook-glr:latest
# - sudo docker run --rm -v $(pwd):/source docker.rz.tu-harburg.de:5000/docker/pandoc4gitbook-glr
# - sudo docker pull docker.rz.tu-harburg.de:5000/docker/pandoc-glr:latest
# - mkdir -p book_pdf; sudo docker run --rm -v $(pwd):/source docker.rz.tu-harburg.de:5000/docker/pandoc-glr .pandoc-config.yml book.md -o book_pdf/pandocbook.pdf
# artifacts:
# name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
# paths:
# # Was hier nicht gelistet ist, landet auch nicht in der `review`-Phase
# - book_pdf
before_script:
# https://docs.gitlab.com/ee/ci/ssh_keys/README.html
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
static_sites:
stage: build
only:
- branches
tags:
- development
script:
- pwd
- sudo docker pull docker.rz.tu-harburg.de:5000/docker/gitbook-glr:latest
- sudo docker run --rm -v $(pwd):/source docker.rz.tu-harburg.de:5000/docker/gitbook-glr install
- sudo docker run --rm -v $(pwd):/source docker.rz.tu-harburg.de:5000/docker/gitbook-glr build
- mkdir -p book_pdf; sudo docker run --rm -v $(pwd):/source docker.rz.tu-harburg.de:5000/docker/gitbook-glr pdf ./ ./book_pdf/book.pdf
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
setup:
stage: setup
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
# Was hier nicht gelistet ist, landet auch nicht in der `review`-Phase
- _book
- book_pdf
- node_modules
script:
- gitbook install
start_review:
stage: review
script:
- sshpass -p "$SSH_PASSWD" ssh -p "$SSH_PORT" $SSH_USER@$HOST_NAME "mkdir -p /usr/share/nginx/html/review/$CI_COMMIT_REF_NAME"
- sshpass -p "$SSH_PASSWD" scp -P "$SSH_PORT" -r _book/* $SSH_USER@$HOST_NAME:/usr/share/nginx/html/review/$CI_COMMIT_REF_NAME
- sshpass -p "$SSH_PASSWD" scp -P "$SSH_PORT" -r book_pdf $SSH_USER@$HOST_NAME:/usr/share/nginx/html/review/${CI_COMMIT_REF_NAME}
environment:
name: review/$CI_COMMIT_REF_NAME
url: http://$HOST_NAME$COLON$HTTP_PORT/review/$CI_COMMIT_REF_NAME/
#url: https://$PROXY_HOST_NAME/reviews/$BASE_PATH/$CI_COMMIT_REF_NAME/
#url: https://$PROXY_HOST_NAME/reviews/$CI_PROJECT_PATH/$CI_COMMIT_REF_NAME/
on_stop: stop_review
only:
- branches
tags:
- development
except:
- master
test:
stage: test
script:
#- if [ -f book.json ]; then jq -r --arg base_path "/${CI_PROJECT_PATH}/~${CI_COMMIT_REF_NAME}/" '.base_path |= $base_path' book.json | sponge book.json; fi
#- if [ -f book.json ]; then jq -r --arg pluginsConfig__downloadpdf_base "/${CI_PROJECT_PATH}/~${CI_COMMIT_REF_NAME}/book_pdf/book.pdf?/" '.pluginsConfig.downloadpdf.base |= $pluginsConfig__downloadpdf_base' book.json | sponge book.json; fi
#- if [ -f book.json ]; then cat book.json; fi
stop_review:
stage: review
variables:
GIT_STRATEGY: none
script:
- sshpass -p "$SSH_PASSWD" ssh -p "$SSH_PORT" $SSH_USER@$HOST_NAME "rm -rf /usr/share/nginx/html/review/$CI_COMMIT_REF_NAME"
when: manual
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
only:
- branches
tags:
- development
except:
- master
#- if [ -f book.json ]; then jq -r --arg base_path "/${CI_PROJECT_PATH}/" '.base_path |= $base_path' book.json | sponge book.json; fi
#- if [ -f book.json ]; then jq -r --arg pluginsConfig__downloadpdf_base "/${CI_PROJECT_PATH}/book_pdf/book.pdf?/" '.pluginsConfig.downloadpdf.base |= $pluginsConfig__downloadpdf_base' book.json | sponge book.json; fi
#- if [ -f book.json ]; then cat book.json; fi
- exit 0
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- node_modules
policy: pull
except:
- master
pdf:
stage: build
script:
- gitbook install
- mkdir -p book_pdf
- gitbook pdf ./ ./book_pdf/book.pdf
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- node_modules
- book_pdf
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
paths:
- book_pdf
pages:branches:
stage: build
script:
- if [ -f book.json ]; then jq -r --arg base_path "${REVIEW_BASE_DIR}~${CI_COMMIT_REF_NAME}/" '.base_path |= $base_path' book.json | sponge book.json; fi
- if [ -f book.json ]; then jq -r --arg pluginsConfig__downloadpdf_base "${REVIEW_BASE_DIR}~${CI_COMMIT_REF_NAME}/book_pdf/book.pdf?/" '.pluginsConfig.downloadpdf.base |= $pluginsConfig__downloadpdf_base' book.json | sponge book.json; fi
- 'if [ -f book.json ]; then cat book.json; fi'
- gitbook install
- gitbook build
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- node_modules
- _book
artifacts:
paths:
- _book
except:
- master
pages:master:
stage: build
script:
- if [ -f book.json ]; then jq -r --arg base_path "${BASE_DIR}" '.base_path |= $base_path' book.json | sponge book.json; fi
- if [ -f book.json ]; then jq -r --arg pluginsConfig__downloadpdf_base "${BASE_DIR}book_pdf/book.pdf?/" '.pluginsConfig.downloadpdf.base |= $pluginsConfig__downloadpdf_base' book.json | sponge book.json; fi
- 'if [ -f book.json ]; then cat book.json; fi'
- gitbook install
- gitbook build
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- node_modules
- _book
artifacts:
paths:
- _book
only:
- master
review:start:
stage: review
script:
- echo "$REVIEW_SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- echo "$REVIEW_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- ssh -p "${REVIEW_SSH_PORT}" "${REVIEW_SSH_USER}"@"${REVIEW_HOST_NAME}" "mkdir -p /usr/share/nginx/html/~${CI_COMMIT_REF_NAME}"
- scp -P "${REVIEW_SSH_PORT}" -r _book/* "${REVIEW_SSH_USER}"@"${REVIEW_HOST_NAME}":"/usr/share/nginx/html/~${CI_COMMIT_REF_NAME}"
- if [ -d book_pdf ]; then ssh -p "${REVIEW_SSH_PORT}" "${REVIEW_SSH_USER}"@"${REVIEW_HOST_NAME}" "mkdir -p /usr/share/nginx/html/~${CI_COMMIT_REF_NAME}/book_pdf"; fi
- if [ -d book_pdf ]; then scp -P "${REVIEW_SSH_PORT}" -r book_pdf/* "${REVIEW_SSH_USER}"@"${REVIEW_HOST_NAME}":"/usr/share/nginx/html/~${CI_COMMIT_REF_NAME}/book_pdf"; fi
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- _book
- book_pdf
policy: pull
except:
- master
environment:
name: $CI_COMMIT_REF_NAME
url: https://${REVIEW_PROXY_HOST_NAME}${REVIEW_BASE_DIR}~${CI_COMMIT_REF_NAME}/
on_stop: review:stop
review:stop:
stage: review
script:
- echo "$REVIEW_SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- echo "$REVIEW_SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- ssh -p "${REVIEW_SSH_PORT}" "${REVIEW_SSH_USER}"@"${REVIEW_HOST_NAME}" "rm -rf /usr/share/nginx/html/~${CI_COMMIT_REF_NAME}"
when: manual
except:
- master
environment:
name: $CI_COMMIT_REF_NAME
action: stop
deploy:
stage: deploy
only:
- master
tags:
- production
except:
- schedules
script:
- pwd
- 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 _book/* $SSH_USER@$HOST_NAME:/usr/share/nginx/html/production
- sshpass -p "$SSH_PASSWD" scp -P "$SSH_PORT" -r book_pdf $SSH_USER@$HOST_NAME:/usr/share/nginx/html/production
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- ssh -p "${SSH_PORT}" "${SSH_USER}"@"${HOST_NAME}" "mkdir -p /usr/share/nginx/html"
- scp -P "${SSH_PORT}" -r _book/* "${SSH_USER}"@"${HOST_NAME}":"/usr/share/nginx/html"
- if [ -d book_pdf ]; then ssh -p "${SSH_PORT}" "${SSH_USER}"@"${HOST_NAME}" "mkdir -p /usr/share/nginx/html/book_pdf"; fi
- if [ -d book_pdf ]; then scp -P "${SSH_PORT}" -r book_pdf/* "${SSH_USER}"@"${HOST_NAME}":"/usr/share/nginx/html/book_pdf"; fi
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- _book
- book_pdf
policy: pull
environment:
name: production
url: http://$HOST_NAME$COLON$HTTP_PORT/production/
#url: https://$PROXY_HOST_NAME/$BASE_PATH/
#url: https://$PROXY_HOST_NAME/$CI_PROJECT_PATH/
\ No newline at end of file
name: $CI_COMMIT_REF_NAME
url: https://$PROXY_HOST_NAME${BASE_DIR}
#url: https://$PROXY_HOST_NAME/
clean:
stage: clean
script:
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- ssh -p "${SSH_PORT}" "${SSH_USER}"@"${HOST_NAME}" "rm -rf /usr/share/nginx/html/*"
when: manual
only:
- master
environment:
name: $CI_COMMIT_REF_NAME
action: stop
linkchecker:intern:
stage: linkchecker
except:
- master
image:
name: linkchecker/linkchecker
entrypoint: [""]
script:
- linkchecker --recursion-level 10 --threads 10 --no-status --no-robots --no-warnings --ignore-url 'https://fonts.gstatic.com/{0,1}$' https://${REVIEW_PROXY_HOST_NAME}${REVIEW_BASE_DIR}~${CI_COMMIT_REF_NAME}/
when: manual
linkchecker:all:
stage: linkchecker
except:
- master
image:
name: linkchecker/linkchecker
entrypoint: [""]
script:
- linkchecker --recursion-level 10 --threads 10 --no-status --no-robots --no-warnings --check-extern --ignore-url 'https://fonts.gstatic.com/{0,1}$' https://${REVIEW_PROXY_HOST_NAME}${REVIEW_BASE_DIR}~${CI_COMMIT_REF_NAME}/
when: manual
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