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

Release 10.7 #628

Merged
merged 7 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/agent-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ on:
push:
branches:
- main
- 'php8'
- 'dev'
pull_request:
branches:
- main
- 'php8'
- 'dev'

jobs:
Expand All @@ -38,7 +36,7 @@ jobs:
strategy:
matrix:
os: [linux]
php_ver: ['7.0', '7.1-zts', '7.2', '7.3', '7.4', '8.0', '8.0-zts', '8.1', '8.1-zts']
php_ver: ['7.0', '7.1-zts', '7.2', '7.3', '7.4', '8.0', '8.0-zts', '8.1', '8.1-zts', '8.2']
arch: ['x64', 'x86']
exclude:
# Excludes PHP 5.x, 7.x on linux 32-bit
Expand Down Expand Up @@ -70,6 +68,9 @@ jobs:
- os: linux
php_ver: '8.1-zts'
arch: 'x86'
- os: linux
php_ver: '8.2'
arch: 'x86'
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down
64 changes: 28 additions & 36 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,45 @@ on:
# Run this workflow manually from the Actions tab or using the API
#
workflow_dispatch:
inputs:
build-number:
description: 'Build number for agent version'
required: true
type: string

jobs:
agent_release:
env:
PHP_VER: ${{ matrix.php_ver }}
ARCH: ${{ matrix.arch }}
BUILD_TYPE: release
OS: ${{ matrix.os }}
image_name: ${{ matrix.os }}:${{ matrix.php_ver }}${{ matrix.arch }}
IMAGE_NAME: newrelic/nr-php-agent-builder
IMAGE_VERSION: v1
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux]
php_ver: ['8.0-zts']
arch: [x64, x86]
platform: [gnu, musl]
php_ver: ['8.2']
arch: [amd64]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.ref }}
- name: Build Custom Docker Image
run: docker build --build-arg ARCH=$ARCH --build-arg PHP_VER=$PHP_VER --build-arg BUILD_TYPE=$BUILD_TYPE -f ./.github/docker/${OS}/${ARCH}/Dockerfile -t $image_name .
- name: Build and Test
run: docker run --name runtest --workdir /github/workspace --rm -e GITHUB_WORKSPACE -e GITHUB_ENV -v "${GITHUB_WORKSPACE}":"/github/workspace" $image_name
- name: Save build artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.php_ver }}binaries
path: releases
if-no-files-found: error
combine:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Combine artifacts from matrix build
needs: agent_release
steps:
- name: Create directory
run: mkdir releases
- name: Download to directory
uses: actions/download-artifact@v2
path: newrelic-php-agent
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
path: releases
- run: sudo apt install tree
- run: tree
- name: Upload artifacts
uses: actions/upload-artifact@v2
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
run: >
docker run --rm --platform linux/${{matrix.arch}}
-v "${GITHUB_WORKSPACE}/newrelic-php-agent":"/usr/local/src/newrelic-php-agent"
-e OPTIMIZE=1
-e PCRE_STATIC=yes
-e BUILD_NUMBER=${{inputs.build-number}}
$IMAGE_NAME:agent-builder-php${{matrix.php_ver}}-${{matrix.platform}}-$IMAGE_VERSION release-${{matrix.php_ver}}-gha
- name: Save build artifacts
uses: actions/upload-artifact@v3
with:
name: $GITHUB_SHA
path: releases
path: newrelic-php-agent/releases
name: release-from-gha
if-no-files-found: error
37 changes: 28 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ GIT ?= git
include make/config.mk
include make/vendor.mk
include make/version.mk
include make/php_versions.mk

# Include the secrets file if it exists, but if it doesn't, that's OK too.
-include make/secrets.mk
Expand Down Expand Up @@ -108,6 +109,18 @@ echo_config:
@echo GIT_COMMIT=$(GIT_COMMIT)

