Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/packages-…
Browse files Browse the repository at this point in the history
…php-version-pipeline

* upstream/master:
  [packaging] support centOS smoke testing (elastic#99)
  • Loading branch information
v1v committed Jul 23, 2020
2 parents 3e9bd1c + 345964c commit f8a52c7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pipeline {
dir("${BASE_DIR}"){
sh script: "PHP_VERSION=${PHP_VERSION} make -C packaging package", label: 'package'
sh script: "PHP_VERSION=${PHP_VERSION} make -C packaging info", label: 'package info'
sh script: "PHP_VERSION=${PHP_VERSION} make -C packaging deb-install", label: 'package deb-install'
sh script: "PHP_VERSION=${PHP_VERSION} make -C packaging install", label: 'package install'
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions packaging/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ create-%: prepare ## Create the specific package

.PHONY: rpm
rpm: create-rpm ## Create the rpm installer
## TODO: fpm replaces - with _ in the version

.PHONY: deb
deb: create-deb ## Create the deb installer
Expand Down Expand Up @@ -81,11 +80,17 @@ deb-info: ## Show the deb package metadata

.PHONY: rpm-install
rpm-install: ## Install the rpm installer to run some smoke tests
echo 'TBD'
@cd $(PWD)/packaging/test/centos ;\
docker build --build-arg PHP_VERSION=$(PHP_VERSION) -t rpm-install . ;\
cd -
docker run --rm -v $(PWD):/src -w /src rpm-install

.PHONY: deb-install
deb-install: ## Install the deb installer to run some smoke tests
@cd $(PWD)/packaging/test/ubuntu ;\
docker build --build-arg PHP_VERSION=$(PHP_VERSION) -t deb-install . ;\
cd -
@docker run --rm -v $(PWD):/src -w /src deb-install

.PHONY: install
install: deb-install rpm-install ## Install all the distributions
17 changes: 17 additions & 0 deletions packaging/test/centos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM centos:centos7
ARG PHP_VERSION=7.2
ENV PHP_VERSION ${PHP_VERSION}
## Package versioning for the PHP does not use .
RUN export PHP_VERSION_TRANSFORMED=$(echo "${PHP_VERSION}" | sed 's#\.##g') \
&& yum install -y epel-release yum-utils \
&& rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm \
&& yum update -y \
&& yum-config-manager --enable remi-php${PHP_VERSION_TRANSFORMED} \
&& yum install -y php php-mbstring php-mysql php-xml

RUN curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/bin/composer

COPY entrypoint.sh /bin
WORKDIR /src

ENTRYPOINT ["/bin/entrypoint.sh"]
15 changes: 15 additions & 0 deletions packaging/test/centos/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -xe

## Install rpm package and configure the agent accordingly
rpm -ivh build/packages/*.rpm

## Verify if the elastic php agent is enabled
if ! php -m | grep -q 'elastic' ; then
echo 'Extension has not been installed.'
exit 1
fi

## Validate the installation works as expected with composer
composer install
composer run-script run_component_tests_standalone_envs

0 comments on commit f8a52c7

Please sign in to comment.