diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d2d4bff3b07599687382022a04a2d239db70f2df..7ba11f88475643c7f44b28f4bc5ce81359d3ac4f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,39 +2,43 @@ stages: - build - deploy -variables: - GIT_DEPTH: 1 - build: - image: python:3 stage: build + variables: + GIT_DEPTH: 1 + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + image: python:3 before_script: - - python3 -m pip install --user -U pip - - python3 -m pip install --user -I -r requirements.txt + - python3 -m venv pyvenv + - source pyvenv/bin/activate + - python3 -m pip install --upgrade pip + - python3 -m pip install -r requirements.txt + - deactivate script: - - python3 -m mkdocs build + - pyvenv/bin/mkdocs build + cache: + paths: + - .cache/pip/ + - pyvenv/ artifacts: expire_in: 1w paths: - site/ deploy: - variables: - HOME: /root stage: deploy - when: manual only: - /^master$/ needs: - build + variables: + GIT_STRATEGY: none before_script: - - source .gitlab-ci/utils.sh - - authenticate_krb + - echo ${SERVICE_ACCOUNT_PASSWORD} | base64 -d | kinit -A -f ${SERVICE_ACCOUNT_USERNAME}@CERN.CH script: - > rsync -av --delete - site/ - ${SERVICE_ACCOUNT_USERNAME}@lxplus.cern.ch:${EOS_SITE_PATH}/ + -e "ssh -o StrictHostKeyChecking=no -o GSSAPIAuthentication=yes -o GSSAPITrustDNS=yes -o GSSAPIDelegateCredentials=yes" + site/ ${SERVICE_ACCOUNT_USERNAME}@lxplus.cern.ch:${EOS_SITE_PATH}/ after_script: - - source .gitlab-ci/utils.sh - - unauthenticate_krb + - kdestroy diff --git a/.gitlab-ci/utils.sh b/.gitlab-ci/utils.sh deleted file mode 100644 index 3980027ceacf735704c4eeb7064e94b85dc5dd66..0000000000000000000000000000000000000000 --- a/.gitlab-ci/utils.sh +++ /dev/null @@ -1,20 +0,0 @@ -authenticate_krb () { - local SERVICE_ACCOUNT_PASSWORD=$(echo ${SERVICE_ACCOUNT_PASSWORD} | base64 -d) - echo ${SERVICE_ACCOUNT_PASSWORD} | kinit -A -f ${SERVICE_ACCOUNT_USERNAME}@CERN.CH - - mkdir -p ${HOME}/.ssh - chmod go-rwx -R ${HOME}/.ssh - touch ${HOME}/.ssh/config - chmod go-rw ${HOME}/.ssh/config - cat<<EOF>${HOME}/.ssh/config -HashKnownHosts yes -StrictHostKeyChecking no -GSSAPIAuthentication yes -GSSAPITrustDNS yes -GSSAPIDelegateCredentials yes -EOF -} - -unauthenticate_krb () { - kdestroy -} diff --git a/README.md b/README.md index 5738371d0a86db51d51596ba483387e5527ed70d..8cbfc799cfc1fec42bfd1b112992078f0619c961 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,15 @@ Prepare your environment: ``` bash -$ python3 -m venv pyvenv -$ source pyvenv/bin/activate -$ python3 -m pip install --upgrade pip -$ python3 -m pip install -r requirements.txt -$ deactivate +python3 -m venv pyvenv +source pyvenv/bin/activate +python3 -m pip install --upgrade pip +python3 -m pip install -r requirements.txt +deactivate ``` Start a local web server to visualize your changes: ``` bash -$ pyvenv/bin/mkdocs serve +pyvenv/bin/mkdocs serve ```