#
# Print information where do the build dependencies come from
#
.PHONY: show-vendors
show-vendors:
@echo ""
@echo -----------------------------------------------------------------------
@echo "| Using pcre library from $(PCRE_PREFIX) (from $(origin PCRE_PREFIX))"
@echo -n "| Link to "; [ $(PCRE_STATIC) = yes ] && echo -n "static" || echo -n "shared"; echo " libpcre";
@echo "| Using protobuf-c library from $(PROTOBUF_C_PREFIX) (from $(origin PROTOBUF_C_PREFIX))"
@echo -----------------------------------------------------------------------
@echo ""
#
# Let's build an agent! Building an agent is a three step process: using phpize
# to build a configure script, using configure to build a Makefile, and then
# actually using that Makefile to build the agent extension.
Expand All @@ -116,14 +129,14 @@ PHPIZE := phpize
PHP_CONFIG := php-config

.PHONY: agent
agent: agent/Makefile
agent: show-vendors agent/Makefile
$(MAKE) -C agent

agent/configure: agent/config.m4 agent/Makefile.frag
cd agent; $(PHPIZE) --clean && $(PHPIZE)

agent/Makefile: agent/configure | axiom
cd agent; ./configure $(SILENT) --enable-newrelic --with-axiom=$(realpath axiom) --with-php-config=$(PHP_CONFIG)
cd agent; ./configure $(SILENT) --enable-newrelic --with-axiom=$(realpath axiom) --with-php-config=$(PHP_CONFIG) --with-protobuf-c=$(PROTOBUF_C_PREFIX) --with-pcre=$(PCRE_PREFIX) --with-pcre-static=$(PCRE_STATIC)

#
# Installs the agent into the extension directory of the appropriate PHP
Expand Down Expand Up @@ -305,7 +318,7 @@ daemon-protobuf: src/newrelic/infinite_tracing/com_newrelic_trace_v1/v1.pb.go
src/newrelic/infinite_tracing/com_newrelic_trace_v1/v1.pb.go: protocol/infinite_tracing/v1.proto
$(MAKE) vendor # Only build vendor stuff if v1.proto has changed. Otherwise
# this rule will be triggered every time the daemon is built.
$(VENDOR_BASE)/local/bin/protoc \
$(VENDOR_PREFIX)/bin/protoc \
-I=./protocol/infinite_tracing \
--go_out="paths=source_relative,plugins=grpc:src/newrelic/infinite_tracing/com_newrelic_trace_v1" \
protocol/infinite_tracing/v1.proto
Expand All @@ -316,7 +329,7 @@ src/newrelic/infinite_tracing/com_newrelic_trace_v1/v1.pb.go: protocol/infinite_

.PHONY: integration
integration: Makefile daemon lasp-test-all integration-events-limits
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
for PHP in $(PHP_VERSION_LIST); do \
echo; echo "# PHP=$${PHP}"; \
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) || exit 1; \
echo "# PHP=$${PHP}"; \
Expand All @@ -342,7 +355,7 @@ integration-events-limits: daemon
custom_limits_tests[7000]=583; \
custom_limits_tests[30000]=2500; \
custom_limits_tests[100000]=8333; \
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
for PHP in $(PHP_VERSION_LIST); do \
echo; echo "# PHP=$${PHP}"; \
for custom_max in "$${!custom_limits_tests[@]}"; do \
collector_limit=$${custom_limits_tests[$$custom_max]}; \
Expand All @@ -355,7 +368,7 @@ integration-events-limits: daemon

# test for invalid value (-1) and (1000000)
# Should use default (30000) for -1 and max (100000) for 1000000
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
for PHP in $(PHP_VERSION_LIST); do \
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) \
-max_custom_events 100000 \
tests/event_limits/custom/test_custom_events_max_samples_stored_invalid_toolarge_limit.php || exit 1; \
Expand All @@ -367,7 +380,7 @@ integration-events-limits: daemon

