Add build_version generating

* drop per-deb pkg version
* drop FUEL_PLUGIN_MURANO_COMMIT version
* drop MURANO_TARBALL_COMMIT version

Change-Id: I92faf135a9e5238e7f3e24b440278676cd260343
This commit is contained in:
alexz 2016-08-18 15:42:58 +03:00
parent 89f742ed20
commit bf5a150a91
2 changed files with 27 additions and 1 deletions

View File

@ -42,3 +42,19 @@ function download_puppet_module {
mkdir -p "${MODULES_DIR}"/"$1"
wget -qO- "$2" | tar -C "${MODULES_DIR}/$1" --strip-components=1 -xz
}
# Generate version file in format:
# Build: $build_date
# FUEL_PLUGIN_COMMIT=$sha
# $pkg_name=$pkg_version
function generate_version_file {
local version_file="${1:-build_version}"
local tmp_file=$(mktemp)
echo "# Build: $(date +%Y-%m-%d-%H-%M-%S)" >> "${version_file}"
echo "FUEL_PLUGIN_COMMIT=$(git rev-parse HEAD)" >> "${version_file}"
while read -d '' -r pkg; do
dpkg-deb -I "${pkg}"| awk '/Package:/{name=$2}/Version:/{ver=$2;print name"="ver}' >> "${tmp_file}"
done < <(find "repositories/ubuntu" -name '*.deb' -print0)
cat "${tmp_file}" | sort >> "${version_file}"
rm -vf "${tmp_file}"
}

View File

@ -3,11 +3,12 @@ set -eux
. "$(dirname "$(readlink -f "$0")")"/functions.sh
VERSION_FILE="build_version"
MURANO_REF=${MURANO_REF:-'stable/mitaka'}
MURANO_PACKAGE_RELEASE=${MURANO_PACKAGE_RELEASE:-'9.0'}
MURANO_TARBALL_URL=${MURANO_TARBALL_URL:-"https://github.com/openstack/puppet-murano/archive/${MURANO_REF}.tar.gz"}
# Add murano packages and some dependencies
# Add murano packages and some dependencies, from master pkg's
MURANO_PACKAGES_URLS_DEFAULT="http://mirror.fuel-infra.org/extras/murano-plugin-repos/ubuntu/${MURANO_PACKAGE_RELEASE}/pool/main/"
MURANO_PACKAGES_URLS=${MURANO_PACKAGES_URLS:-${MURANO_PACKAGES_URLS_DEFAULT}}
@ -17,3 +18,12 @@ for url in ${MURANO_PACKAGES_URLS}; do
done
download_puppet_module "murano" ${MURANO_TARBALL_URL}
# generate general version file
generate_version_file "${VERSION_FILE}"
# add info about MURANO_TARBALL
echo "MURANO_TARBALL_URL=${MURANO_TARBALL_URL}" >> "${VERSION_FILE}"
echo "MURANO_TARBALL_COMMIT=$(git ls-remote -h https://github.com/openstack/puppet-murano.git |grep "refs/heads/${MURANO_REF}" |awk '{print $1}' )" >> "${VERSION_FILE}"