FB_REPOSERVER_GPGKEY_URL: 'http://repo.uhu-banane.de/public/repo.uhu-banane.de.gpg-key2.asc'
NOTIFY_ADDRESS: 'frank.brehm@pixelpark.com'
SENDER_ADDRESS: 'gitlab-ci@pixelpark.com'
+ SSH_PRIV_KEY_YUM_REPO: 'nada'
USED_TIMEZONE: 'Europe/Berlin'
VERSION_PREFIX: 'unknown'
YUM_REPO_GPG_ID: 'C0E73F70'
YUM_REPO_GPG_KEY_PUB: 'nada'
YUM_REPO_GPG_KEY_SEC: 'nada'
+# ---------------------------
.docker_job_definition:
before_script:
- locale -a
- pip install --upgrade pip
- pip install -r requirements.txt --upgrade --upgrade-strategy eager
+# ---------------------------
.test-rules:
stage: test
rules:
- pip list --format columns
- pytest --verbose
+# ---------------------------
test Python 3.6:
extends:
- .docker_job_definition
- .test-rules
image: python:3.6
+# ---------------------------
test Python 3.7:
extends:
- .docker_job_definition
- .test-rules
image: python:3.7
+# ---------------------------
test Python 3.8:
extends:
- .docker_job_definition
- .test-rules
image: python:3.8
+# ---------------------------
test Python 3.9:
extends:
- .docker_job_definition
- .test-rules
image: python:3.9
+# ---------------------------
test Python 3.10:
extends:
- .docker_job_definition
- .test-rules
image: python:3.10
+# ---------------------------
Linter:
stage: linter
extends:
- 'test Python 3.9'
- 'test Python 3.10'
+# ---------------------------
.pkg-build-rules:
stage: build
rules:
find rpmdir/*RPMS -type f -print0 | xargs --null --no-run-if-empty ls -l -d --color=always
+# ---------------------------
build CentOS 7 with Python 3.6:
variables:
EL_MAJOR_VERSION: '7'
- '.pkg-build-rules'
image: centos:7
+# ---------------------------
build CentOS 8 with Python 3.8:
variables:
EL_MAJOR_VERSION: '8'
- '.pkg-build-rules'
image: centos:8
+# ---------------------------
.pkg-sign-rules:
rules:
- if: '$CI_COMMIT_TAG'
- rpmdir/SRPMS/*.src.rpm
expire_in: '1 week'
+# ---------------------------
Sign EL 7 packages:
extends:
- '.pkg-sign-rules'
dependencies:
- 'build CentOS 7 with Python 3.6'
+# ---------------------------
Sign EL 8 packages:
extends:
- '.pkg-sign-rules'
dependencies:
- 'build CentOS 8 with Python 3.8'
+# ---------------------------
+.rpm-pkg-deploy:
+ rules:
+ # - if: '$CI_COMMIT_TAG'
+ - if: true
+ when: manual
+ allow_failure: true
+ stage: deploy
+ tags:
+ - docker_v2
+ script:
+ - hostname -f
+ - whoami
+ - pwd
+ - ls -lA --color=always
+ - find rpmdir/*RPMS -type f -print0 | xargs --null --no-run-if-empty ls -l -d --color=always
+ - echo -e "YUM_REPO_USER: ${YUM_REPO_USER}"
+ - echo -e "YUM_REPO_HOST: ${YUM_REPO_HOST}"
+ - echo -e "YUM_REPO_DIR: ${YUM_REPO_DIR}"
+ - |
+ echo "Ensuring '${HOME}/.ssh/authorized_keys' ..."
+ mkdir -pv "${HOME}/.ssh"
+ chmod -v 0700 "${HOME}/.ssh"
+ echo "${SSH_PRIV_KEY_YUM_REPO}" > "${HOME}/.ssh/authorized_keys"
+ chmod -v 0600 "${HOME}/.ssh/authorized_keys"
+ ls -lA "${HOME}/.ssh"
+ # - 'scp -p -o StrictHostKeyChecking=no rpmdir/RPMS/*/*.rpm ${YUM_REPO_USER}@${YUM_REPO_HOST}:${YUM_REPO_DIR}/${EL_MAJOR_VERSION}/'
+ # - 'ssh -o StrictHostKeyChecking=no ${YUM_REPO_USER}@${YUM_REPO_HOST} "cd ${YUM_REPO_DIR}/${EL_MAJOR_VERSION}/ && createrepo --update . && chmod -v a+x repodata && chmod -Rv a+r repodata"'
+ - scp -p -o StrictHostKeyChecking=no rpmdir/SRPMS/*.rpm "${YUM_REPO_USER}@${YUM_REPO_HOST}:${YUM_REPO_DIR}/src/"
+ - ssh -o StrictHostKeyChecking=no "${YUM_REPO_USER}@${YUM_REPO_HOST}" "cd ${YUM_REPO_DIR}/src/ && createrepo --update . && chmod -v a+x repodata && chmod -Rv a+r repodata"
+ after_script:
+ - rm -rf rpmdir
+ environment:
+ name: production
+
+# ---------------------------
+Deploy packages EL7:
+ extends:
+ - '.rpm-pkg-deploy'
+ variables:
+ EL_MAJOR_VERSION: '7'
+ needs:
+ - 'Sign EL 7 packages'
+ dependencies:
+ - 'Sign EL 7 packages'
+
+# ---------------------------
+Deploy packages EL8:
+ extends:
+ - '.rpm-pkg-deploy'
+ variables:
+ EL_MAJOR_VERSION: '8'
+ needs:
+ - 'Sign EL 8 packages'
+ dependencies:
+ - 'Sign EL 8 packages'
+
+# ---------------------------
+# .notify-rules:
+# rules:
+# - if: '$CI_COMMIT_TAG'
+# - if: $CI_COMMIT_BRANCH == "master"
+# - if: $CI_COMMIT_BRANCH == "main"
+# - if: $CI_COMMIT_BRANCH == "test"
+# tags:
+# - docker_v2
+# needs:
+# - 'Deploy packages EL7'
+# - 'Deploy packages EL8'
+
+# ---------------------------
+# Notify Success:
+# extends:
+# - '.notify-rules'
+# allow_failure: true
+# script: 'echo -e "Module ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME} (${CI_COMMIT_REF_NAME}): all checks successful\nCommiter: ${GITLAB_USER_NAME} <${GITLAB_USER_EMAIL}>" | mailx -s "Gitlab-CI: Python module fb_tools" -r "$SENDER_ADDRESS" $NOTIFY_ADDRESS'
+
+# ---------------------------
+# Notify Error:
+# extends:
+# - '.notify-rules'
+# allow_failure: true
+# when: on_failure
+# script: 'echo -e "Error in module ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME} (${CI_COMMIT_REF_NAME})\nPlease check ${CI_PROJECT_URL}/pipelines/${CI_PIPELINE_ID}\n\nCommiter: ${GITLAB_USER_NAME} <${GITLAB_USER_EMAIL}>" | mailx -s "Gitlab-CI error for Python module fb_tools" -r "$SENDER_ADDRESS" "$NOTIFY_ADDRESS"'
+
+# vim: et tabstop=2 expandtab shiftwidth=2 softtabstop=2 list