Commit 45ff185c authored by François Grisez's avatar François Grisez

Gitlab-ci: improve deploy script in order to store stable alpha and beta...

Gitlab-ci: improve deploy script in order to store stable alpha and beta package in distinct repositories
parent 4ca26240
Pipeline #9735 passed with stages
in 28 minutes and 12 seconds
#!/bin/bash
if [ $# -ne 1 ]; then
prog=$(basename $0)
echo "syntax: $prog <dist>" 1>&2
exit 2
fi
id=$(cat /dev/urandom | tr -dc '[:alnum:]' | fold -w 10 | head -n 1)
tmpdir="$MAKE_REPO_TMP/tmp-$id"
rsync_dest="$DEPLOY_SERVER:$tmpdir/"
dist=$1
case "$dist" in
'centos')
make_repo_args="rpm $tmpdir $CENTOS_REPOSITORY"
rsync_src='WORK/flexisip-rpm/rpmbuild/RPMS/x86_64/'
legacy_repo_cmd="cp -v --link --no-clobber --preserve=timestamp $tmpdir/* $CENTOS7_DEPLOY_DIRECTORY && createrepo_c --update $CENTOS7_DEPLOY_DIRECTORY"
;;
'debian')
make_repo_args="deb $tmpdir $FREIGHT_PATH $RELEASE"
echo "make_repo_args=$make_repo_args"
rsync_src='WORK/flexisip-rpm/rpmbuild/DEBS/'
legacy_repo_cmd="freight add --conf=$FREIGHT_PATH $tmpdir/*.deb apt/$RELEASE && freight cache $freight_opts apt/$RELEASE"
;;
*)
echo "invalid distribution type: '$dist'. Only 'centos' and 'debian' are valid" 1>&2
exit 2
;;
esac
echo ">>> Pushing packages into '$rsync_dest'"
rsync -rv $rsync_src $rsync_dest
echo ">>> Connecting on '$DEPLOY_SERVER'"
ssh $DEPLOY_SERVER "
echo '>>>> Making repository'
make_repo $make_repo_args || exit 1
echo '>>>> Making legacy repository'
$legacy_repo_cmd || exit 1
echo \">>>> Removing '$tmpdir'\"
rm -r $tmpdir
"
......@@ -79,6 +79,4 @@ job-centos7-rpm-deploy:
except:
variables:
- $DEPLOY_UBUNTU
script:
- cd WORK/flexisip-rpm/rpmbuild/RPMS/x86_64/ && rsync -pr . $DEPLOY_SERVER:$CENTOS7_DEPLOY_DIRECTORY
- ssh $DEPLOY_SERVER "chmod a+r $CENTOS7_DEPLOY_DIRECTORY/*.rpm && createrepo_c --update $CENTOS7_DEPLOY_DIRECTORY/."
script: ./.gitlab-ci-files/deploy.sh centos
......@@ -23,9 +23,9 @@ job-debian8-makefile-clang:
tags: [ "docker-debian8" ]
image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-debian:8
except:
variables:
- $DEPLOY_RUN
- $DEPLOY_UBUNTU
variables:
- $DEPLOY_RUN
- $DEPLOY_UBUNTU
variables:
CMAKE_GENERATOR: Unix Makefiles
CC: clang
......@@ -58,6 +58,7 @@ job-debian8-ninja-clang:
image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-debian:8
except:
variables:
- $DEPLOY_RUN
- $DEPLOY_UBUNTU
variables:
CMAKE_GENERATOR: Ninja
......@@ -86,9 +87,7 @@ job-debian8-deb-deploy:
- $DEPLOY_UBUNTU
variables:
RELEASE: jessie
DEPLOY_DIRECTORY: $DEBIAN_DEPLOY_DIRECTORY
FREIGHT_PATH: $DEBIAN_FREIGHT_CONF_PATH
DEPLOY_SERVER: $NEW_DEPLOY_SERVER
extends: .job-debian-deb-deploy
dependencies:
- job-debian8-deb
......@@ -58,6 +58,7 @@ job-debian9-ninja-clang:
image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-debian:9
except:
variables:
- $DEPLOY_RUN
- $DEPLOY_UBUNTU
variables:
CMAKE_GENERATOR: Ninja
......@@ -86,9 +87,7 @@ job-debian9-deb-deploy:
- $DEPLOY_UBUNTU
variables:
RELEASE: stretch
DEPLOY_DIRECTORY: $DEBIAN_DEPLOY_DIRECTORY
FREIGHT_PATH: $DEBIAN_FREIGHT_CONF_PATH
DEPLOY_SERVER: $NEW_DEPLOY_SERVER
extends: .job-debian-deb-deploy
dependencies:
- job-debian9-deb
......
......@@ -6,6 +6,10 @@ job-ubuntu-18.04-makefile-gcc:
tags: [ "docker-ubuntu-18.04" ]
image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-ubuntu:18.04
except:
variables:
- $DEPLOY_RUN
- $DEPLOY_UBUNTU
variables:
CMAKE_GENERATOR: Unix Makefiles
CC: gcc
......@@ -80,9 +84,7 @@ job-ubuntu-18.04-deb-deploy:
variables:
RELEASE: bionic
DEPLOY_DIRECTORY: $UBUNTU_DEPLOY_DIRECTORY
FREIGHT_PATH: $UBUNTU_FREIGHT_CONF_PATH
DEPLOY_SERVER: $NEW_DEPLOY_SERVER
extends: .job-debian-deb-deploy
dependencies:
- job-ubuntu-18.04-deb
......@@ -41,6 +41,10 @@ job-ubuntu-rolling-ninja-gcc:
tags: [ "docker-ubuntu-rolling" ]
image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-ubuntu:rolling
except:
variables:
- $DEPLOY_RUN
- $DEPLOY_UBUNTU
variables:
CMAKE_GENERATOR: Ninja
CC: gcc
......
......@@ -81,9 +81,7 @@
extends: .job-deploy
script:
- cd WORK/flexisip-rpm/rpmbuild/DEBS/ && rsync -pr . $DEPLOY_SERVER:$DEPLOY_DIRECTORY/$RELEASE
- ssh $DEPLOY_SERVER "cd $DEPLOY_DIRECTORY/$RELEASE && freight add --conf=$FREIGHT_PATH *.deb apt/$RELEASE && freight cache --conf=$FREIGHT_PATH apt/$RELEASE"
script: ./.gitlab-ci-files/deploy.sh debian
#################################################
# DOCKER
......
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