Commit 29a2e098 authored by Andre Anjos's avatar Andre Anjos

More flexible build infrastructure (closes #32)

* Allows the user to set if deployment will take place thru build
  variable
* Uses new build infrastructure from bob.admin
* Uploads the different packages to the right destinations
* Considers build numbers from the right channels depending on the
  package visibility and commit tags
parent e9538102
Pipeline #17154 failed with stage
in 220 minutes and 3 seconds
......@@ -33,13 +33,15 @@ if [ -z "${DOCPASS}" ]; then
fi
if [ ! -d "${CONDA_ROOT}" ]; then
if [ -n "${STABLE}" ]; then
if [[ "${STABLE}" == "true" ]]; then
# if building stable packages, make sure to set a temporary version of
# CI_COMMIT_TAG to a non-zero value to get beta conda channel on
export CI_COMMIT_TAG='stable'
fi
export VISIBILITY='private' #always allows the inclusion of all channels
./_ci/before_build.sh
if [ -n "${STABLE}" ]; then
unset VISIBILITY #unsets temporary hack
if [[ "${STABLE}" == "true" ]]; then
# unset temporary hack to not disturb later builds
unset CI_COMMIT_TAG
fi
......
......@@ -34,6 +34,9 @@ fi
source ${basedir}/_ci/functions.sh
unset BOB_PACKAGE_VERSION
# Checks package visibility
VISIBILITY=`visibility`
# Setup project variables
export_env CI_PROJECT_DIR
export_env CI_PROJECT_NAME
......@@ -68,7 +71,7 @@ latest_stable () {
echo `git -C $1 tag --sort='v:refname' | grep -e 'v[0-9]*\.[0-9]*\.[0-9]*$' | tail -n 1`
}
if [ -n "${STABLE}" ]; then
if [[ "${STABLE}" == "true" ]]; then
CI_COMMIT_TAG=`latest_stable ${CI_PROJECT_DIR}`
if [ -z "${CI_COMMIT_TAG}" ]; then
echo "";
......@@ -93,16 +96,13 @@ fi
BOB_PACKAGE_VERSION=`cat version.txt | tr -d '\n'`;
export_env BOB_PACKAGE_VERSION
# This will reset conda channels to their configuration so it they are
# appropriate for the current package being built
set_conda_channels ${VISIBILITY} ${CI_COMMIT_TAG}
# Calculates the current build-number available if in test-only mode
if [ -n "${BOB_TEST_ONLY}" ]; then
run_cmd mkdir -p ./_ci/${OS_SLUG}/${PYTHON_VERSION}
if [ -z "${CI_COMMIT_TAG}" ]; then
run_cmd ${CONDA_ROOT}/bin/python _ci/channel_support.py ${CONDA_BETA_CHANNEL} ${CI_PROJECT_NAME} ${BOB_PACKAGE_VERSION} ${PYTHON_VERSION} -u --log ./_ci/${OS_SLUG}/${PYTHON_VERSION}/build_number.txt
else
run_cmd ${CONDA_ROOT}/bin/python _ci/channel_support.py ${CONDA_CHANNEL} ${CI_PROJECT_NAME} ${BOB_PACKAGE_VERSION} ${PYTHON_VERSION} -u --log ./_ci/${OS_SLUG}/${PYTHON_VERSION}/build_number.txt
fi
BOB_BUILD_NUMBER=`head -n 1 ./_ci/${OS_SLUG}/${PYTHON_VERSION}/build_number.txt | tr -d '\n'`
set_next_bob_build_number ${CONDA_CHANNELS[0]}
((BOB_BUILD_NUMBER--)) #uses the latest available
export_env BOB_BUILD_NUMBER
fi
......@@ -110,12 +110,14 @@ fi
run_cmd ./_ci/build.sh
if [ -z "${BOB_TEST_ONLY}" ]; then
# consider uploading...
if [[ "${IS_MASTER}" == "true" ]]; then
deploy_conda_packages
# consider uploading depending on the environment...
if [[ "${DEPLOY_PACKAGES}" == "true" ]]; then
deploy_conda_packages ${CONDA_CHANNELS[0]} ${CI_PROJECT_NAME}
else
log_info 'Skipping package upload (not on master branch)'
log_info 'Skipping package deployment (${DEPLOY_PACKAGES}!="true")...'
fi
else
log_info 'Skipping package deployment (in test-only mode)...'
fi
# we don't keep temp build material while testing only or after an upload
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment