summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorTomas Kulhanek <tomas.kulhanek@stfc.ac.uk>2019-01-23 10:26:18 +0000
committerGitHub <noreply@github.com>2019-01-23 10:26:18 +0000
commit619e972559992684854eef854e60fbc363e93819 (patch)
treeb8f3f1235b174a9bb2613eb5e54099f3a1860847 /build
parent06771c554d4c1ecd1e4a38a600e530222b86b28d (diff)
parent952e9f45b04a42d5b8ef6ce3fbc50046c00e61b9 (diff)
downloadregularization-619e972559992684854eef854e60fbc363e93819.tar.gz
regularization-619e972559992684854eef854e60fbc363e93819.tar.bz2
regularization-619e972559992684854eef854e60fbc363e93819.tar.xz
regularization-619e972559992684854eef854e60fbc363e93819.zip
Merge pull request #4 from TomasKulhanek/pr-test
Pr test
Diffstat (limited to 'build')
-rwxr-xr-xbuild/jenkins-build.sh52
1 files changed, 30 insertions, 22 deletions
diff --git a/build/jenkins-build.sh b/build/jenkins-build.sh
index 1d5692a..87ca54f 100755
--- a/build/jenkins-build.sh
+++ b/build/jenkins-build.sh
@@ -8,14 +8,13 @@ else
export CIL_VERSION=`git describe --tags | tail -c +2`
# dash means that it's some commit after tag release -thus will be treated as dev
if [[ ${CIL_VERSION} == *"-"* ]]; then
- # detected dash means that it is dev version
- # version is then string-string and all after second dash is ignored (usually commit sha)
- export CIL_VERSION=`echo ${CIL_VERSION} | cut -d "-" -f -2`
- # but dash is prohibited for conda build, replace with underscore
- export CIL_VERSION=`echo ${CIL_VERSION} | tr - _`
- echo Building dev version ${CIL_VERSION}
+ # detected dash means that it is dev version,
+ # get first and second part between first dash and ignore all after other dash (usually sha)
+ # and as dash is prohibited for conda build, replace with underscore
+ export CIL_VERSION=`echo ${CIL_VERSION} | cut -d "-" -f -2 | tr - _`
+ echo Building dev version: ${CIL_VERSION}
else
- echo Defining version from last git tag and commit: $CIL_VERSION
+ echo Building release version: $CIL_VERSION
fi
fi
@@ -24,7 +23,7 @@ fi
# install miniconda if the module is not present
if hash conda 2>/dev/null; then
- echo using conda
+ echo using installed conda
else
if [ ! -f Miniconda3-latest-Linux-x86_64.sh ]; then
wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
@@ -33,6 +32,11 @@ else
./Miniconda3-latest-Linux-x86_64.sh -u -b -p .
PATH=$PATH:./bin
fi
+
+GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
+echo on branch ${GIT_BRANCH}
+cat .git/HEAD
+
# presume that git clone is done before this script is launched, if not, uncomment
#git clone https://github.com/vais-ral/CCPi-Regularisation-Toolkit
conda install -y conda-build
@@ -45,20 +49,24 @@ export REG_FILES=`conda build Wrappers/Python/conda-recipe --output`
# REG_FILES variable should contain output files
echo files created: $REG_FILES
-#upload to anaconda
-if [[ -n ${CCPI_CONDA_TOKEN} ]]
-then
- conda install anaconda-client
- while read -r outfile; do
- #if 0 commit after tag then call anaconda without --label dev
- #TODO pull request not to upload
- if [[ $CIL_VERSION == *"_"* ]]; then
- # upload with dev label
- anaconda -v -t ${CCPI_CONDA_TOKEN} upload $outfile --force --label dev
- else
- anaconda -v -t ${CCPI_CONDA_TOKEN} upload $outfile --force
- fi
- done <<< "$REG_FILES"
+# upload to anaconda only if token is defined
+# and TODO pull request not to upload
+
+if [[ -n ${CCPI_CONDA_TOKEN} ]]; then
+ if [[ ${GIT_BRANCH} == "master" ]]; then
+ conda install anaconda-client
+ while read -r outfile; do
+ #if >0 commit (some _ in version) then marking as dev build
+ if [[ $CIL_VERSION == *"_"* ]]; then
+ # upload with dev label
+ anaconda -v -t ${CCPI_CONDA_TOKEN} upload $outfile --force --label dev
+ else
+ anaconda -v -t ${CCPI_CONDA_TOKEN} upload $outfile --force
+ fi
+ done <<< "$REG_FILES"
+ else
+ echo git branch is not master, will not upload to anaconda.
+ fi
else
echo CCPI_CONDA_TOKEN not defined, will not upload to anaconda.
fi