# also run a test where limit is set to 0
# default value is used
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
for PHP in $(PHP_VERSION_LIST); do \
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) \
-max_custom_events 0 \
tests/event_limits/custom/test_custom_events_max_samples_stored_0_limit.php || exit 1; \
Expand All @@ -376,7 +389,7 @@ integration-events-limits: daemon

# also run a test where no agent custom event limit is specified and verify
# default value is used
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
for PHP in $(PHP_VERSION_LIST); do \
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) \
-max_custom_events 30000 \
tests/event_limits/custom/test_custom_events_max_samples_stored_not_specified.php || exit 1; \
Expand Down Expand Up @@ -442,7 +455,7 @@ lasp-test: daemon
if [ ! $(SUITE_LASP) ]; then echo "USAGE: make lasp-test SUITE_LASP=suite-most-secure"; exit 1; fi
@if [ "$(LICENSE_lasp_$(subst -,_,$(SUITE_LASP)))" = "" ] ; then echo "Missing license for $(SUITE_LASP)"; exit 1; fi
if [ ! -d "tests/lasp/$(SUITE_LASP)" ]; then echo "No such suite in tests/lasp folder"; exit 1; fi
@for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
@for PHP in $(PHP_VERSION_LIST); do \
echo; echo "# PHP=$${PHP}"; \
NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) -loglevel debug \
-license $(LICENSE_lasp_$(subst -,_,$(SUITE_LASP))) \
Expand All @@ -467,11 +480,17 @@ lasp-test-all:
export GIT

.PHONY: vendor vendor-clean
ifeq (0,$(HAVE_PROTOBUF_C))
vendor:
$(MAKE) -C vendor all

vendor-clean:
$(MAKE) -C vendor clean
else
vendor: ;

vendor-clean: ;
endif

#
# Extras
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.6.0
10.7.0
40 changes: 33 additions & 7 deletions agent/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@ dnl file, as built by running "make" in the axiom directory.
PHP_ARG_WITH(axiom,,
[ --with-axiom=DIR Path to axiom], ../axiom, no)

dnl The path to protobuf-c. The default is to look for a local vendored
dnl The path to libprotobuf-c.a. The default is to look for a local vendored
dnl install, as built by running "make" at the level above this.
PHP_ARG_WITH(protobuf-c,,
[ --with-protobuf-c=DIR Path to protobuf-c], ../vendor/local, no)

dnl The path to libpcre.a. The default is to look for a php-build-scripts
dnl install in /opt/nr/pcre/8.40 local vendored as built by running
dnl "./make.sh pcre" from top level directory of php-build-scripts.
PHP_ARG_WITH(pcre,,
[ --with-pcre=DIR Path to pcre], /opt/nr/pcre/8.40, no)

PHP_ARG_WITH(pcre-static,,
[ --with-pcre-static=no link to static pcre], no, no)

if test "$PHP_NEWRELIC" = "yes"; then
AC_DEFINE(HAVE_NEWRELIC, 1, [Whether you have New Relic])

Expand Down Expand Up @@ -95,14 +104,31 @@ if test "$PHP_NEWRELIC" = "yes"; then
AC_MSG_ERROR([unknown or unsupported system])
fi

