Skip to content

Commit 6616ffc

Browse files
[ABLD-27] Prepare deployment of Agent v7.70+ for macOS (arm64/x86_64) (#664)
* Prepare deployment of Agent v7.70+ for macOS (arm64/x86_64) This change is meant to take into account how agent deliverables for macOS embed architecture qualifiers (name & metadata) starting from version 7.70 and some of the practical implications. A word of caution: I'm far from being fluent with `ansible`, let alone with the local setup and conventions, so the change is unlikely to work out of the box nor to be exhaustive. Following upstream changes might be of interest to reviewers: - architecture qualifiers: - DataDog/omnibus-ruby#240 - DataDog/agent-release-management#364 - new build for AArch64/ARM64: - DataDog/datadog-agent#37676 - DataDog/agent-release-management#365 * Fix CI-reported failures Altogether: - use method `GET` w/ `return_content: false` instead of `HEAD` (not necessarily implemented) - move `uri`-unsupported `retries` to upper level - pass `status_code: 200` to populate `datadog_macos_agent7_latest_arch_check.status` - make `ansible-lint` happy (at the expense of readability) * Apply Fanny's suggestion To prevent an undefined variable error. Co-authored-by: Fanny Jiang <fanny.jiang@datadoghq.com> * Make `ansible-lint` happy again Use a folded block scalar to overcome the 160-char line limitation. --------- Co-authored-by: Fanny Jiang <fanny.jiang@datadoghq.com>
1 parent e8eb161 commit 6616ffc

5 files changed

Lines changed: 35 additions & 7 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ jobs:
186186
xcode: 16.2.0
187187
steps:
188188
- checkout
189+
#TODO(regis): remove Rosetta 2 translation for Agent v7.70+
189190
- run:
190191
name: Install Rosetta 2
191192
command: printf 'A\n' | sudo softwareupdate --install-rosetta

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,12 @@ To override the default behavior, set this variable to something other than an e
328328

329329
When the variable `datadog_macos_download_url` is not set, the official macOS DMG package corresponding to the `datadog_agent_major_version` is used:
330330

331-
| Agent version | Default macOS DMG package URL |
332-
|---------------|--------------------------------------------------------------|
333-
| 6 | https://install.datadoghq.com/datadog-agent-6-latest.dmg |
334-
| 7 | https://install.datadoghq.com/datadog-agent-7-latest.dmg |
331+
| Agent version | Default macOS DMG package URL |
332+
|-----------------------|-----------------------------------------------------------------|
333+
| 6 | https://install.datadoghq.com/datadog-agent-6-latest.dmg |
334+
| 7.69- | https://install.datadoghq.com/datadog-agent-7-latest.dmg |
335+
| 7.70+ (Intel Mac) | https://install.datadoghq.com/datadog-agent-7-latest.x86_64.dmg |
336+
| 7.70+ (Apple Silicon) | https://install.datadoghq.com/datadog-agent-7-latest.arm64.dmg |
335337

336338
To override the default behavior, set this variable to something other than an empty string.
337339

defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ datadog_macos_download_url: ""
249249
# These variables are for internal use only, do not modify them.
250250
datadog_macos_agent6_latest_url: "https://install.datadoghq.com/datadog-agent-6-latest.dmg"
251251
datadog_macos_agent7_latest_url: "https://install.datadoghq.com/datadog-agent-7-latest.dmg"
252+
datadog_macos_agent7_latest_arch_url: "https://install.datadoghq.com/datadog-agent-7-latest.{{ ansible_facts.architecture }}.dmg"
252253

253254
# If datadog_agent_version is set, the role will use the following url prefix instead, and append the version number to it
254255
# in order to get the full url to the dmg package.

tasks/pkg-macos/macos_agent_latest.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,27 @@
44
agent_dd_download_url: "{{ datadog_macos_download_url }}"
55
when: datadog_macos_download_url | default('', true) | length > 0
66

7+
- name: Check architecture-specific URL for latest Agent 7
8+
ansible.builtin.uri:
9+
url: "{{ datadog_macos_agent7_latest_arch_url }}"
10+
method: GET
11+
follow_redirects: all
12+
return_content: false
13+
status_code: 200
14+
register: datadog_macos_agent7_latest_arch_check
15+
failed_when: false
16+
retries: 2
17+
when:
18+
- datadog_macos_download_url | default('', true) | length == 0
19+
- agent_datadog_agent_major_version | int >= 7
20+
721
- name: Set agent download filename to latest
822
ansible.builtin.set_fact:
9-
agent_dd_download_url: "{% if agent_datadog_agent_major_version | int == 7 %}
10-
{{ datadog_macos_agent7_latest_url }} {% else %}{{ datadog_macos_agent6_latest_url }}{% endif %}"
23+
agent_dd_download_url: >-
24+
{%- if agent_datadog_agent_major_version | int < 7 -%}
25+
{{ datadog_macos_agent6_latest_url }}{%- else -%}
26+
{%- if datadog_macos_agent7_latest_arch_check is defined and datadog_macos_agent7_latest_arch_check.status == 200 -%}
27+
{{ datadog_macos_agent7_latest_arch_url }}{%- else -%}
28+
{{ datadog_macos_agent7_latest_url }}{%- endif -%}
29+
{%- endif -%}
1130
when: datadog_macos_download_url | default('', true) | length == 0
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
---
22
- name: Set agent download filename to a specific version
33
ansible.builtin.set_fact:
4-
agent_dd_download_url: "{{ datadog_macos_versioned_url }}-{{ agent_datadog_agent_macos_version }}-1.dmg"
4+
agent_dd_download_url: "{{ datadog_macos_versioned_url }}-{{ agent_datadog_agent_macos_version }}-1{{ maybe_arch }}.dmg"
5+
vars:
6+
maybe_arch: >-
7+
{{ '.' + (datadog_agent_macos_architecture | default(ansible_facts.architecture))
8+
if agent_datadog_agent_macos_version is version('7.70', '>=')
9+
else '' }}

0 commit comments

Comments
 (0)