Skip to content

Commit

Permalink
We need run compilation for each arch
Browse files Browse the repository at this point in the history
  • Loading branch information
jaroslav-fedor-swi committed Oct 24, 2024
1 parent e31ec3d commit d14e2e1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ on:

env:
BENV_IMAGE: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:buil-env-buildx
BENV_IMAGE_ARM: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:build-env-arm64
DOCKER_REGISTRY: docker.io
DOCKER_NAMESPACE: solarwinds
IMAGE_PREFIX: "opentelemetry-ebpf-"
Expand Down Expand Up @@ -93,7 +94,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Fetch build environment
run: |
docker pull $BENV_IMAGE
docker pull $BENV_IMAGE $BENV_IMAGE_ARM
- name: Build artifacts
run: |
mkdir -p $GITHUB_WORKSPACE/out
Expand All @@ -102,9 +103,16 @@ jobs:
--mount "type=bind,source=$GITHUB_WORKSPACE/src,destination=/root/src,readonly" \
--mount "type=bind,source=$GITHUB_WORKSPACE/out,destination=/root/out" \
--env EBPF_NET_SRC_ROOT=/root/src \
--env ENABLE_ARM64_BUILD=TRUE \
$BENV_IMAGE \
./build.sh docker
docker run -t --rm \
--mount "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" \
--mount "type=bind,source=$GITHUB_WORKSPACE/src,destination=/root/src,readonly" \
--mount "type=bind,source=$GITHUB_WORKSPACE/out,destination=/root/out" \
--env EBPF_NET_SRC_ROOT=/root/src \
--env ENABLE_ARM64_BUILD=TRUE \
$BENV_IMAGE_ARM \
./build.sh docker
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:
pull_request:

env:
BENV_IMAGE: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:buil-env-buildx
BENV_IMAGE_AMD: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:buil-env-buildx
BENV_IMAGE_ARM: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:build-env-arm64

concurrency:
group: build-and-test-${{ github.event.pull_request_number || github.ref }}
Expand Down
18 changes: 10 additions & 8 deletions cmake/docker-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,7 @@ function(build_custom_docker_image IMAGE_NAME)


if (RUN_DOCKER_COMMANDS)
add_custom_command(
TARGET
"${IMAGE_NAME}-docker"
WORKING_DIRECTORY
"${out_path}"
COMMAND
docker buildx build --platform linux/amd64 -t "${IMAGE_NAME}" ${DOCKER_ARGS} .
)

if (ENABLE_ARM64_BUILD)
add_custom_command(
TARGET
Expand All @@ -173,6 +166,15 @@ function(build_custom_docker_image IMAGE_NAME)
COMMAND
docker buildx build --platform linux/arm64 -t "${IMAGE_NAME}-arm64" ${DOCKER_ARGS} .
)
else()
add_custom_command(
TARGET
"${IMAGE_NAME}-docker"
WORKING_DIRECTORY
"${out_path}"
COMMAND
docker buildx build --platform linux/amd64 -t "${IMAGE_NAME}" ${DOCKER_ARGS} .
)
endif()
endif()

Expand Down

0 comments on commit d14e2e1

Please sign in to comment.