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

Support APK with FPM #92

Merged
merged 17 commits into from
Aug 19, 2020
Merged

Support APK with FPM #92

merged 17 commits into from
Aug 19, 2020

Conversation

v1v
Copy link
Member

@v1v v1v commented Jul 20, 2020

Enable alpine packaging support

What

  • Build/Test/Generate-SO-Package for alpine requires an alpine docker image
  • CI matrix for PHP-VERSIONS and Dockerfile/Dockerfile.alpine.
  • fpm issues for packaging alpine has been solved with the patch approach. [apk] "BAD archive" error when installing .apk built using fpm jordansissel/fpm#1227
  • tar package will contain all the so files (including the alpine ones).
  • alpine so files contain the -alpine prefix to support the packaging for tarballs.

Issues

Closes #73

Test

  • Create everything!
## testing everything for PHP_VERSION 7.2
DOCKERFILE=Dockerfile.alpine make -f .ci/Makefile build test composer
make -f .ci/Makefile build test composer

## testing everything for PHP_VERSION 7.3
PHP_VERSION=7.3 DOCKERFILE=Dockerfile.alpine make -f .ci/Makefile build test composer
PHP_VERSION=7.3 make -f .ci/Makefile build test composer

## testing everything for PHP_VERSION 7.4
PHP_VERSION=7.4 DOCKERFILE=Dockerfile.alpine make -f .ci/Makefile build test composer
PHP_VERSION=7.4 make -f .ci/Makefile build test composer

## generate package
DOCKERFILE=Dockerfile.alpine make -f .ci/Makefile build generate-for-package
make -f .ci/Makefile build generate-for-package
PHP_VERSION=7.3 DOCKERFILE=Dockerfile.alpine make -f .ci/Makefile build generate-for-package
PHP_VERSION=7.3 make -f .ci/Makefile build generate-for-package
PHP_VERSION=7.4 DOCKERFILE=Dockerfile.alpine make -f .ci/Makefile build generate-for-package
PHP_VERSION=7.4 make -f .ci/Makefile build generate-for-package
make -C packaging package

## Install testing
PHP_VERSION=7.2 make -C packaging install
PHP_VERSION=7.3 make -C packaging install
PHP_VERSION=7.4 make -C packaging install

@v1v v1v self-assigned this Jul 20, 2020
@v1v v1v added the automation label Jul 20, 2020
@apmmachine
Copy link
Contributor

apmmachine commented Jul 20, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #92 updated]

  • Start Time: 2020-08-19T11:28:14.574+0000

  • Duration: 18 min 11 sec

Test stats 🧪

Test Results
Failed 0
Passed 195
Skipped 0
Total 195

v1v added 2 commits July 23, 2020 12:41
* upstream/master:
  packaging: debian package installation with post-install (elastic#98)
  DOCS: create DEVELOPMENT.md docs (elastic#95)
  [CI] add build badge status (elastic#87)
  Docs: add help make goal and enhance the docs (elastic#93)
v1v added 9 commits July 23, 2020 16:15
* upstream/master:
  [packaging] support centOS smoke testing (elastic#99)
* upstream/master:
  Packaging tar with installing tests (elastic#103)
  Handle "service_version" as well
  Handle 'too long' case as well
  Fix "service_name option has no effect" bug
  [CI] distribution binaries stored in the PHP version folder (elastic#101)
  [CI] use packer cache and normalise docker images (elastic#102)
* 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)
@@ -6,7 +6,7 @@ HYPHEN="-"
MODULES_DIR=/app/src/ext/modules
NAME=elastic_apm
## Prepare context where to copy the previous generated so files
GENERATED=$(mktemp -d /tmp/dir-XXXX)
GENERATED=$(mktemp -d /tmp/dirXXXXXX)
Copy link
Member Author

Choose a reason for hiding this comment

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

Forced to use this template to support alpine

Comment on lines +125 to +130
unstash 'generate-for-package-7.2-Dockerfile'
unstash 'generate-for-package-7.3-Dockerfile'
unstash 'generate-for-package-7.4-Dockerfile'
unstash 'generate-for-package-7.2-Dockerfile.alpine'
unstash 'generate-for-package-7.3-Dockerfile.alpine'
unstash 'generate-for-package-7.4-Dockerfile.alpine'
Copy link
Member Author

Choose a reason for hiding this comment

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

It's not the smartest approach but it's native to the CI. So we might need to find a better way in some follow ups

.ci/Makefile Outdated
Comment on lines 3 to 7
DOCKERFILE ?= Dockerfile
SUFFIX :=
ifeq ($(DOCKERFILE), Dockerfile.alpine)
SUFFIX := alpine
endif
Copy link
Member Author

Choose a reason for hiding this comment

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

This will help to either use the default php-fpm docker image or the alpine one as long as the DOCKERFILE env variable is set

@@ -0,0 +1,42 @@
#!/usr/bin/env sh
Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored to be in a script then the so files filtering can happen easily

Comment on lines +85 to +89
## If alpine then add another suffix
if grep -q -i alpine /etc/os-release; then
SUFFIX=-alpine
fi
echo "${EXTENSION_DIR}/elastic_apm-${PHP_API}${SUFFIX}.so"
Copy link
Member Author

Choose a reason for hiding this comment

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

We could potentially skip this particular implementation if the tar.gz distribution does not contain the alpine so files.

@v1v v1v requested review from SergeyKleyman and a team August 19, 2020 10:37
@v1v v1v marked this pull request as ready for review August 19, 2020 10:37
@v1v v1v merged commit 0e513d0 into elastic:master Aug 19, 2020
@v1v v1v deleted the feature/support-apk branch August 19, 2020 11:49
v1v added a commit to v1v/apm-agent-php that referenced this pull request Aug 19, 2020
…utomation-tag-based

* upstream/master:
  Support APK with FPM (elastic#92)
  Add ENVIRONMENT configuration option
  Change composer installation in docker (elastic#128)
  Add tests/APM_Agents_shared directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package Agent as .apk for Alpine Linux distro
4 participants