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)

This commit is contained in:
Peio Rigaux 2021-10-12 17:23:37 +02:00 committed by Timothée Jaussoin
parent 68aab1d130
commit 68e3d6536b
4 changed files with 67 additions and 23 deletions

View file

@ -6,10 +6,8 @@ stages:
- deploy - deploy
- test - test
centos7-rpm: .rpm:
tags: [ "docker" ]
tags: [ "docker-centos7" ]
image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-centos7-php
stage: package stage: package
script: script:
@ -24,10 +22,20 @@ centos7-rpm:
paths: paths:
- flexiapi/vendor/ - 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" ] tags: [ "docker-centos7" ]
image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-centos7-php image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-centos7-php
dependencies:
- centos7-rpm
stage: test stage: test
script: script:
@ -43,34 +51,35 @@ centos7-rpm-test:
expire_in: 1 day expire_in: 1 day
.package-deploy: .package-deploy:
before_script: before_script:
- if ! [ -z ${SCP_PRIVATE_KEY+x} ]; then eval $(ssh-agent -s); fi - 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 - 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: only:
refs: refs:
- master - master
changes: changes:
- flexisip-account-manager.spec - flexisip-account-manager.spec
stage: deploy extends:
- .package-deploy
.centos7-rpm-deploy: .centos7-rpm-deploy:
extends: .rpm-deploy
extends: .package-deploy
tags: [ "docker-centos7" ] tags: [ "docker-centos7" ]
dependencies: dependencies:
- centos7-rpm - 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: centos7-rpm-deploy-stable:
@ -85,8 +94,23 @@ centos7-rpm-deploy-alpha:
CENTOS7_DEPLOY_DIRECTORY_STATE: $CENTOS7_DEPLOY_DIRECTORY_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" ] tags: [ "docker" ]
image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-debian11-php:20220413_flexiapi_packaging image: gitlab.linphone.org:4567/bc/public/linphone-sdk/bc-dev-debian11-php:20220413_flexiapi_packaging

View file

@ -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

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir} #%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc #%define _docdir %{_datadir}/doc
%define build_number 140 %define build_number 141
%define var_dir /var/opt/belledonne-communications %define var_dir /var/opt/belledonne-communications
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager %define opt_dir /opt/belledonne-communications/share/flexisip-account-manager
@ -27,6 +27,7 @@
%if %{with deb} %if %{with deb}
%define web_user www-data %define web_user www-data
%define apache_conf_path /etc/apache2/conf-available
%else %else
%define web_user apache %define web_user apache
%endif %endif
@ -44,7 +45,18 @@ Source0: flexisip-account-manager.tar.gz
#BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot #BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
# dependencies # 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 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 %description
PHP server for Linphone and Flexisip providing module for account creation. 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/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} %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/" cp cron/flexiapi.debian "$RPM_BUILD_ROOT/etc/cron.daily/"
chmod +x "$RPM_BUILD_ROOT/etc/cron.daily/flexiapi.debian" chmod +x "$RPM_BUILD_ROOT/etc/cron.daily/flexiapi.debian"
%else %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/" cp cron/flexiapi.redhat "$RPM_BUILD_ROOT/etc/cron.daily/"
chmod +x "$RPM_BUILD_ROOT/etc/cron.daily/flexiapi.redhat" chmod +x "$RPM_BUILD_ROOT/etc/cron.daily/flexiapi.redhat"
%endif %endif
@ -172,11 +183,10 @@ fi
%config(noreplace) /etc/flexisip-account-manager/*.conf %config(noreplace) /etc/flexisip-account-manager/*.conf
%config(noreplace) %{apache_conf_path}/flexisip-account-manager.conf
%if %{with deb} %if %{with deb}
%config(noreplace) /etc/apache2/conf-available/flexisip-account-manager.conf
%config(noreplace) /etc/cron.daily/flexiapi.debian %config(noreplace) /etc/cron.daily/flexiapi.debian
%else %else
%config(noreplace) /opt/rh/httpd24/root/etc/httpd/conf.d/flexisip-account-manager.conf
%config(noreplace) /etc/cron.daily/flexiapi.redhat %config(noreplace) /etc/cron.daily/flexiapi.redhat
%endif %endif
@ -184,6 +194,8 @@ fi
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%changelog %changelog
* Tue Oct 12 2021 Peio Rigaux <peio.rigaux@belledonne-communications.com>
- Adapted specfile to support Rocky Linux 8
* Tue Sep 28 2021 Timothée Jaussoin <timothee.jaussoin@belledonne-communications.com> * Tue Sep 28 2021 Timothée Jaussoin <timothee.jaussoin@belledonne-communications.com>
- Install cron scripts - Install cron scripts
* Sun Jan 5 2020 Timothée Jaussoin <timothee.jaussoin@belledonne-communications.com> * Sun Jan 5 2020 Timothée Jaussoin <timothee.jaussoin@belledonne-communications.com>