Skip to content

Commit 9938ed8

Browse files
committed
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 d673975 commit 9938ed8

15 files changed

Lines changed: 58 additions & 33 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/nix.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,29 @@ deploy_packages_dogstatsd_suse_rpm-x64-7:
146146
variables:
147147
PACKAGE_ARCH: x86_64
148148

149-
deploy_packages_dmg-x64-a7:
149+
.deploy_packages_dmg:
150150
rules:
151151
!reference [.on_deploy]
152152
stage: deploy_packages
153153
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"]
155-
needs: ["agent_dmg-x64-a7"]
156154
before_script:
157155
- ls $OMNIBUS_PACKAGE_DIR
158156
script:
159-
- $S3_CP_CMD --recursive --exclude "*" --include "datadog-agent-7*.dmg" $OMNIBUS_PACKAGE_DIR $S3_RELEASE_ARTIFACTS_URI/dmg/x86_64/
157+
- $S3_CP_CMD --recursive --exclude "*" --include "datadog-agent-7*.dmg" $OMNIBUS_PACKAGE_DIR $S3_RELEASE_ARTIFACTS_URI/dmg/$PACKAGE_ARCH/
158+
159+
deploy_packages_dmg-x64-a7:
160+
extends: .deploy_packages_dmg
161+
tags: ["arch:amd64"]
162+
needs: ["agent_dmg-x64-a7"]
163+
variables:
164+
PACKAGE_ARCH: x86_64
165+
166+
deploy_packages_dmg-arm64-a7:
167+
extends: .deploy_packages_dmg
168+
tags: ["arch:arm64"]
169+
needs: ["agent_dmg-arm64-a7"]
170+
variables:
171+
PACKAGE_ARCH: arm64
160172

161173
# deploy dogstatsd x64, non-static binary to staging bucket
162174
deploy_staging_dsd:

.gitlab/functional_test/static_quality_gate.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ static_quality_gates:
5151
- windows_msi_and_bosh_zip_x64-a7
5252
# - job: agent_dmg-x64-a7
5353
# optional: True
54+
# - job: agent_dmg-arm64-a7
55+
# optional: True
5456
#
5557
script:
5658
- !reference [.login_to_docker_readonly_crane]

.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")

omnibus/config/software/python3.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
if mac_os_x?
3434
python_configure_options.push("--enable-ipv6",
35-
"--with-universal-archs=intel",
35+
"--with-universal-archs=#{arm_target? ? "universal2" : "intel"}",
3636
"--enable-shared")
3737
elsif linux_target?
3838
python_configure_options.push("--enable-shared",

0 commit comments

Comments
 (0)