dnl Our one external dependency is libpcre, which axiom needs. We'll use
dnl pcre-config to find it, since every modern version of PCRE provides it.
PCRE_INCLINE=`pcre-config --cflags`
if pcre-config --prefix | grep -q /opt/nr/camp; then
dnl Check for libpcre - an external dependency, which axiom needs. Use
dnl install location provided via --with-pcre.
PCRE_INCLINE=$PHP_PCRE/include
if echo "$PHP_PCRE" | grep -q /opt/nr/camp; then
dnl Legacy agent's build system quirks:
dnl libpcre provided by NRCAMP as libnrpcre is not position independent.
dnl Since the agent is a shared object it needs to be position independent
dnl and therefore requires linking to the position independent version
dnl of libpcre which in NRCAMP is available as libnrpcre-pic (a symlink
dnl to libpcre-pic).
PCRE_LIBLINE=-lnrpcre-pic
PCRE_LIBRARY=nrpcre-pic
elif echo "$PHP_PCRE_STATIC" | grep -q yes; then
dnl Force the agent to use static version of pcre library. This avoids the
dnl issue with runtime dependency on libpcre shared object that is hard to
dnl satisfy universally because different Linux distributions use different
dnl name of the shared object: libpcre.so or libpcre3.so.
PCRE_LIBLINE="-L$PHP_PCRE -l:libpcre.a"
PCRE_LIBRARY=pcre
else
PCRE_LIBLINE=`pcre-config --libs`
dnl When casually building from source and not enforcing static linking,
dnl through PCRE_STATIC=yes environmental variable, let the linker decide
dnl what version of libpcre to link to. This is allowed because usually
dnl when building from source, build platform = runtime platform.
PCRE_LIBLINE="-L$PHP_PCRE -lpcre"
PCRE_LIBRARY=pcre
fi

Expand Down Expand Up @@ -145,7 +171,7 @@ if test "$PHP_NEWRELIC" = "yes"; then
dnl protobuf-c directory, and there's no way to prevent it.
dnl Note that the -lprotobuf-c has to be _after_ axiom for the symbols
dnl to be resolved properly, hence the different order to the above.
NEWRELIC_SHARED_LIBADD="$NEWRELIC_SHARED_LIBADD -L$PHP_PROTOBUF_C/lib -lprotobuf-c"
NEWRELIC_SHARED_LIBADD="$NEWRELIC_SHARED_LIBADD -L$PHP_PROTOBUF_C/lib -l:libprotobuf-c.a"
],[
AC_MSG_ERROR([protobuf-c not found])
],[
Expand Down
9 changes: 9 additions & 0 deletions agent/newrelic-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ add_to_path /usr/local/php-7.3/bin
add_to_path /usr/local/php-7.4/bin
add_to_path /usr/local/php-8.0/bin
add_to_path /usr/local/php-8.1/bin
add_to_path /usr/local/php-8.2/bin

add_to_path /opt/local/bin
add_to_path /usr/php/bin
Expand All @@ -556,6 +557,7 @@ add_to_path /usr/php-7.3/bin
add_to_path /usr/php-7.4/bin
add_to_path /usr/php-8.0/bin
add_to_path /usr/php-8.1/bin
add_to_path /usr/php-8.2/bin

add_to_path /usr/php/5.5/bin
add_to_path /usr/php/5.6/bin
Expand All @@ -566,6 +568,7 @@ add_to_path /usr/php/7.3/bin
add_to_path /usr/php/7.4/bin
add_to_path /usr/php/8.0/bin
add_to_path /usr/php/8.1/bin
add_to_path /usr/php/8.2/bin

add_to_path /opt/php/bin
add_to_path /opt/zend/bin
Expand All @@ -579,6 +582,7 @@ add_to_path /opt/php-7.3/bin
add_to_path /opt/php-7.4/bin
add_to_path /opt/php-8.0/bin
add_to_path /opt/php-8.1/bin
add_to_path /opt/php-8.2/bin

if [ -n "${NR_INSTALL_PATH}" ]; then
oIFS="${IFS}"
Expand Down Expand Up @@ -1065,6 +1069,10 @@ for this copy of PHP. We apologize for the inconvenience.
pi_php8="yes"
;;

8.2.*)
pi_php8="yes"
;;

*)
error "unsupported version '${pi_ver}' of PHP found at:
${pdir}
Expand Down Expand Up @@ -1233,6 +1241,7 @@ does not exist. This particular instance of PHP will be skipped.
7.4.*) pi_modver="20190902" ;;
8.0.*) pi_modver="20200930" ;;
8.1.*) pi_modver="20210902" ;;
8.2.*) pi_modver="20220829" ;;
esac
log "${pdir}: pi_modver=${pi_modver}"

Expand Down
Loading