Skip to content

Commit

Permalink
[WIP] support arm 64
Browse files Browse the repository at this point in the history
  • Loading branch information
ge0Aja committed Feb 5, 2025
1 parent 6e3a156 commit a2380df
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-arm64
continue-on-error: true
strategy:
max-parallel: 4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trace_forwarder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-arm64
steps:
- name: Checkout source
uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ base.zip
.vscode
**/node_modules
.idea
*.zip
2 changes: 2 additions & 0 deletions aws/logs_monitoring/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ Resources:
- ZipFile: " "
MemorySize: !Ref MemorySize
Runtime: python3.12
Architectures:
- arm64
Timeout: !Ref Timeout
Tags:
- Key: "dd_forwarder_version"
Expand Down
2 changes: 1 addition & 1 deletion aws/logs_monitoring/tools/Dockerfile_bundle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WORKDIR /build

COPY . .

RUN pip install -r requirements.txt -t .
RUN pip install --no-cache-dir -r requirements.txt -t . -U

# Remove *.pyc files
RUN find . -name \*.pyc -delete
Expand Down
6 changes: 3 additions & 3 deletions aws/logs_monitoring/tools/build_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ docker_build_zip() {
# between different python runtimes.
temp_dir=$(mktemp -d)

docker buildx build --platform linux/amd64 --file "${DIR}/Dockerfile_bundle" -t "datadog-bundle:$1" .. --no-cache --build-arg "runtime=${PYTHON_VERSION}"
docker buildx build --platform linux/arm64 --file "${DIR}/Dockerfile_bundle" -t "datadog-bundle:$1" .. --no-cache --build-arg "runtime=${PYTHON_VERSION}"

# Run the image by runtime tag, tar its generated `python` directory to sdout,
# then extract it to a temp directory.
docker run --platform linux/amd64 "datadog-bundle:${1}" tar cf - . | tar -xf - -C "${temp_dir}"
docker run --platform linux/arm64 "datadog-bundle:${1}" tar cf - . | tar -xf - -C "${temp_dir}"

# Zip to destination, and keep directory structure as based in $temp_dir
(cd "${temp_dir}" && zip -q -r "${zip_destination}" ./)
Expand All @@ -82,7 +82,7 @@ docker_build_zip() {

# Run the image by runtime tag, tar its generated `python` directory to sdout,
# then extract it to a temp directory.
docker run --platform linux/amd64 datadog-bundle:$1 tar cf - . | tar -xf - -C $temp_dir/$SUB_DIRECTORY
docker run --platform linux/arm64 datadog-bundle:$1 tar cf - . | tar -xf - -C $temp_dir/$SUB_DIRECTORY

# Zip to destination, and keep directory structure as based in $temp_dir
(cd "${temp_dir}" && zip -q -r "${layer_destination}" ./)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ cd $INTEGRATION_TESTS_DIR

# Build Docker image of Forwarder for tests
echo "Building Docker Image for Forwarder with tag datadog-log-forwarder:$PYTHON_VERSION"
docker buildx build --platform linux/amd64 --file "${INTEGRATION_TESTS_DIR}/forwarder/Dockerfile" -t "datadog-log-forwarder:$PYTHON_VERSION" ../../.forwarder --no-cache \
docker buildx build --platform linux/arm64 --file "${INTEGRATION_TESTS_DIR}/forwarder/Dockerfile" -t "datadog-log-forwarder:$PYTHON_VERSION" ../../.forwarder --no-cache \
--build-arg forwarder='aws-dd-forwarder-0.0.0' \
--build-arg image="public.ecr.aws/lambda/python:${PYTHON_VERSION_TAG}-x86_64"
--build-arg image="public.ecr.aws/lambda/python:${PYTHON_VERSION_TAG}-arm64"

echo "Running integration tests for ${PYTHON_VERSION}"
LOG_LEVEL=${LOG_LEVEL} \
Expand Down
2 changes: 1 addition & 1 deletion aws/logs_monitoring/trace_forwarder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN go get -u github.com/golang/dep/cmd/dep
COPY . /go/src/github.com/DataDog/datadog-serverless-functions/aws/logs_monitoring/trace_forwarder/
WORKDIR /go/src/github.com/DataDog/datadog-serverless-functions/aws/logs_monitoring/trace_forwarder/
ENV GOOS=linux
ENV GOARCH=amd64
ENV GOARCH=arm64
RUN dep ensure

# Build the go binary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ rm -rf ./bin
# Install datadogpy in a docker container to avoid the mess from switching
# between different python runtimes.

if [[ $(docker image ls | grep -c datadog-go-layer) -lt 1 ]]; then
docker buildx build --platform linux/amd64 -t datadog-go-layer . --no-cache --build-arg "runtime=python:3.12"
if [[ $(docker image ls | grep -c golang) -lt 1 ]]; then
docker buildx build --platform linux/arm64 -t golang . --no-cache --build-arg "runtime=python:3.12"
fi

id=$(docker create --platform linux/amd64 datadog-go-layer)
id=$(docker create --platform linux/arm64 golang)
docker cp "${id}:/go/src/github.com/DataDog/datadog-serverless-functions/aws/logs_monitoring/trace_forwarder/bin" .
docker rm -v "${id}"
echo "Done creating archive bin"
2 changes: 1 addition & 1 deletion aws/logs_monitoring/trace_forwarder/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ set -e
# Change to the parent of the directory this script is in
cd $(dirname "$0")/..

docker buildx build --platform linux/amd64 -t datadog-go-layer . --build-arg runtime=python:3.12
docker buildx build --platform linux/arm64 -t datadog-go-layer . --build-arg runtime=python:3.12
docker run --rm datadog-go-layer go test -v ./...
Binary file removed aws/rds_enhanced_monitoring.zip
Binary file not shown.
Binary file removed aws/vpc_flow_log_monitoring.zip
Binary file not shown.

0 comments on commit a2380df

Please sign in to comment.