You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.9 KiB

  1. .ensure_docker: &ensure_docker
  2. # Check for docker and install if missing
  3. - 'which docker || ( sudo apt-get update -y && sudo apt-get install docker.io -y )'
  4. .ensure_rsync: &ensure_rsync
  5. # Install rsync and deps if missing
  6. - 'which ssh-agent || ( sudo apt-get update -y && sudo apt-get install openssh-client -y )'
  7. - 'which rsync || ( sudo apt-get update -y && sudo apt-get install rsync -y )'
  8. - 'which make || ( sudo apt-get update -y && sudo apt-get install make -y )'
  9. .add_ssh_keys: &add_ssh_keys
  10. # Add the SSH key (stored in the SSH_PRIVATE_KEY variable) to the agent.
  11. - eval $(ssh-agent -s)
  12. - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
  13. .verify_ssh_host_keys: &verify_ssh_host_keys
  14. # Verify SSH host keys
  15. - mkdir -p ~/.ssh
  16. - chmod 700 ~/.ssh
  17. - echo "${SSH_KNOWN_HOSTS}" >> ~/.ssh/known_hosts
  18. - chmod 644 ~/.ssh/known_hosts
  19. .standard_job:
  20. tags: [kvm]
  21. before_script:
  22. - *ensure_docker
  23. .make_in_docker:
  24. extends: .standard_job
  25. script:
  26. - docker login -u ${DOCKER_REGISTRY_USER} -p ${DOCKER_REGISTRY_PASS} ${DOCKER_REGISTRY_HOST}
  27. - cd scripts/${CI_DISTRO_TARGET}
  28. - make ${MAKE_TARGET}
  29. .upload_pkg:
  30. extends: .standard_job
  31. before_script:
  32. - *ensure_rsync
  33. - *add_ssh_keys
  34. - *verify_ssh_host_keys
  35. script:
  36. - docker login -u ${DOCKER_REGISTRY_USER} -p ${DOCKER_REGISTRY_PASS} ${DOCKER_REGISTRY_HOST}
  37. - cd scripts/${CI_DISTRO_TARGET}
  38. - make ${MAKE_TARGET}
  39. - pwd
  40. - cd out
  41. - time rsync -avP -e "ssh -p ${PKG_HOST_SSH_PORT}" depot@${PKG_HOST}:files/pkgs/RHEL/8/pEpEngine/SHA256SUMS || true
  42. - if sha256sum --ignore-missing --check SHA256SUMS ; then echo "Package already exists... Exiting..." && exit ; else true ; fi
  43. - sha256sum ./*.rpm | tee --append SHA256SUMS
  44. - cat ./SHA256SUMS
  45. - time rsync -azvP -e "ssh -p ${PKG_HOST_SSH_PORT}" --rsync-path="mkdir -p /home/depot/files/pkgs/RHEL/8/pEpEngine && rsync" ./*.rpm SHA256SUMS depot@${PKG_HOST}:files/pkgs/RHEL/8/pEpEngine/