Skip to content

Commit

Permalink
fix(packaging): unifying tar.gz on source delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
rem31 committed Nov 10, 2021
1 parent bc98cfb commit 0a510e3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 55 deletions.
5 changes: 1 addition & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ stage('Deliver sources') {
dir('centreon-collect-centos7') {
checkout scm
loadCommonScripts()
sh 'ci/scripts/collect-sources-delivery.sh centreon-broker'
sh 'ci/scripts/collect-sources-delivery.sh centreon-clib'
sh 'ci/scripts/collect-sources-delivery.sh centreon-engine'
sh 'ci/scripts/collect-sources-delivery.sh centreon-connector'
sh 'ci/scripts/collect-sources-delivery.sh'
source = readProperties file: 'source.properties'
env.VERSION = "${source.VERSION}"
env.RELEASE = "${source.RELEASE}"
Expand Down
66 changes: 15 additions & 51 deletions ci/scripts/collect-sources-delivery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,19 @@ set -e

. ./common.sh

##### STARTING #####
if [[ -z "$1" ]]; then
echo "Must provide PROJECT argument like centreon-broker / centreon-clib ..." 1>&2
exit 1
fi

PROJECT=$1

echo -n "#####The Delivered project is $PROJECT#####"
echo -n "#####GET $PROJECT VERSION#####"

cmakelists=$PROJECT/CMakeLists.txt

case $PROJECT in
echo -n "#####The Delivered project is centreon-collect#####"
echo -n "#####GET centreon-collect VERSION#####"

centreon-broker)
major=`grep 'set(CENTREON_BROKER_MAJOR' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
minor=`grep 'set(CENTREON_BROKER_MINOR' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
patch=`grep 'set(CENTREON_BROKER_PATCH' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
;;
cmakelists=CMakeLists.txt

centreon-clib)
major=`grep 'set(CLIB_MAJOR' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
minor=`grep 'set(CLIB_MINOR' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
patch=`grep 'set(CLIB_PATCH' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
;;
centreon-engine)
major=`grep 'set(CENTREON_ENGINE_MAJOR' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
minor=`grep 'set(CENTREON_ENGINE_MINOR' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
patch=`grep 'set(CENTREON_ENGINE_PATCH' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
;;
centreon-connector)
major=`grep 'set(CONNECTOR_MAJOR' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
minor=`grep 'set(CONNECTOR_MINOR' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
patch=`grep 'set(CONNECTOR_PATCH' "$cmakelists" | cut -d ' ' -f 2 | cut -d ')' -f 1`
;;

*)
break
;;
esac
major=`grep 'set(COLLECT_MAJOR' CMakeLists.txt | cut -d ' ' -f 2 | cut -d ')' -f 1`
minor=`grep 'set(COLLECT_MINOR' CMakeLists.txt | cut -d ' ' -f 2 | cut -d ')' -f 1`
patch=`grep 'set(COLLECT_PATCH' CMakeLists.txt | cut -d ' ' -f 2 | cut -d ')' -f 1`

export VERSION="$major.$minor.$patch"
export MAJOR="$major.$minor"

echo -n "#####GET $PROJECT RELEASE#####"
echo -n "#####GET centreon-collect RELEASE#####"
COMMIT=`git log -1 HEAD --pretty=format:%h`
now=`date +%s`
if [ "$BUILD" '=' 'RELEASE' ] ; then
Expand All @@ -57,24 +24,21 @@ else
export RELEASE="$now.$COMMIT"
fi

echo -n "#####GET $PROJECT COMMITER#####"
echo -n "#####GET centreon-collect COMMITER#####"
COMMITTER=`git show --format='%cN <%cE>' HEAD | head -n 1`

echo -n "#####ARCHIVING $PROJECT#####"
tar czf "$PROJECT-$VERSION.tar.gz" "$PROJECT"
echo -n "#####ARCHIVING centreon-collect#####"
tar czf "centreon-collect-$VERSION.tar.gz" *

echo -n "#####DELIVER $PROJECT SOURCES#####"
put_internal_source "$PROJECT" "$PROJECT-$VERSION-$RELEASE" "$PROJECT-$VERSION.tar.gz"
echo -n "#####DELIVER centreon-collect SOURCES#####"
put_internal_source "centreon-collect" "centreon-collect-$VERSION-$RELEASE" "centreon-collect-$VERSION.tar.gz"

echo -n "#####EXPORTING $PROJECT GLOBAL VARIABLES#####"
echo -n "#####EXPORTING centreon-collect GLOBAL VARIABLES#####"
cat > source.properties << EOF
PROJECT=$PROJECT
PROJECT=centreon-collect
VERSION=$VERSION
RELEASE=$RELEASE
COMMIT=$COMMIT
COMMITTER=$COMMITTER
MAJOR=$MAJOR
EOF



EOF

0 comments on commit 0a510e3

Please sign in to comment.