-
Notifications
You must be signed in to change notification settings - Fork 12
IDMPL-350 Improve example scripts to simplify smoke tests procedure #349
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
Merged
xlamorlette-datadog
merged 17 commits into
master
from
xlamorlette/IDMPL-350-Nginx-Simplify-smoke-tests-procedure
Apr 16, 2026
+226
−99
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
cff3f19
For the tracing example, add options to the run script to set the Ngi…
xlamorlette-datadog 6578fc1
Code clean: fix casing for local variables in shell script
xlamorlette-datadog ec48077
For the OpenResty example, add a script to download the Datadog modul…
xlamorlette-datadog 1d90941
Remove warning when variables are not set
xlamorlette-datadog 4bca0bc
For Ingress Nginx example, use Colima instead of Docker Desktop
xlamorlette-datadog 0425bd5
Shell check fixes
xlamorlette-datadog 546cd59
Merge branch 'master' into xlamorlette/IDMPL-350-Nginx-Simplify-smoke…
xlamorlette-datadog 0d407cf
Update example/ingress-nginx/README.md
xlamorlette-datadog 55c7070
Update example/tracing/services/nginx/install_datadog.sh
xlamorlette-datadog 7675365
Update example/tracing/services/nginx/install_datadog.sh
xlamorlette-datadog 9547abf
Update example/openresty/services/openresty/install_datadog.sh
xlamorlette-datadog ddb51fe
Update example/openresty/services/openresty/install_datadog.sh
xlamorlette-datadog 4f776b2
Update example/openresty/services/openresty/install_datadog.sh
xlamorlette-datadog c49f428
Factorise utility functions across install_datadog.sh scripts for tra…
xlamorlette-datadog 9a71755
Factorize more things across install_datadog.sh scripts
xlamorlette-datadog c92d146
clean code: get arch by return value form detect_arch
xlamorlette-datadog 9e7fad8
Merge branch 'master' into xlamorlette/IDMPL-350-Nginx-Simplify-smoke…
pawelchcki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/bin/sh | ||
| # Shared utility functions for install_datadog.sh scripts. | ||
|
|
||
| detect_arch() { | ||
| raw_arch="$(uname -m)" | ||
| case "$raw_arch" in | ||
| aarch64) | ||
| echo "arm64" | ||
| ;; | ||
| x86_64) | ||
| echo "amd64" | ||
| ;; | ||
| *) | ||
| >&2 echo "Platform ${raw_arch} is not supported." | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| get_latest_release() { | ||
| tag=$(curl --silent --fail "https://api.github.com/repos/$1/releases/latest" | jq --raw-output .tag_name) | ||
| if [ -z "$tag" ] || [ "$tag" = "null" ]; then | ||
| >&2 echo "Failed to fetch latest release tag for $1. Check network and GitHub API rate limits." | ||
| exit 1 | ||
| fi | ||
| echo "$tag" | ||
| } | ||
|
|
||
| install_packages() { | ||
| # Install the requested list of packages. | ||
| # `apt-get` (Debian, Ubuntu), `apk` (Alpine), and `yum` (Amazon Linux) are supported. | ||
| if is_installed apt-get; then | ||
| apt-get update | ||
| DEBIAN_FRONTEND=noninteractive apt-get install -y "$@" | ||
| elif is_installed apk; then | ||
| apk update | ||
| apk add "$@" | ||
| elif is_installed yum; then | ||
| yum update -y | ||
| yum install -y "$@" | ||
| else | ||
| >&2 printf 'Did not find a supported package manager.\n' | ||
| exit 3 | ||
| fi | ||
| } | ||
|
|
||
| is_installed() { | ||
| command -v "$1" > /dev/null 2>&1 | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,9 +1,20 @@ | ||
| # Build an nginx container that includes the module for Datadog tracing. | ||
| ARG BASE_IMAGE | ||
| # Build an Nginx container that includes the module for Datadog tracing. | ||
| # The default value for BASE_IMAGE is to silent the InvalidDefaultArgInFrom | ||
| # warning. Actually BASE_IMAGE is set in docker-compose.yml. | ||
| ARG OPENRESTY_VERSION=1.29.2.1 | ||
| ARG BASE_IMAGE=openresty/openresty:${OPENRESTY_VERSION}-alpine | ||
| FROM ${BASE_IMAGE} | ||
|
|
||
| COPY ngx_http_datadog_module.so* /usr/local/openresty/nginx/modules | ||
| COPY ./nginx.conf /usr/local/openresty/nginx/conf/nginx.conf | ||
| # Install the Datadog tracing module. | ||
| ARG OPENRESTY_VERSION | ||
| ENV OPENRESTY_VERSION=${OPENRESTY_VERSION} | ||
| ARG NGINX_DATADOG_VERSION | ||
| ENV NGINX_DATADOG_VERSION=${NGINX_DATADOG_VERSION} | ||
| COPY ./install_datadog_utils.sh /tmp/ | ||
| COPY ./openresty/services/openresty/install_datadog.sh /tmp/ | ||
| RUN /tmp/install_datadog.sh | ||
|
|
||
| COPY ./openresty/services/openresty/nginx.conf /usr/local/openresty/nginx/conf/nginx.conf | ||
|
|
||
| ENTRYPOINT ["nginx"] | ||
| CMD ["-g", "daemon off;"] |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/bin/sh | ||
| # Install the Nginx Datadog module. | ||
|
|
||
| set -x | ||
| set -e | ||
|
|
||
| . /tmp/install_datadog_utils.sh | ||
|
|
||
| arch=$(detect_arch) | ||
|
|
||
| install_packages curl jq tar wget | ||
|
|
||
| if [ -z "$OPENRESTY_VERSION" ]; then | ||
| >&2 echo 'OPENRESTY_VERSION must be set (e.g. "1.29.2.1").' | ||
| exit 1 | ||
| fi | ||
|
|
||
| tarball="openresty-ngx_http_datadog_module-appsec-${arch}-${OPENRESTY_VERSION}.so.tgz" | ||
|
|
||
| repository="DataDog/nginx-datadog" | ||
|
|
||
| if [ -n "$NGINX_DATADOG_VERSION" ]; then | ||
| nginx_datadog_release_tag="v${NGINX_DATADOG_VERSION}" | ||
| else | ||
| nginx_datadog_release_tag=$(get_latest_release "$repository") | ||
| fi | ||
|
|
||
| wget "https://github.com/$repository/releases/download/$nginx_datadog_release_tag/$tarball" | ||
| tar -xzf "$tarball" -C /usr/local/openresty/nginx/modules | ||
| rm "$tarball" | ||
This file contains hidden or 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 hidden or 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 hidden or 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,16 +1,19 @@ | ||
| # Build an nginx container that includes the module for Datadog tracing. | ||
| # Build an Nginx container that includes the module for Datadog tracing. | ||
| # The default value for BASE_IMAGE is to silent the InvalidDefaultArgInFrom | ||
| # warning. Actually BASE_IMAGE is set in docker-compose.yml. | ||
| ARG BASE_IMAGE=nginx:1.29.7-alpine | ||
| FROM ${BASE_IMAGE} | ||
|
|
||
| # Install the Datadog tracing module. | ||
| COPY ./install_datadog.sh /tmp/ | ||
| COPY ./install_datadog_utils.sh /tmp/ | ||
| COPY ./tracing/services/nginx/install_datadog.sh /tmp/ | ||
| ARG BASE_IMAGE | ||
| ENV BASE_IMAGE=${BASE_IMAGE} | ||
| ARG NGINX_DATADOG_VERSION | ||
| ENV NGINX_DATADOG_VERSION=${NGINX_DATADOG_VERSION} | ||
| RUN /tmp/install_datadog.sh | ||
|
|
||
| COPY ./nginx.conf /etc/nginx/nginx.conf | ||
| COPY ./tracing/services/nginx/nginx.conf /etc/nginx/nginx.conf | ||
|
|
||
| ENTRYPOINT ["nginx"] | ||
| CMD ["-g", "daemon off;"] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.