Commit bbad099b authored by Antoine Regimbeau's avatar Antoine Regimbeau

Merge branch 'ci_deploy_script' into 'develop'

CI: deploy

See merge request orfeotoolbox/otb!523
parents 0aee932a 5b30ace6
Pipeline #1923 passed with stages
in 6 minutes and 8 seconds
......@@ -22,6 +22,7 @@ stages:
- precheck
- prepare
- build
- deploy
.general:
retry:
......@@ -70,6 +71,8 @@ fast-build:
- build/CookBook-*-html.tar.gz
- build/Documentation/Cookbook/latex/CookBook-*.pdf
- build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2
- build_packages/OTB-*.run
- build_packages/OTB-*.zip
debian-build:
extends: .common-build
......@@ -108,14 +111,9 @@ ubuntu-xdk-build:
image: $BUILD_IMAGE_REGISTRY/otb-ubuntu-superbuild-base:18.04
script:
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -V -S CI/main_superbuild.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-xdk
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -VV -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base
- xvfb-run -a -n 1 -s "-screen 0 1024x768x24 -dpi 96" ctest -VV -S CI/main_packages.cmake -DIMAGE_NAME:string=otb-ubuntu-superbuild-base -DNAME_SUFFIX:string=-glibc-2.27
dependencies:
- ubuntu-xdk-prepare
artifacts:
paths:
- build/CookBook-*-html.tar.gz
- build/Documentation/Cookbook/latex/CookBook-*.pdf
- build/Documentation/Doxygen/OTB-Doxygen-*.tar.bz2
## CentOS superbuild
centos-xdk-prepare:
......@@ -218,3 +216,30 @@ windows-8-build:
- ctest -V -S CI/main_packages.cmake
dependencies:
- windows-8-prepare
# Deploy job
deploy:
tags:
- deploy
image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
stage: deploy
extends: .general
only:
- develop
- /^release-[0-9]+\.[0-9]+$/
before_script:
- git lfs install --skip-repo
# Provision efficiently the local LFS cache before checkout
- git lfs fetch origin $CI_COMMIT_SHA
# Checkout the expected branch
- git checkout -f -q $CI_COMMIT_SHA
script:
- ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER
dependencies:
- ubuntu-xdk-build
- centos-xdk-build
- macos-xdk-build
- windows-8-build
- windows-10-build
\ No newline at end of file
......@@ -30,7 +30,7 @@ import json
import time
trace = True
trace = False
"""
Check needed environment parameters
......
#!/bin/bash
# Configure git for tar.xz
git config tar.tar.xz.command "xz -c"
pack_suffix=""
if [ $1 = "develop" ] # check if the branch name is develop or not
then # we are on develop
jobs_directory=/home/otbpush/test/$(date +%F)
else # we are on a release branch
jobs_directory=/home/otbpush/test/staging
if [ "$#" -eq 2 ]
then # there is a rc tag, we need a suffix for packages
pack_suffix=-$(echo "$2" | grep -o "rc[0-9]*") # this retrieve the rc number
fi
fi
echo "jobs_directory=${jobs_directory}"
echo "pack_suffix=${pack_suffix}"
# Create today's directory on serveur otb5-vm2
echo "Creating today's directory"
ssh otbpush@otb5-vm2.orfeo-toolbox.org mkdir -p ${jobs_directory}
# Delete latest
echo "Deleting latest directory"
if [ $1 = "develop" ]
then # On develop
ssh otbpush@otb5-vm2.orfeo-toolbox.org rm -rf /home/otbpush/test/latest
# Create symilink
ssh otbpush@otb5-vm2.orfeo-toolbox.org ln -s ${jobs_directory} /home/otbpush/test/latest
# Cleaning old directory
matching_dirs=$(ls -1 | grep -oE '^20[0-9]{2}-[0-9]{2}-[0-9]{2}$' | sort)
history_length=11
rm -rf $(echo $matching_dirs | tr ' ' '\n' | head -n -${history_length})
else # On release
# Remove what is inside staging area
ssh otbpush@otb5-vm2.orfeo-toolbox.org rm -rf ${jobs_directory}/*
fi
# Push package
ls -all build_packages/
echo "Renaming binary packages"
# find build_packages/. -name "*.run" \
# -exec sh -c 'mv "$1" "${1%.run}${pack_suffix}.run"' _ {} \;
for name in $(find build_packages/. -name "OTB-*.*")
do
len=(${#name})
mv "$name" "${name:0:$len-4}${pack_suffix}${name:$len-4}"
done
# TO REMOVE
###########
ls -all build_packages/
###########
echo "Pushing binary packages"
scp build_packages/OTB-*.{run,zip} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/.
# Push doc
echo "Pushing documentation"
scp build/{CookBook-*-html.tar.gz,\
/Documentation/{Cookbook/latex/CookBook-*.pdf,Doxygen/OTB-Doxygen-*.tar.bz2}} \
otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/.
# Create zip, tar.gz and tar.xy source
echo "Creating source tarball and zip"
git archive --format=zip -o OTB-sources-$CI_COMMIT_SHORT_SHA.zip HEAD
git archive --format=tgz -o OTB-sources-$CI_COMMIT_SHORT_SHA.tar.gz HEAD
git archive --format=tar.xz -o OTB-sources-$CI_COMMIT_SHORT_SHA.tar.xz HEAD
# Remove old source file
echo "Removing old sources"
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
rm ${jobs_directory}/OTB-sources-*.zip \
${jobs_directory}/OTB-sources-*.tar.*
# Push new source file
echo "Pushing new sources"
scp OTB-sources-$CI_COMMIT_SHORT_SHA.* \
otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/
\ No newline at end of file
......@@ -67,7 +67,8 @@ set ( CONFIGURE_OPTIONS
"-DCMAKE_INSTALL_PREFIX=${CTEST_INSTALL_DIRECTORY};\
-DOTB_BINARY_DIR=${OTB_SOURCE_DIR}/build;\
-DSUPERBUILD_INSTALL_DIR=${OTB_SOURCE_DIR}/xdk;\
-DSUPERBUILD_BINARY_DIR=${OTB_SOURCE_DIR}/build;" )
-DSUPERBUILD_BINARY_DIR=${OTB_SOURCE_DIR}/build;\
-DNAME_SUFFIX=${NAME_SUFFIX};" )
# Look for a GIT command-line client.
find_program(CTEST_GIT_COMMAND NAMES git git.cmd)
......
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