Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[packaging] support multiple PHP API #121

Merged
merged 14 commits into from Aug 12, 2020

Conversation

v1v
Copy link
Member

@v1v v1v commented Aug 11, 2020

What

  • Package the supported so files in one single package.
  • install make goal has been deleted since it's already done when running make -C packaging deb-install
  • clean make goal to tear down the generated packages folder.
  • CI Pipeline split in three major steps:
      1. Build/Test each supported PHP version (7.2, 7.3, 7.4)
      1. Then, create the distribution for all the above PHP versions
      1. Run the package testing for all the above PHP versions.
  • Install required dependencies when running composer install in the docker containers.

Tasks

  • Configure the post-install.sh to detect the PHP API to be configured.

Issues

Closes #113
Closes #114

Tests

How to test it locally?

PHP_VERSION=7.2 make -f .ci/Makefile generate-for-package
PHP_VERSION=7.3 make -f .ci/Makefile generate-for-package
PHP_VERSION=7.4 make -f .ci/Makefile generate-for-package
make -C packaging clean package
PHP_VERSION=7.2 make -C packaging install 
PHP_VERSION=7.3 make -C packaging install 
PHP_VERSION=7.4 make -C packaging install 
  • Validate the installation
$ make -C packaging info 
....

[2020-08-11T15:46:46.341Z]  Description: PHP agent for Elastic APM\nGit Commit: 0cd74c0678ca4ecd43fd71ee37a5a24e73719fd4
...
[2020-08-11T15:46:47.290Z] drwxr-xr-x 0/0               0 2020-08-11 15:46 ./opt/elastic/apm-agent-php/extensions/
[2020-08-11T15:46:47.290Z] -rwxr-xr-x 0/0         3029336 2020-08-11 15:44 ./opt/elastic/apm-agent-php/extensions/elastic_apm-20170718.so
[2020-08-11T15:46:47.290Z] -rwxr-xr-x 0/0         3028496 2020-08-11 15:44 ./opt/elastic/apm-agent-php/extensions/elastic_apm-20180731.so
[2020-08-11T15:46:47.290Z] -rwxr-xr-x 0/0         3033968 2020-08-11 15:44 ./opt/elastic/apm-agent-php/extensions/elastic_apm-20190902.so
...
  • Validate install runs with the right so file
$ PHP_VERSION=7.2 make -C packaging install 
...

[2020-08-11T15:51:59.792Z] ; THIS IS AN AUTO-GENERATED FILE by the Elastic PHP agent post-install.sh script
[2020-08-11T15:51:59.792Z] extension=/opt/elastic/apm-agent-php/extensions/elastic_apm-20170718.so
[2020-08-11T15:51:59.792Z] elastic_apm.bootstrap_php_part_file=/opt/elastic/apm-agent-php/src/bootstrap_php_part.php
[2020-08-11T15:51:59.792Z] ; END OF AUTO-GENERATED
...
[2020-08-11T15:52:00.054Z] + composer run-script run_component_tests_standalone_envs
[2020-08-11T15:52:00.315Z] > ELASTIC_APM_TESTS_APP_CODE_HOST_KIND=CLI_script phpunit -c phpunit_component_tests.xml
[2020-08-11T15:52:00.577Z] PHPUnit 8.5.8 by Sebastian Bergmann and contributors.
[2020-08-11T15:52:00.577Z] 
[2020-08-11T15:52:00.577Z] Runtime:       PHP 7.2.33
  • Artifacts

image

Improvements

  • PHP Version list to be defined once. No yet supported with the matrix approach

@v1v v1v self-assigned this Aug 11, 2020
@v1v v1v added the automation label Aug 11, 2020
@v1v v1v force-pushed the feature/support-multiple-versions branch from 86b26c2 to 34870cb Compare August 11, 2020 13:00
@v1v v1v force-pushed the feature/support-multiple-versions branch from 34870cb to 9230888 Compare August 11, 2020 13:20
.ci/Jenkinsfile Outdated
Comment on lines 117 to 119
unstash 'generate-7.2'
unstash 'generate-7.3'
unstash 'generate-7.4'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say this is not ideal, although we could potentially use something else to simplify where the generated so files are stored

@apmmachine
Copy link
Collaborator

apmmachine commented Aug 11, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #121 updated]

  • Start Time: 2020-08-12T10:46:46.002+0000

  • Duration: 13 min 28 sec

Test stats 🧪

Test Results
Failed 0
Passed 108
Skipped 0
Total 108

@v1v v1v force-pushed the feature/support-multiple-versions branch from 01d82fa to 101901c Compare August 11, 2020 13:42
@v1v v1v added the enhancement New feature or request label Aug 11, 2020
@v1v v1v marked this pull request as ready for review August 11, 2020 14:46
@v1v v1v requested review from SergeyKleyman and a team August 11, 2020 14:46
RUN apt-get -qq update \
&& apt-get -qq install -y procps --no-install-recommends \
&& apt-get -qq install -y git procps zlib1g-dev libzip-dev unzip --no-install-recommends \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required dependencies when running composer install without any cached dependencies

Comment on lines +13 to +17
## sh: git: command not found
# the zip extension and unzip command are both missing, skipping.
RUN yum update -y \
&& yum install -y git unzip \
&& yum clean all
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@v1v v1v merged commit c4daf94 into elastic:master Aug 12, 2020
@v1v v1v deleted the feature/support-multiple-versions branch August 12, 2020 11:29
v1v added a commit to v1v/apm-agent-php that referenced this pull request Aug 18, 2020
* upstream/master:
  Add ENVIRONMENT configuration option
  Change composer installation in docker (elastic#128)
  Add tests/APM_Agents_shared directory
  [packaging] support multiple PHP API (elastic#121)
  [Packaging] restore php.ini if something bad happened (elastic#116)
  [CI] Cosmetic changes in the stage names (elastic#115)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation enhancement New feature or request
Projects
None yet
3 participants