Commit f4d9f252 authored by Cédric Traizet's avatar Cédric Traizet

Merge branch 'ci_rcjob' into 'develop'

Deploy cookbook

See merge request !574
parents bbe59402 a72e7f5f
Pipeline #3441 passed with stages
in 5 minutes and 51 seconds
......@@ -353,7 +353,7 @@ deploy:
- git lfs fetch origin $CI_COMMIT_SHA
- git checkout -f -q $CI_COMMIT_SHA
script:
- ./CI/deploy.sh $CI_COMMIT_REF_NAME $RC_NUMBER
- ./CI/deploy.sh
dependencies:
- ubuntu-xdk-build-doc
- centos-xdk-build
......@@ -361,6 +361,17 @@ deploy:
- windows-8-build
- windows-10-build
# deploy-prod:
# tags:
# - deploy
# only:
# - tag
# image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
# stage: deploy
# when: manual
# script:
# - ./CI/deploy-prod.sh
release-container:
image: $BUILD_IMAGE_REGISTRY/otb-alpine:3.7
stage: deploy
......
#!/bin/bash
#
# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This script aims at moving and renaming source, packages and documentation from
# staging area to production area
staging_area=/home/otbpush/test/staging
#check if we are dealing with the right packages
pack_suffix=-$(echo "$CI_COMMIT_TAG" | grep -o "rc[0-9]*") # this retrieve the rc number
echo "pack_suffix=${pack_suffix}"
echo "Renaming binary packages"
# find build_packages/. -name "*.run" \
# -exec sh -c 'mv "$1" "${1%.run}${pack_suffix}.run"' _ {} \;
packages_list=$(ls ${staging_area} | grep -E "OTB-[0-9]*.[0-9]*.[0-9]*-.*\.(run|zip)")
ls -all build_packages/
for name in $packages_list
do
len=${#name}
#add pack_suffix to the name
mv "$name" "${name:0:$len-4}${pack_suffix}${name:$len-4}"
done
# TO REMOVE
###########
ls -all build_packages/
###########
......@@ -19,30 +19,21 @@
# limitations under the License.
#
# 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
if [ "$CI_COMMIT_REF_NAME" = "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" ]
if [ "$CI_COMMIT_REF_NAME" = "develop" ]
then # On develop
ssh otbpush@otb5-vm2.orfeo-toolbox.org rm -rf /home/otbpush/test/latest
# Create symilink
......@@ -50,19 +41,13 @@ then # On develop
# 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})
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
echo "Renaming binary packages"
for name in $(find . -regex "./OTB-.*\(run\|zip\)"); do
len=(${#name})
mv "$name" "${name:0:$len-4}${pack_suffix}${name:$len-4}"
done
echo "Pushing binary packages"
scp OTB-*.{run,zip} otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/.
# Push doc
......@@ -71,9 +56,9 @@ scp {CookBook-*-html.tar.gz,OTB-Doxygen-*.tar.bz2} otbpush@otb5-vm2.orfeo-toolbo
# 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
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 \
......@@ -82,7 +67,20 @@ ${jobs_directory}/OTB-sources-*.tar.*
# Push new source file
echo "Pushing new sources"
scp OTB-sources-$CI_COMMIT_SHORT_SHA.* \
scp OTB-sources-"$CI_COMMIT_SHORT_SHA".* \
otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/
echo "${CI_COMMIT_SHA}" > ref.sha
echo "Pushing ref.sha"
scp ref.sha otbpush@otb5-vm2.orfeo-toolbox.org:${jobs_directory}/
#Untar doc
if [ "$CI_COMMIT_REF_NAME" = "develop" ]
then
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
tar -xf ${jobs_directory}/CookBook-*-html.tar.gz
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
rm -rf /home/otbpush/test/CookBook/*
ssh otbpush@otb5-vm2.orfeo-toolbox.org \
mv ${jobs_directory}/CookBook-*/* /home/otbpush/test/CookBook/.
fi
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