-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from bryanlatten/newrelic-go-cache
Newrelic: remove go-cache after compile, Github CI compatible + working
- Loading branch information
Showing
14 changed files
with
91 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM behance/docker-nginx:9.0 | ||
FROM behance/docker-nginx:9.0 as output | ||
LABEL maintainers="Behance Team <[email protected]>" | ||
|
||
# Set TERM to suppress warning messages. | ||
|
@@ -138,9 +138,13 @@ RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \ | |
# Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants | ||
/bin/bash -e /scripts/prep-php.sh | ||
|
||
# TESTING PHASE: using multi-stage to isolate any possible side effects | ||
FROM output as testenvironment | ||
|
||
# HACK: workaround for https://github.com/aelsabbahy/goss/issues/392 | ||
# Run the child and parent test configs separately instead of leveraging inheritance | ||
RUN goss -g /tests/php-fpm/7.4.goss.yaml validate && \ | ||
goss -g /tests/php-fpm/base.goss.yaml validate && \ | ||
/aufs_hack.sh | ||
goss -g /tests/php-fpm/base.goss.yaml validate | ||
|
||
# Output the final image | ||
FROM output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM behance/docker-nginx:9.0-alpine | ||
FROM behance/docker-nginx:9.0-alpine as output | ||
LABEL maintainers="Behance Team <[email protected]>" | ||
|
||
# Set TERM to suppress warning messages. | ||
|
@@ -130,8 +130,12 @@ RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \ | |
ln -s /usr/sbin/php-fpm7 /usr/sbin/php-fpm && \ | ||
/bin/bash -e /scripts/prep-php.sh | ||
|
||
# TESTING PHASE: using multi-stage to isolate any possible side effects | ||
FROM output | ||
# HACK: workaround for https://github.com/aelsabbahy/goss/issues/392 | ||
# Run the child and parent test configs separately instead of leveraging inheritance | ||
RUN goss -g /tests/php-fpm/7.4-alpine.goss.yaml validate && \ | ||
goss -g /tests/php-fpm/base.goss.yaml validate && \ | ||
/aufs_hack.sh | ||
goss -g /tests/php-fpm/base.goss.yaml validate | ||
|
||
# Output the final image | ||
FROM output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM behance/docker-nginx:9.0 | ||
FROM behance/docker-nginx:9.0 as output | ||
LABEL maintainers="Behance Team <[email protected]>" | ||
|
||
# Set TERM to suppress warning messages. | ||
|
@@ -133,8 +133,13 @@ RUN cp /etc/php/7.0/mods-available/* $CONF_PHPMODS && \ | |
# Run standard set of tweaks to ensure runs performant, reliably, and consistent between variants | ||
/bin/bash -e /scripts/prep-php.sh | ||
|
||
# TESTING PHASE: using multi-stage to isolate any possible side effects | ||
FROM output as testenvironment | ||
|
||
# HACK: workaround for https://github.com/aelsabbahy/goss/issues/392 | ||
# Run the child and parent test configs separately instead of leveraging inheritance | ||
RUN goss -g /tests/php-fpm/8.0.goss.yaml validate && \ | ||
goss -g /tests/php-fpm/base.goss.yaml validate && \ | ||
/aufs_hack.sh | ||
goss -g /tests/php-fpm/base.goss.yaml validate | ||
|
||
# Output the final image | ||
FROM output |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,18 +14,30 @@ set -o pipefail | |
MACHINE=$1 | ||
INTERNAL_PORT=8080 | ||
PREFIX="==>" | ||
BASE_NAME="docker-php" | ||
|
||
if [ -z "$1" ]; then | ||
if [[ -z "$1" ]]; then | ||
printf "Basic integration script for docker-php and its variants\n\n" | ||
printf "Usage:\n\ttest.sh [docker-machine ip]\n" | ||
exit 1; | ||
exit 1 | ||
fi | ||
|
||
if [ ! $PHP_VARIANT ]; then | ||
if [[ ! $PHP_VARIANT ]]; then | ||
echo "Missing PHP_VARIANT environment variable" | ||
exit 1 | ||
fi | ||
|
||
# Required for dgoss execution, below | ||
if [[ ! -n "$GOSS_PATH" ]]; then | ||
[ -f $(which goss) ] || { echo 'goss not found, pass GOSS_PATH'; exit 1; } | ||
GOSS_PATH=$(which goss) | ||
fi | ||
|
||
if [[ ! -n "$DGOSS_PATH" ]]; then | ||
[ -f $(which dgoss) ] || { echo 'dgoss not found, pass DGOSS_PATH'; exit 1; } | ||
DGOSS_PATH=$(which dgoss) | ||
fi | ||
|
||
# Distinguish between naming types | ||
VARIANT_NAME=$PHP_VARIANT | ||
DOCKERFILE_NAME="Dockerfile-${PHP_VARIANT}" | ||
|
@@ -36,13 +48,12 @@ TEST_STRING="PHP Version ${PHP_VERSION}." | |
PLATFORM="${PLATFORM:=linux/amd64}" | ||
|
||
# Since containers may or may not be against the same docker engine, create a matrix-unique tag name for outputs | ||
TAG_NAME="docker-php-${VARIANT_NAME}-${PLATFORM}" | ||
TAG_NAME="${BASE_NAME}-${VARIANT_NAME}-${PLATFORM}" | ||
# Formats as lowercase | ||
TAG_NAME=$(echo $TAG_NAME | tr '[:upper:]' '[:lower:]') | ||
# Removes slashes | ||
TAG_NAME=$(echo $TAG_NAME | sed 's/\///') | ||
|
||
|
||
echo "${PREFIX} Variant ${VARIANT_NAME}" | ||
echo "${PREFIX} PHP Version: ${PHP_VERSION}" | ||
echo "${PREFIX} Dockerfile: ${DOCKERFILE_NAME}" | ||
|
@@ -51,6 +62,9 @@ echo "${PREFIX} Platform: ${PLATFORM}" | |
|
||
printf "${PREFIX} Building container\n" | ||
|
||
printf "${PREFIX} using goss (${GOSS_PATH})\n" | ||
printf "${PREFIX} using dgoss (${DGOSS_PATH})\n" | ||
|
||
docker buildx build --platform $PLATFORM --iidfile $TAG_NAME -t $TAG_NAME -f $DOCKERFILE_NAME . | ||
|
||
# NOTE: multi-arch builds may not be accessible by docker tag, instead target by ID | ||
|
@@ -63,6 +77,9 @@ printf "${PREFIX} Running container in background\n" | |
CONTAINER_ID=$(docker run --rm --platform $PLATFORM --env-file ./.test.env -p $INTERNAL_PORT -d $BUILD_SHA) | ||
CONTAINER_PORT=$(docker inspect --format '{{ (index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort }}' $CONTAINER_ID) | ||
|
||
printf "${PREFIX} Waiting for container to boot\n" | ||
sleep 5 | ||
|
||
# ==> Cleanup routine | ||
# CI environments may be ephemeral, but local environments are not | ||
function finish { | ||
|
@@ -77,9 +94,7 @@ function finish { | |
|
||
trap finish EXIT | ||
|
||
printf "${PREFIX} Waiting for container to boot\n" | ||
sleep 5 | ||
|
||
# ------------------------------------------------------------- | ||
echo "${PREFIX} Check default response, including PHP version identification" | ||
curl "${MACHINE}:${CONTAINER_PORT}" | grep "${TEST_STRING}" | ||
|
||
|
@@ -90,16 +105,19 @@ echo "${PREFIX} Send uploaded file" | |
curl --form [email protected] "${MACHINE}:${CONTAINER_PORT}" \ | ||
| grep "${TEST_STRING}" > /dev/null | ||
|
||
# ------------------------------------------------------------- | ||
echo "${PREFIX} Perform startup tests" | ||
GOSS_PATH=goss \ | ||
|
||
GOSS_FILES_PATH="runtime-tests/startup/" \ | ||
GOSS_SLEEP=5 \ | ||
GOSS_FILES_PATH="runtime-tests/startup/${PHP_VARIANT}/" \ | ||
"${GOSS_INSTALL_PATH}dgoss" run --rm $BUILD_SHA | ||
$DGOSS_PATH run --rm $BUILD_SHA | ||
|
||
# ------------------------------------------------------------- | ||
echo "${PREFIX} Perform NewRelic runtime tests" | ||
GOSS_PATH=goss \ | ||
GOSS_FILES_PATH="runtime-tests/newrelic/${PHP_VARIANT}/" \ | ||
"${GOSS_INSTALL_PATH}dgoss" run \ | ||
|
||
GOSS_FILES_PATH="runtime-tests/newrelic/" \ | ||
GOSS_SLEEP=5 \ | ||
$DGOSS_PATH run --rm \ | ||
-e REPLACE_NEWRELIC_APP="abcdefg" \ | ||
-e REPLACE_NEWRELIC_LICENSE="hijklmno" \ | ||
-e NEWRELIC_TRACING_ENABLED="true" \ | ||
|