--- /dev/null
+---
+
+variables:
+ EL_MAJOR_VERSION: '9'
+ PKG_NAME: 'some_python_package'
+ USED_SSH_PRIV_KEY_YUM_REPO: 'nada'
+ YUM_REPO_HOST: 'repo02.pixelpark.com'
+ YUM_REPO_USER: 'rpm-repo'
+ YUM_REPO_DIR_HTTP: '/Linux/yum/pixelpark'
+ YUM_REPO_DIR: "/srv/www/repo${YUM_REPO_DIR_HTTP}"
+
+#---------------------------
+.deploy-packages:
+ rules:
+ - if: '$CI_COMMIT_TAG'
+ when: manual
+ allow_failure: true
+ stage: deploy
+ tags:
+ - deploy_v2
+ environment:
+ name: production
+ before_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}"'
+ - 'mkdir -pv "${HOME}/.ssh"'
+ - 'chmod -v 0700 "${HOME}/.ssh"'
+ - '/bin/echo "${USED_SSH_PRIV_KEY_YUM_REPO}" > "${HOME}/.ssh/id_rsa"'
+ - 'chmod -v 0600 "${HOME}/.ssh/id_rsa"'
+ - 'ls -lA --color=always "${HOME}/.ssh"'
+ - |
+ if [[ -f "${HOME}/.ssh/config" ]] ; then
+ echo "Content of ${HOME}/.ssh/config:"
+ cat "${HOME}/.ssh/config"
+ echo
+ fi
+ script:
+ - echo "Packages to deploy:"; find rpmdir/*RPMS -type f -print0 | xargs --null --no-run-if-empty ls -l -d --color=always
+ - |
+ src_repo_dir="${YUM_REPO_DIR}/${EL_MAJOR_VERSION}-src"
+ echo "Deploying source packages to ${YUM_REPO_HOST}:${src_repo_dir}/ ..."
+ ssh -o StrictHostKeyChecking=no "${YUM_REPO_USER}@${YUM_REPO_HOST}" "if [ ! -d ${src_repo_dir} ] ; then mkdir -pv ${src_repo_dir} ; fi"
+ scp -p -o StrictHostKeyChecking=no rpmdir/SRPMS/*.rpm "${YUM_REPO_USER}@${YUM_REPO_HOST}:${src_repo_dir}/"
+ ssh -o StrictHostKeyChecking=no "${YUM_REPO_USER}@${YUM_REPO_HOST}" "cd ${src_repo_dir}/ && createrepo --update . && chmod -v a+x repodata && chmod -Rv a+r repodata"
+ - |
+ bin_repo_dir="${YUM_REPO_DIR}/${EL_MAJOR_VERSION}"
+ echo "Deploying binary packages to ${YUM_REPO_HOST}:${bin_repo_dir}/ ..."
+ ssh -o StrictHostKeyChecking=no "${YUM_REPO_USER}@${YUM_REPO_HOST}" "if [ ! -d ${bin_repo_dir} ] ; then mkdir -pv ${bin_repo_dir} ; fi"
+ scp -p -o StrictHostKeyChecking=no rpmdir/RPMS/*/*.rpm "${YUM_REPO_USER}@${YUM_REPO_HOST}:${bin_repo_dir}/"
+ ssh -o StrictHostKeyChecking=no "${YUM_REPO_USER}@${YUM_REPO_HOST}" "cd ${bin_repo_dir}/ && createrepo --update . && chmod -v a+x repodata && chmod -Rv a+r repodata"
+ after_script:
+ - rm -rf rpmdir
+
+# vim: et tabstop=2 expandtab shiftwidth=2 softtabstop=2 list