Skip to content

Commit 87d5d66

Browse files
authored
[ABLD-28] Add macOS build for AArch64/ARM64 (#37676)
Add macOS build for AArch64/ARM64 This is the payload for adding macOS "native" build support for the AArch64/ARM64 architecture to the Agent, that is by removing the need for Rosetta 2 translation at runtime. Groundwork enabling the present payload: - DataDog/integrations-core#20455 - DataDog/integrations-core#20577 - DataDog/integrations-core#20699 - DataDog/omnibus-ruby#239 - DataDog/omnibus-ruby#240 - #38498 - #39082 - DataDog/agent-release-management#364 Some earlier scouting: - DataDog/integrations-core#19193 (credits to @Pythyu) - DataDog/omnibus-software#553 (credits to @Pythyu) - #31787 (credits to @Pythyu) - DataDog/ci-platform-machine-images#321 Some follow-ups: - DataDog/datadog-agent-dev#137 - DataDog/datadog-agent-buildimages#888 - #38446 - DataDog/integrations-core#20812 - DataDog/integrations-core#20815 - DataDog/integrations-core#20645 - DataDog/ci-platform-machine-images#343 - DataDog/agent-release-management#365
1 parent 2679b1a commit 87d5d66

17 files changed

Lines changed: 61 additions & 43 deletions

File tree

.gitlab/.ci-linters.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ needs-rules:
3030
- lint_linux-arm64
3131
- lint_linux-x64
3232
- lint_macos_gitlab_amd64
33+
- lint_macos_gitlab_arm64
3334
- new-e2e-eks-cleanup-on-failure
3435
- protobuf_test
3536
- publish_winget_7_x64
@@ -39,6 +40,7 @@ needs-rules:
3940
- tests_ebpf_arm64
4041
- tests_ebpf_x64
4142
- tests_macos_gitlab_amd64
43+
- tests_macos_gitlab_arm64
4244
- tests_windows_secagent_x64
4345
- tests_windows_sysprobe_x64
4446
- trigger_auto_staging_release

.gitlab/deploy_packages/deploy_common.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@
2424
variables:
2525
MAJOR_VERSION: 7
2626

27+
.deploy_packages_dmg:
28+
stage: deploy_packages
29+
rules:
30+
!reference [.on_deploy]
31+
image: registry.ddbuild.io/ci/datadog-agent-buildimages/gitlab_agent_deploy$CI_IMAGE_GITLAB_AGENT_DEPLOY_SUFFIX:$CI_IMAGE_GITLAB_AGENT_DEPLOY
32+
tags: ["arch:amd64"]
33+
before_script:
34+
- ls $OMNIBUS_PACKAGE_DIR
35+
script:
36+
- $S3_CP_CMD --recursive --exclude "*" --include "datadog-agent-7*.dmg" $OMNIBUS_PACKAGE_DIR $S3_RELEASE_ARTIFACTS_URI/dmg/$PACKAGE_ARCH/
37+
2738
.deploy_packages_rpm:
2839
resource_group: rpm_bucket
2940
image: registry.ddbuild.io/ci/datadog-agent-buildimages/gitlab_agent_deploy$CI_IMAGE_GITLAB_AGENT_DEPLOY_SUFFIX:$CI_IMAGE_GITLAB_AGENT_DEPLOY

.gitlab/deploy_packages/nix.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,16 @@ deploy_packages_dogstatsd_suse_rpm-x64-7:
147147
PACKAGE_ARCH: x86_64
148148

149149
deploy_packages_dmg-x64-a7:
150-
rules:
151-
!reference [.on_deploy]
152-
stage: deploy_packages
153-
image: registry.ddbuild.io/ci/datadog-agent-buildimages/gitlab_agent_deploy$CI_IMAGE_GITLAB_AGENT_DEPLOY_SUFFIX:$CI_IMAGE_GITLAB_AGENT_DEPLOY
154-
tags: ["arch:amd64"]
150+
extends: .deploy_packages_dmg
155151
needs: ["agent_dmg-x64-a7"]
156-
before_script:
157-
- ls $OMNIBUS_PACKAGE_DIR
158-
script:
159-
- $S3_CP_CMD --recursive --exclude "*" --include "datadog-agent-7*.dmg" $OMNIBUS_PACKAGE_DIR $S3_RELEASE_ARTIFACTS_URI/dmg/x86_64/
152+
variables:
153+
PACKAGE_ARCH: x86_64
154+
155+
deploy_packages_dmg-arm64-a7:
156+
extends: .deploy_packages_dmg
157+
needs: ["agent_dmg-arm64-a7"]
158+
variables:
159+
PACKAGE_ARCH: arm64
160160

161161
# deploy dogstatsd x64, non-static binary to staging bucket
162162
deploy_staging_dsd:

.gitlab/functional_test/static_quality_gate.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ static_quality_gates:
4949
- iot_agent_rpm-armhf
5050
- iot_agent_suse-x64
5151
- windows_msi_and_bosh_zip_x64-a7
52-
# - job: agent_dmg-x64-a7
53-
# optional: True
54-
#
5552
script:
5653
- !reference [.login_to_docker_readonly_crane]
5754
# `datadog-ci` relies on `DATADOG_API_KEY` so we get that here.

.gitlab/lint/macos.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ include:
66
stage: lint
77
extends: .macos_gitlab
88
needs: ["go_deps", "go_tools_deps"]
9+
rules:
10+
- !reference [.except_mergequeue]
11+
- when: on_success
912
script:
1013
- !reference [.retrieve_linux_go_deps]
1114
- !reference [.retrieve_linux_go_tools_deps]
@@ -14,13 +17,7 @@ include:
1417
lint_macos_gitlab_amd64:
1518
extends: .lint_macos_gitlab
1619
tags: ["macos:ventura-amd64", "specific:true"]
17-
rules:
18-
- !reference [.except_mergequeue]
19-
- when: on_success
2020

2121
lint_macos_gitlab_arm64:
2222
extends: .lint_macos_gitlab
23-
rules:
24-
- !reference [.on_main]
25-
- !reference [.manual]
2623
tags: ["macos:ventura-arm64", "specific:true"]

.gitlab/package_build/dmg.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
export GOMODCACHE=~/gomodcache
2424
mkdir -p $GOMODCACHE
2525
26-
agent_dmg-x64-a7:
26+
.agent_dmg:
2727
stage: package_build
28-
tags: ["macos:ventura-amd64", "specific:true"]
2928
needs: ["go_mod_tidy_check"]
3029
rules:
3130
- !reference [.on_macos_gui_change]
@@ -71,3 +70,11 @@ agent_dmg-x64-a7:
7170
- !reference [.macos_setup_cache]
7271
- bash .gitlab/package_build/build_agent_dmg.sh
7372
- !reference [.upload_sbom_artifacts]
73+
74+
agent_dmg-x64-a7:
75+
extends: .agent_dmg
76+
tags: ["macos:ventura-amd64", "specific:true"]
77+
78+
agent_dmg-arm64-a7:
79+
extends: .agent_dmg
80+
tags: ["macos:ventura-arm64", "specific:true"]

.gitlab/source_test/macos.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ include:
2121
- if [[ "$FAST_TESTS" == "true" ]]; then FAST_TESTS_FLAG="--only-impacted-packages"; fi
2222
- dda inv -- -e test --rerun-fails=2 --race --profile --cpus 12 --result-json $TEST_OUTPUT_FILE --junit-tar "junit-${CI_JOB_NAME}.tgz" $FAST_TESTS_FLAG --test-washer --coverage
2323
- dda inv -- -e invoke-unit-tests
24+
after_script:
25+
- !reference [.vault_login]
26+
- !reference [.select_python_env_commands]
27+
- !reference [.upload_junit_source]
28+
- !reference [.upload_coverage]
2429
artifacts:
2530
expire_in: 2 weeks
2631
when: always
@@ -35,19 +40,7 @@ include:
3540
tests_macos_gitlab_amd64:
3641
extends: .tests_macos_gitlab
3742
tags: ["macos:ventura-amd64", "specific:true"]
38-
after_script:
39-
- !reference [.vault_login]
40-
- !reference [.select_python_env_commands]
41-
- !reference [.upload_junit_source]
42-
- !reference [.upload_coverage]
4343

4444
tests_macos_gitlab_arm64:
4545
extends: .tests_macos_gitlab
46-
rules:
47-
!reference [.manual]
4846
tags: ["macos:ventura-arm64", "specific:true"]
49-
after_script:
50-
- !reference [.vault_login]
51-
- !reference [.select_python_env_commands]
52-
- !reference [.upload_junit_source]
53-
- !reference [.upload_coverage]

omnibus/config/software/datadog-agent-integrations-py3.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
when linux_target?
8787
arm_target? ? "linux-aarch64" : "linux-x86_64"
8888
when osx_target?
89-
"macos-x86_64"
89+
arm_target? ? "macos-aarch64" : "macos-x86_64"
9090
when windows_target?
9191
"windows-x86_64"
9292
end + "_#{python_version}.txt"

omnibus/config/software/datadog-agent.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@
256256
systray_build_dir = "#{project_dir}/comp/core/gui/guiimpl/systray"
257257
# Target OSX 10.10 (it brings significant changes to Cocoa and Foundation APIs, and older versions of OSX are EOL'ed)
258258
# Add @executable_path/../Frameworks to rpath to find the swift libs in the Frameworks folder.
259-
command 'swiftc -O -swift-version "5" -target "x86_64-apple-macosx10.10" -Xlinker \'-rpath\' -Xlinker \'@executable_path/../Frameworks\' Sources/*.swift -o gui', cwd: systray_build_dir
259+
target = arm_target? ? 'arm64-apple-macosx11.0' : 'x86_64-apple-macosx10.10'
260+
command "swiftc -O -swift-version \"5\" -target \"#{target}\" -Xlinker '-rpath' -Xlinker '@executable_path/../Frameworks' Sources/*.swift -o gui", cwd: systray_build_dir
260261
copy "#{systray_build_dir}/gui", "#{app_temp_dir}/MacOS/"
261262
copy "#{systray_build_dir}/agent.png", "#{app_temp_dir}/MacOS/"
262263
end

omnibus/config/software/openssl3.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
configure_args = []
6161
if mac_os_x?
6262
configure_cmd = "./Configure"
63-
configure_args << "darwin64-x86_64-cc"
63+
configure_args << "darwin64-#{arm_target? ? "arm64" : "x86_64"}-cc"
6464
elsif windows?
6565
configure_cmd = "perl.exe ./Configure"
6666
configure_args << (windows_arch_i386? ? "mingw" : "mingw64")

0 commit comments

Comments
 (0)