Skip to content
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
25 changes: 16 additions & 9 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,28 @@ How to release a new version of the `splunk-opentelemetry` project:
- bump our version in `__about__.py`
- update additional version string locations
- update CHANGELOG.md
7) Push the changes to the Github Splunk OTel Python repo
8) Open a PR and merge after approval
9) Navigate to the GitLab mirror and verify that the mirror has pulled the version you just merged by checking the
version number in the `__about__.py` file
10) When ready to release, create a new tag like `v3.4.5` on main in GitLab
7) Smoke test the local changes before releasing:
```
SPLUNK_ACCESS_TOKEN=<token> ./tests/smoke/smoke-test-package.sh
```
8) Push the changes to the Github Splunk OTel Python repo
9) Open a PR and merge after approval
10) Navigate to the GitLab mirror and verify that the mirror has pulled the version you just merged by checking the
version number in the `__about__.py` file
11) When ready to release, create a new tag like `v3.4.5` on main in GitLab
- a tag of the format `vX.Y.Z` will trigger the CI pipeline to build and publish the package to PyPI and the Docker
image to Quay
11) Monitor the release pipeline in GitLab to ensure it completes successfully
12) Post release, verify that the new package is available on PyPI and the Docker image is available on Quay
13) Smoke test the release locally by installing the new package and running it with a small app
12) Monitor the release pipeline in GitLab to ensure it completes successfully
13) Smoke test the published PyPI package and Docker image:
```
SPLUNK_ACCESS_TOKEN=<token> ./tests/smoke/smoke-test-package.sh --pypi
SPLUNK_ACCESS_TOKEN=<token> ./tests/smoke/smoke-test-docker-image.sh
```
14) Navigate to Pipelines in the GitLab repo, click the download button for the build job that just ran,
and select the 'build-job' artifact
- this will download a tarball of the package files
15) Navigate to the Splunk OTel Python repo and create a New Release
- create a new tag on publish with the tag name you created in step 10
- create a new tag on publish with the tag name you created in step 11
- set the title to that tag name (e.g. `v2.7.0`)
- unpack the tarball from step 14 and drag its contents onto the attachments section of the New Release page
- Leave the defaults selected and click Publish
72 changes: 72 additions & 0 deletions tests/smoke/smoke-test-docker-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash
set -euo pipefail

# Smoke test for the splunk-otel-instrumentation-python Docker image.
# Run this after a release to validate the published image at quay.io.
#
# Simulates what the Kubernetes OTel Operator does: runs the init container to
# populate /autoinstrumentation into a shared volume, then runs a Python container
# with that volume on PYTHONPATH and sends sqlite3 spans to Splunk O11y.
#
# Usage:
# SPLUNK_ACCESS_TOKEN=<token> ./tests/smoke/smoke-test-docker-image.sh
# SPLUNK_ACCESS_TOKEN=<token> SPLUNK_REALM=eu0 ./tests/smoke/smoke-test-docker-image.sh
# SPLUNK_ACCESS_TOKEN=<token> ./tests/smoke/smoke-test-docker-image.sh --image <image:tag>

: "${SPLUNK_ACCESS_TOKEN:?must be set}"

DEFAULT_IMAGE="quay.io/signalfx/splunk-otel-instrumentation-python:latest"
IMAGE="${DEFAULT_IMAGE}"

while [[ $# -gt 0 ]]; do
case "$1" in
--image=*) IMAGE="${1#--image=}"; shift ;;
--image) IMAGE="$2"; shift 2 ;;
*) shift ;;
esac
done

REALM="${SPLUNK_REALM:-us1}"
SERVICE_NAME="sop-smoke-docker-image-$(date +%Y%m%d%H%M%S)"
VOLUME="smoke-autoinstrumentation-$$"

cleanup() {
docker volume rm "$VOLUME" >/dev/null 2>&1 || true
}
trap cleanup EXIT

echo "==> Image: ${IMAGE}"
echo "==> Pulling image..."
docker pull --platform linux/amd64 "$IMAGE"

echo ""
echo "==> Running init container to populate /autoinstrumentation..."
docker run --rm --platform linux/amd64 \
-v "${VOLUME}:/dest" \
--entrypoint cp \
"$IMAGE" \
-r /autoinstrumentation/. /dest/

echo ""
echo "==> Sending spans to Splunk O11y (realm=${REALM}, service=${SERVICE_NAME})..."
docker run --rm --platform linux/amd64 \
-v "${VOLUME}:/autoinstrumentation:ro" \
-e PYTHONPATH=/autoinstrumentation \
-e OTEL_SERVICE_NAME="${SERVICE_NAME}" \
-e SPLUNK_ACCESS_TOKEN="${SPLUNK_ACCESS_TOKEN}" \
-e SPLUNK_REALM="${REALM}" \
-e OTEL_BSP_SCHEDULE_DELAY=200 \
python:3.11-slim \
/autoinstrumentation/bin/opentelemetry-instrument \
python -c "
import sqlite3
conn = sqlite3.connect(':memory:')
cur = conn.cursor()
for i in range(12):
cur.execute('SELECT ' + str(i))
from opentelemetry import trace
trace.get_tracer_provider().force_flush()
"

echo ""
echo "Done. Check APM on ${REALM} for service '${SERVICE_NAME}'."
47 changes: 47 additions & 0 deletions tests/smoke/smoke-test-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -euo pipefail

# Smoke test for the splunk-opentelemetry Python package.
# Installs the package (local checkout or PyPI) and sends spans to Splunk O11y to
# verify end-to-end instrumentation works. Run this before a release (local) or
# after a release (--pypi) to validate the published package.
#
# Usage:
# SPLUNK_ACCESS_TOKEN=<token> ./tests/smoke/smoke-test-package.sh # local checkout
# SPLUNK_ACCESS_TOKEN=<token> ./tests/smoke/smoke-test-package.sh --pypi # PyPI package

: "${SPLUNK_ACCESS_TOKEN:?must be set}"

USE_PYPI=false
for arg in "$@"; do
[ "$arg" = "--pypi" ] && USE_PYPI=true
done

SMOKE_VENV=/tmp/smoke-venv
Comment thread
pmcollins marked this conversation as resolved.

if [ "$USE_PYPI" = "true" ]; then
echo "==> Installing from PyPI..."
else
echo "==> Installing from local checkout..."
fi

rm -rf "$SMOKE_VENV"
python -m venv "$SMOKE_VENV"
if [ "$USE_PYPI" = "true" ]; then
"$SMOKE_VENV/bin/pip" install --quiet splunk-opentelemetry
Comment thread
pmcollins marked this conversation as resolved.
else
"$SMOKE_VENV/bin/pip" install --quiet .
fi

if [ "$USE_PYPI" = "true" ]; then
echo "splunk-opentelemetry $("$SMOKE_VENV/bin/pip" show splunk-opentelemetry | grep ^Version | cut -d' ' -f2)"
fi

export SPLUNK_ACCESS_TOKEN
export SPLUNK_REALM="${SPLUNK_REALM:-us1}"
export OTEL_SERVICE_NAME="sop-smoke-package-$(date +%Y%m%d%H%M%S)"

"$SMOKE_VENV/bin/opentelemetry-instrument" \
"$SMOKE_VENV/bin/python" tests/integration/trace_loop.py

echo "Done. Check APM on ${SPLUNK_REALM} for service '${OTEL_SERVICE_NAME}'."
Loading