Skip to content

Commit

Permalink
chore(ci): add OCI packaging (#8932)
Browse files Browse the repository at this point in the history
We are shifting over to using OCI packaging rather than system
packaging. Unlike the existing deb/rpm builds we package only the
relevant arch binaries in the package to reduce the final installation
size on the system. Once validated and released we will remove the
similar deb/rpm packaging.

This packaging has been tested in
DataDog/auto_inject#185 where we pull in v2.8.2
of the library and inject it into a basic Python app and validate that
traces are submitted.

The job will run as part of the existing deb/rpm jobs done as part of
the release process. No new manual steps are introduced to the release
to build and deploy these images.
  • Loading branch information
Kyle-Verhoog authored May 6, 2024
1 parent 1ca90d5 commit fcfe10c
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,20 @@ deploy_latest_tag_to_docker_registries:
# See above note in the `deploy_to_docker_registries` job.
RETRY_DELAY: 14400
RETRY_COUNT: 3

package-oci:
stage: package
extends: .package-oci
rules:
- if: $PYTHON_PACKAGE_VERSION
when: on_success
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(-prerelease)?$/'
when: manual
allow_failure: false
script:
- ../.gitlab/build-oci.sh
parallel:
matrix:
- ARCH:
- arm64
- amd64
55 changes: 55 additions & 0 deletions .gitlab/build-oci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

source common_build_functions.sh

if [ -n "$CI_COMMIT_TAG" ] && [ -z "$PYTHON_PACKAGE_VERSION" ]; then
PYTHON_PACKAGE_VERSION=${CI_COMMIT_TAG##v}
fi

if [ -z "$ARCH" ]; then
ARCH=amd64
fi


TMP_DIR=$(mktemp --dir)
BUILD_DIR=$TMP_DIR/datadog-python-apm.build
mkdir $TMP_DIR/datadog-python-apm.build

# Install known compatible pip as default version shipped in Ubuntu (20.0.2)
# does not work.
python3 -m pip install -U "pip>=22.0"
python3 -m pip install packaging

WHEEL_ARCH="x86_64"
if [ "$ARCH" = "arm64" ]; then
WHEEL_ARCH="aarch64"
fi

../lib-injection/dl_wheels.py \
--python-version=3.12 \
--python-version=3.11 \
--python-version=3.10 \
--python-version=3.9 \
--python-version=3.8 \
--python-version=3.7 \
--ddtrace-version=$PYTHON_PACKAGE_VERSION \
--arch=$WHEEL_ARCH \
--platform=musllinux_1_1 \
--platform=manylinux2014 \
--output-dir=$BUILD_DIR/ddtrace_pkgs \
--verbose
echo -n $PYTHON_PACKAGE_VERSION > auto_inject-python.version
cp ../lib-injection/sitecustomize.py $BUILD_DIR/
cp auto_inject-python.version $BUILD_DIR/version
chmod -R o-w $BUILD_DIR
chmod -R g-w $BUILD_DIR

# Build packages
datadog-package create \
--version="$PYTHON_PACKAGE_VERSION" \
--package="datadog-apm-library-python" \
--archive=true \
--archive-path="datadog-apm-library-python-$PYTHON_PACKAGE_VERSION-$ARCH.tar" \
--arch "$ARCH" \
--os "linux" \
$BUILD_DIR

0 comments on commit fcfe10c

Please sign in to comment.