From d0ce4426baf1924bf93ed4ce65ce5c33e04fae84 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Thu, 10 Jan 2019 10:22:09 +0100 Subject: [PATCH] [ci] Improved deployment --- .gitlab-ci.yml | 9 ++++++--- ci/bootstrap.sh | 34 +++++++++++++++++++++++++++------- ci/deploy.sh | 7 ------- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a13f18d0..a09f0dda 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ stages: .build_template: &build_job stage: build before_script: - - ./ci/bootstrap.sh + - ./ci/bootstrap.sh build script: - ./ci/build.sh cache: &build_caches @@ -73,9 +73,12 @@ build_macosx_36: .deploy_template: &deploy_job stage: deploy before_script: - - ./ci/bootstrap.sh self + - ./ci/bootstrap.sh local myenv script: - - ./ci/deploy.sh + - source ${CONDA_ROOT}/etc/profile.d/conda.sh + - conda activate myenv + - bdt --help + - bdt ci deploy dependencies: - build_linux_36 - build_macosx_36 diff --git a/ci/bootstrap.sh b/ci/bootstrap.sh index bf61ad9b..21e3901e 100755 --- a/ci/bootstrap.sh +++ b/ci/bootstrap.sh @@ -1,8 +1,15 @@ #!/usr/bin/env bash # Bootstraps a new conda installation and prepares base environment -# if "self" is passed as parameter, then self installs an already built -# version of bob.devtools available on your conda-bld directory. +# if "local" is passed as parameter, then self installs an already built +# version of bob.devtools available on your conda-bld directory. If you pass +# "beta", then it bootstraps from the package installed on our conda beta +# channel. If you pass "stable", then it bootstraps installing the package +# available on the stable channel. +# +# If bootstrapping anything else than "build", then provide a second argument +# with the name of the environment that one wants to create with an +# installation of bob.devtools. # datetime prefix for logging log_datetime() { @@ -113,21 +120,34 @@ run_cmd mkdir -p ${CONDA_ROOT}/pkgs run_cmd touch ${CONDA_ROOT}/pkgs/urls run_cmd touch ${CONDA_ROOT}/pkgs/urls.txt +CONDA_CHANNEL_ROOT=http://www.idiap.ch/public/conda +check_defined CONDA_CHANNEL_ROOT + run_cmd cp -fv ${CI_PROJECT_DIR}/bob/devtools/data/base-condarc ${CONDARC} echo "channels:" >> ${CONDARC} -echo " - http://www.idiap.ch/public/conda" >> ${CONDARC} +if [ "${1}" == "beta" ]; then + echo " - ${CONDA_CHANNEL_ROOT}/label/beta" >> ${CONDARC} +fi +echo " - ${CONDA_CHANNEL_ROOT}" >> ${CONDARC} echo " - defaults" >> ${CONDARC} # displays contents of our configuration echo "Contents of \`${CONDARC}':" cat ${CONDARC} -# updates conda installation, installs just built bob.devtools -if [ "${1}" == "self" ]; then - run_cmd ${CONDA_ROOT}/bin/conda create -n bdt ${CONDA_ROOT}/conda-bld/${OS_SLUG}/bob.devtools-*.tar.bz2 -else +# creates a base installation depending on the purpose +if [ "${1}" == "build" ]; then run_cmd ${CONDA_ROOT}/bin/conda install -n base python conda=4 conda-build=3 +elif [ "${1}" == "local" ]; then + run_cmd ${CONDA_ROOT}/bin/conda create -n "${2}" ${CONDA_ROOT}/conda-bld/${OS_SLUG}/bob.devtools-*.tar.bz2 +elif [ "${1}" == "beta" ] || [ "${1}" == "stable" ]; then + run_cmd ${CONDA_ROOT}/bin/conda create -n "${2}" bob.devtools +else + log_error "Bootstrap with 'build', or 'local|beta|stable <name>'" + log_error "The value '${1}' is not currently supported" + exit 1 fi +run_cmd # cleans up run_cmd ${CONDA_ROOT}/bin/conda clean --lock diff --git a/ci/deploy.sh b/ci/deploy.sh index f96ea437..afbe9a72 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -1,13 +1,6 @@ #!/usr/bin/env bash # Wed Jan 9 16:48:57 CET 2019 -source $(dirname ${0})/functions.sh - -run_cmd cp -fv ${CI_PROJECT_DIR}/bob/devtools/data/base-condarc ${CONDARC} -echo "channels:" >> ${CONDARC} -echo " - ${DOCSERVER}/public/conda" >> ${CONDARC} -echo " - defaults" >> ${CONDARC} - deploy_conda_packages ${CONDA_CHANNELS[0]} ${CI_PROJECT_NAME} # upload the docs from the sphinx folder (usually an artifact of Linux Python -- GitLab