From 68e3d6536ba166dd3db5515695ef8690574dae89 Mon Sep 17 00:00:00 2001 From: Peio Rigaux Date: Tue, 12 Oct 2021 17:23:37 +0200 Subject: [PATCH] Added conditionnal in spec files to declare dependencies based on the rhel version. Added temp dockerfile for rocky (to be added in sdk repository to be reused) --- .gitlab-ci.yml | 56 +++++++++++++------ ...image.docker => bc-dev-centos7-php.docker} | 0 docker/bc-dev-rocky8-php.docker | 8 +++ flexisip-account-manager.spec | 26 ++++++--- 4 files changed, 67 insertions(+), 23 deletions(-) rename docker/{build-image.docker => bc-dev-centos7-php.docker} (100%) create mode 100644 docker/bc-dev-rocky8-php.docker diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9b2ebef..0f8366b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,10 +6,8 @@ stages: - deploy - test -centos7-rpm: - - tags: [ "docker-centos7" ] - image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-centos7-php +.rpm: + tags: [ "docker" ] stage: package script: @@ -24,10 +22,20 @@ centos7-rpm: paths: - flexiapi/vendor/ -centos7-rpm-test: +centos7-rpm: + extends: .rpm + image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-centos7-php + +rocky8-rpm: + extends: .rpm + image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-rocky8-php + +centos7-rpm-test: tags: [ "docker-centos7" ] image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-centos7-php + dependencies: + - centos7-rpm stage: test script: @@ -43,34 +51,35 @@ centos7-rpm-test: expire_in: 1 day .package-deploy: - before_script: - if ! [ -z ${SCP_PRIVATE_KEY+x} ]; then eval $(ssh-agent -s); fi - if ! [ -z ${SCP_PRIVATE_KEY+x} ]; then echo "$SCP_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null; fi + stage: deploy +.rpm-deploy: + + script: + - cd rpmbuild/x86_64 + - rsync -e "ssh -o StrictHostKeyChecking=no" -pr . $DEPLOY_SERVER:$DEPLOY_DIRECTORY_STATE; + ssh $DEPLOY_SERVER "chmod a+r $DEPLOY_DIRECTORY_STATE/*.rpm && createrepo_c --update $DEPLOY_DIRECTORY_STATE/."; only: refs: - master changes: - flexisip-account-manager.spec - stage: deploy - + extends: + - .package-deploy .centos7-rpm-deploy: - - extends: .package-deploy + extends: .rpm-deploy tags: [ "docker-centos7" ] - dependencies: - centos7-rpm - script: - - cd rpmbuild/x86_64 - - rsync -e "ssh -o StrictHostKeyChecking=no" -pr . $DEPLOY_SERVER:$CENTOS7_DEPLOY_DIRECTORY_STATE; - ssh $DEPLOY_SERVER "chmod a+r $CENTOS7_DEPLOY_DIRECTORY_STATE/*.rpm && createrepo_c --update $CENTOS7_DEPLOY_DIRECTORY_STATE/."; + centos7-rpm-deploy-stable: @@ -85,8 +94,23 @@ centos7-rpm-deploy-alpha: CENTOS7_DEPLOY_DIRECTORY_STATE: $CENTOS7_DEPLOY_DIRECTORY_ALPHA -debian11-packaging: +.rocky8-rpm-deploy: + extends: .rpm-deploy + tags: [ "docker" ] + dependencies: + - rocky8-rpm +# rocky8-rpm-deploy-stable: +# extends: .rocky8-rpm-deploy +# variables: +# DEPLOY_DIRECTORY_STATE: $CENTOS8_DEPLOY_DIRECTORY_STABLE + +rocky8-rpm-deploy-alpha: + extends: .rocky8-rpm-deploy + variables: + DEPLOY_DIRECTORY_STATE: $CENTOS8_DEPLOY_DIRECTORY_ALPHA + +debian11-packaging: tags: [ "docker" ] image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-debian11-php:20220413_flexiapi_packaging diff --git a/docker/build-image.docker b/docker/bc-dev-centos7-php.docker similarity index 100% rename from docker/build-image.docker rename to docker/bc-dev-centos7-php.docker diff --git a/docker/bc-dev-rocky8-php.docker b/docker/bc-dev-rocky8-php.docker new file mode 100644 index 0000000..b3f049c --- /dev/null +++ b/docker/bc-dev-rocky8-php.docker @@ -0,0 +1,8 @@ +FROM gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-centos8:20210217_python3 +USER root + +# Install dependencies + +RUN yum -y install @php:7.3 php-mbstring +RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer +RUN mkdir -p /usr/local/bin diff --git a/flexisip-account-manager.spec b/flexisip-account-manager.spec index 904ea3e..c3a9a99 100644 --- a/flexisip-account-manager.spec +++ b/flexisip-account-manager.spec @@ -8,7 +8,7 @@ #%define _datadir %{_datarootdir} #%define _docdir %{_datadir}/doc -%define build_number 140 +%define build_number 141 %define var_dir /var/opt/belledonne-communications %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager @@ -27,6 +27,7 @@ %if %{with deb} %define web_user www-data + %define apache_conf_path /etc/apache2/conf-available %else %define web_user apache %endif @@ -44,7 +45,18 @@ Source0: flexisip-account-manager.tar.gz #BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot # dependencies + +#These are not indented because rpm cannot recognize "Requires" with spaces/tabs (???) + +%if "%{?dist}" == ".el7" Requires: rh-php73-php rh-php73-php-gd rh-php73-php-xmlrpc rh-php73-php-pdo rh-php73-php-mysqlnd rh-php73-php-mbstring +%define apache_conf_path /opt/rh/httpd24/root/etc/httpd/conf.d +%endif + +%if "%{?dist}" == ".el8" +Requires: php php-gd php-xmlrpc php-pdo php-mysqlnd php-mbstring +%define apache_conf_path /etc/httpd/conf.d +%endif %description PHP server for Linphone and Flexisip providing module for account creation. @@ -66,14 +78,13 @@ cp -R conf/* "$RPM_BUILD_ROOT/etc/flexisip-account-manager/" mkdir -p $RPM_BUILD_ROOT/etc/cron.daily +mkdir -p $RPM_BUILD_ROOT%{apache_conf_path} +cp httpd/flexisip-account-manager.conf "$RPM_BUILD_ROOT%{apache_conf_path}/" + %if %{with deb} - mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf-available - cp httpd/flexisip-account-manager.conf "$RPM_BUILD_ROOT/etc/apache2/conf-available/" cp cron/flexiapi.debian "$RPM_BUILD_ROOT/etc/cron.daily/" chmod +x "$RPM_BUILD_ROOT/etc/cron.daily/flexiapi.debian" %else - mkdir -p $RPM_BUILD_ROOT/opt/rh/httpd24/root/etc/httpd/conf.d - cp httpd/flexisip-account-manager.conf "$RPM_BUILD_ROOT/opt/rh/httpd24/root/etc/httpd/conf.d/" cp cron/flexiapi.redhat "$RPM_BUILD_ROOT/etc/cron.daily/" chmod +x "$RPM_BUILD_ROOT/etc/cron.daily/flexiapi.redhat" %endif @@ -172,11 +183,10 @@ fi %config(noreplace) /etc/flexisip-account-manager/*.conf +%config(noreplace) %{apache_conf_path}/flexisip-account-manager.conf %if %{with deb} - %config(noreplace) /etc/apache2/conf-available/flexisip-account-manager.conf %config(noreplace) /etc/cron.daily/flexiapi.debian %else - %config(noreplace) /opt/rh/httpd24/root/etc/httpd/conf.d/flexisip-account-manager.conf %config(noreplace) /etc/cron.daily/flexiapi.redhat %endif @@ -184,6 +194,8 @@ fi rm -rf $RPM_BUILD_ROOT %changelog +* Tue Oct 12 2021 Peio Rigaux +- Adapted specfile to support Rocky Linux 8 * Tue Sep 28 2021 Timothée Jaussoin - Install cron scripts * Sun Jan 5 2020 Timothée Jaussoin