Fuel plugin for Congress integration
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.

pre_build_hook 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. # Add here any the actions which are required before plugin build
  3. # like packages building, packages downloading from mirrors and so on.
  4. # The script should return 0 if there were no errors.
  5. set -eux
  6. ROOT="$(dirname "$(readlink -f "$0")")"
  7. MODULES_DIR="${ROOT}/deployment_scripts/puppet/modules"
  8. TMP_DIR="${ROOT}/tmp"
  9. UBUNTU_REPO_DIR="${ROOT}/repositories/ubuntu"
  10. BUILD_DEBS=false
  11. CONGRESS_PUPPET_REPO=${CONGRESS_PUPPET_REPO:-'https://github.com/openstack/puppet-congress.git'}
  12. CONGRESS_PUPPET_BRANCH=${CONGRESS_PUPPET_BRANCH:-'master'}
  13. CONGRESS_PUPPET_DST_DIR="${MODULES_DIR}/congress"
  14. CONGRESS_REPO=${CONGRESS_REPO:-'https://github.com/openstack/congress.git'}
  15. CONGRESS_BRANCH=${CONGRESS_BRANCH:-'stable/newton'}
  16. CONGRESS_DST_DIR="${TMP_DIR}/congress"
  17. CONGRESS_CLI_REPO=${CONGRESS_CLI_REPO:-'https://github.com/openstack/python-congressclient.git'}
  18. CONGRESS_CLI_BRANCH=${CONGRESS_CLI_BRANCH:-'stable/newton'}
  19. CONGRESS_CLI_DST_DIR="${TMP_DIR}/python-congressclient"
  20. function git_download {
  21. local git_repo=$1
  22. local git_branch=$2
  23. local dst_dir=$3
  24. rm -rvf "$dst_dir"
  25. git clone "${git_repo}" --single-branch -b "${git_branch}" "${dst_dir}"
  26. }
  27. # Remove temp directory
  28. function clean {
  29. rm -rf "${TMP_DIR}"
  30. }
  31. function check_fpm {
  32. command -v fpm > /dev/null 2>&1 || { echo >&2 "ERROR: fpm ruby gem is not installed. Aborting."; exit 1; }
  33. }
  34. function build_deb {
  35. pushd "${UBUNTU_REPO_DIR}"
  36. fpm --force -s python -t deb --python-install-bin /usr/bin --python-install-lib /usr/lib/python2.7/dist-packages "${CONGRESS_DST_DIR}/setup.py"
  37. fpm --force -s python -t deb --python-install-lib /usr/lib/python2.7/dist-packages "${CONGRESS_CLI_DST_DIR}/setup.py"
  38. popd
  39. }
  40. git_download "${CONGRESS_PUPPET_REPO}" "${CONGRESS_PUPPET_BRANCH}" "${CONGRESS_PUPPET_DST_DIR}"
  41. if ["$BUILD_DEBS" == "true"]; then
  42. check_fpm
  43. clean
  44. git_download "${CONGRESS_REPO}" "${CONGRESS_BRANCH}" "${CONGRESS_DST_DIR}"
  45. git_download "${CONGRESS_CLI_REPO}" "${CONGRESS_CLI_BRANCH}" "${CONGRESS_CLI_DST_DIR}"
  46. build_deb
  47. clean
  48. fi