Skip to content

Commit fabcc33

Browse files
committed
Merge remote-tracking branch 'origin/master' into seth.samuel/DBMON-6558-add-agent-health-events-for-postgres-setup-issues
2 parents 7515889 + 413f117 commit fabcc33

185 files changed

Lines changed: 4280 additions & 1162 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
name: Setup ddev
2+
description: Install uv, restore the shared Python dependency cache, and install ddev.
3+
4+
inputs:
5+
install-mode:
6+
description: >-
7+
Install source for ddev. Allowed values: local (install editable ddev and
8+
datadog_checks_dev from this checkout), pypi (install ddev from PyPI).
9+
required: false
10+
default: local
11+
cache-profile:
12+
description: >-
13+
Cache key profile to restore for local installs. Ignored when install-mode
14+
is pypi. Allowed values: local-ddev-base (local ddev, datadog_checks_dev,
15+
and datadog_checks_base dependencies), local-ddev (local ddev and
16+
datadog_checks_dev dependencies).
17+
required: false
18+
default: local-ddev-base
19+
ddev-version:
20+
description: Optional PyPI ddev version specifier, for example ==16.0.0.
21+
required: false
22+
default: ""
23+
24+
runs:
25+
using: composite
26+
steps:
27+
- name: Validate inputs
28+
shell: bash
29+
env:
30+
CACHE_PROFILE: ${{ inputs.cache-profile }}
31+
INSTALL_MODE: ${{ inputs.install-mode }}
32+
run: |-
33+
case "$INSTALL_MODE" in
34+
local|pypi) ;;
35+
*)
36+
echo "::error::Invalid install-mode '$INSTALL_MODE'. Allowed values: local, pypi."
37+
exit 1
38+
;;
39+
esac
40+
41+
case "$CACHE_PROFILE" in
42+
local-ddev-base|local-ddev) ;;
43+
*)
44+
echo "::error::Invalid cache-profile '$CACHE_PROFILE'. Allowed values: local-ddev-base, local-ddev."
45+
exit 1
46+
;;
47+
esac
48+
49+
- name: Compute cache date
50+
id: cache-date
51+
shell: bash
52+
run: echo "date=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
53+
54+
- name: Install uv
55+
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
56+
with:
57+
enable-cache: false
58+
59+
- name: Restore local ddev cache
60+
if: ${{ inputs.install-mode == 'local' && inputs.cache-profile == 'local-ddev-base' }}
61+
id: restore-local-ddev-base-cache
62+
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
63+
with:
64+
path: |
65+
${{ runner.os == 'Windows' && '~\AppData\Local\uv\cache' || runner.os == 'macOS' && '~/Library/Caches/uv' || '~/.cache/uv' }}
66+
${{ runner.os == 'Windows' && '~\AppData\Local\pip\Cache' || runner.os == 'macOS' && '~/Library/Caches/pip' || '~/.cache/pip' }}
67+
key: >-
68+
${{ format(
69+
'v02-uv-{0}-{1}-{2}-{3}-{4}',
70+
env.pythonLocation,
71+
hashFiles('datadog_checks_base/pyproject.toml'),
72+
hashFiles('datadog_checks_dev/pyproject.toml'),
73+
hashFiles('ddev/pyproject.toml'),
74+
steps.cache-date.outputs.date
75+
)}}
76+
restore-keys: |-
77+
${{ format(
78+
'v02-uv-{0}-{1}-{2}-{3}-',
79+
env.pythonLocation,
80+
hashFiles('datadog_checks_base/pyproject.toml'),
81+
hashFiles('datadog_checks_dev/pyproject.toml'),
82+
hashFiles('ddev/pyproject.toml')
83+
)}}
84+
${{ format(
85+
'v02-uv-{0}-{1}-{2}-{3}',
86+
env.pythonLocation,
87+
hashFiles('datadog_checks_base/pyproject.toml'),
88+
hashFiles('datadog_checks_dev/pyproject.toml'),
89+
hashFiles('ddev/pyproject.toml')
90+
)}}
91+
v02-uv-${{ env.pythonLocation }}
92+
93+
- name: Restore local ddev cache without base package
94+
if: ${{ inputs.install-mode == 'local' && inputs.cache-profile == 'local-ddev' }}
95+
id: restore-local-ddev-cache
96+
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
97+
with:
98+
path: |
99+
${{ runner.os == 'Windows' && '~\AppData\Local\uv\cache' || runner.os == 'macOS' && '~/Library/Caches/uv' || '~/.cache/uv' }}
100+
${{ runner.os == 'Windows' && '~\AppData\Local\pip\Cache' || runner.os == 'macOS' && '~/Library/Caches/pip' || '~/.cache/pip' }}
101+
key: >-
102+
${{ format(
103+
'v02-uv-local-ddev-{0}-{1}-{2}-{3}',
104+
env.pythonLocation,
105+
hashFiles('datadog_checks_dev/pyproject.toml'),
106+
hashFiles('ddev/pyproject.toml'),
107+
steps.cache-date.outputs.date
108+
)}}
109+
restore-keys: |-
110+
${{ format(
111+
'v02-uv-local-ddev-{0}-{1}-{2}-',
112+
env.pythonLocation,
113+
hashFiles('datadog_checks_dev/pyproject.toml'),
114+
hashFiles('ddev/pyproject.toml')
115+
)}}
116+
${{ format(
117+
'v02-uv-local-ddev-{0}-{1}-{2}',
118+
env.pythonLocation,
119+
hashFiles('datadog_checks_dev/pyproject.toml'),
120+
hashFiles('ddev/pyproject.toml')
121+
)}}
122+
v02-uv-local-ddev-${{ env.pythonLocation }}
123+
124+
- name: Restore PyPI ddev cache
125+
if: ${{ inputs.install-mode == 'pypi' }}
126+
id: restore-pypi-ddev-cache
127+
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
128+
with:
129+
path: |
130+
${{ runner.os == 'Windows' && '~\AppData\Local\uv\cache' || runner.os == 'macOS' && '~/Library/Caches/uv' || '~/.cache/uv' }}
131+
${{ runner.os == 'Windows' && '~\AppData\Local\pip\Cache' || runner.os == 'macOS' && '~/Library/Caches/pip' || '~/.cache/pip' }}
132+
key: >-
133+
${{ format(
134+
'v02-uv-pypi-ddev-{0}-{1}-{2}',
135+
env.pythonLocation,
136+
inputs.ddev-version || 'latest',
137+
steps.cache-date.outputs.date
138+
)}}
139+
restore-keys: |-
140+
${{ format(
141+
'v02-uv-pypi-ddev-{0}-{1}-',
142+
env.pythonLocation,
143+
inputs.ddev-version || 'latest'
144+
)}}
145+
${{ format(
146+
'v02-uv-pypi-ddev-{0}-{1}',
147+
env.pythonLocation,
148+
inputs.ddev-version || 'latest'
149+
)}}
150+
v02-uv-pypi-ddev-${{ env.pythonLocation }}
151+
152+
- name: Install ddev from local folder
153+
if: ${{ inputs.install-mode == 'local' }}
154+
shell: bash
155+
run: uv pip install --system -e ./datadog_checks_dev[cli] -e ./ddev
156+
157+
- name: Install ddev from PyPI
158+
if: ${{ inputs.install-mode == 'pypi' }}
159+
shell: bash
160+
run: uv pip install --system "ddev${{ inputs.ddev-version }}"
161+
162+
- name: Save local ddev cache
163+
if: ${{ inputs.install-mode == 'local' && inputs.cache-profile == 'local-ddev-base' && steps.restore-local-ddev-base-cache.outputs.cache-hit != 'true' }}
164+
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
165+
continue-on-error: true
166+
with:
167+
path: |
168+
${{ runner.os == 'Windows' && '~\AppData\Local\uv\cache' || runner.os == 'macOS' && '~/Library/Caches/uv' || '~/.cache/uv' }}
169+
${{ runner.os == 'Windows' && '~\AppData\Local\pip\Cache' || runner.os == 'macOS' && '~/Library/Caches/pip' || '~/.cache/pip' }}
170+
key: ${{ steps.restore-local-ddev-base-cache.outputs.cache-primary-key }}
171+
172+
- name: Save local ddev cache without base package
173+
if: ${{ inputs.install-mode == 'local' && inputs.cache-profile == 'local-ddev' && steps.restore-local-ddev-cache.outputs.cache-hit != 'true' }}
174+
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
175+
continue-on-error: true
176+
with:
177+
path: |
178+
${{ runner.os == 'Windows' && '~\AppData\Local\uv\cache' || runner.os == 'macOS' && '~/Library/Caches/uv' || '~/.cache/uv' }}
179+
${{ runner.os == 'Windows' && '~\AppData\Local\pip\Cache' || runner.os == 'macOS' && '~/Library/Caches/pip' || '~/.cache/pip' }}
180+
key: ${{ steps.restore-local-ddev-cache.outputs.cache-primary-key }}
181+
182+
- name: Save PyPI ddev cache
183+
if: ${{ inputs.install-mode == 'pypi' && steps.restore-pypi-ddev-cache.outputs.cache-hit != 'true' }}
184+
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
185+
continue-on-error: true
186+
with:
187+
path: |
188+
${{ runner.os == 'Windows' && '~\AppData\Local\uv\cache' || runner.os == 'macOS' && '~/Library/Caches/uv' || '~/.cache/uv' }}
189+
${{ runner.os == 'Windows' && '~\AppData\Local\pip\Cache' || runner.os == 'macOS' && '~/Library/Caches/pip' || '~/.cache/pip' }}
190+
key: ${{ steps.restore-pypi-ddev-cache.outputs.cache-primary-key }}

.github/workflows/build-ddev.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -738,16 +738,12 @@ jobs:
738738
with:
739739
python-version: "${{ env.PYTHON_VERSION }}"
740740

741-
- name: Install uv
742-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
743-
continue-on-error: true
744-
with:
745-
enable-cache: false
746-
747741
- name: Install ddev from local folder
748742
continue-on-error: true
749-
working-directory: .
750-
run: uv pip install --system -e ./datadog_checks_dev[cli] -e ./ddev
743+
uses: ./.github/actions/setup-ddev
744+
with:
745+
install-mode: local
746+
cache-profile: local-ddev-base
751747

752748
- name: Configure ddev
753749
continue-on-error: true

.github/workflows/config/labeler.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ base_package:
33
- any-glob-to-any-file: datadog_checks_base/**/*
44
changelog/no-changelog:
55
- changed-files:
6-
- any-glob-to-any-file:
6+
- any-glob-to-all-files:
77
- requirements-agent-release.txt
88
- '**/__about__.py'
9+
- '**/CHANGELOG.md'
10+
- '**/changelog.d/*'
11+
- .in-toto/**
912
ddev:
1013
- changed-files:
1114
- any-glob-to-any-file: ddev/**/*

.github/workflows/docs.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,11 @@ jobs:
3434
with:
3535
python-version: '3.13'
3636

37-
- name: Install uv
38-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
39-
with:
40-
enable-cache: false
41-
4237
- name: Install ddev
43-
run: |
44-
uv pip install --system -e ./datadog_checks_dev[cli] -e ./ddev
38+
uses: ./.github/actions/setup-ddev
39+
with:
40+
install-mode: local
41+
cache-profile: local-ddev-base
4542

4643
- name: Configure ddev
4744
run: |

.github/workflows/measure-disk-usage-master.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ jobs:
4040
policy: integrations-core-api-key
4141

4242
- name: Install ddev
43-
run: |
44-
pip install -e ./datadog_checks_dev[cli]
45-
pip install -e ./ddev
43+
uses: ./.github/actions/setup-ddev
44+
with:
45+
install-mode: local
46+
cache-profile: local-ddev-base
4647

4748
- name: Configure ddev
4849
run: ddev config override

.github/workflows/measure-disk-usage.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ jobs:
3636
policy: integrations-core-api-key
3737

3838
- name: Install ddev
39-
run: |
40-
pip install -e ./datadog_checks_dev[cli]
41-
pip install -e ./ddev
39+
uses: ./.github/actions/setup-ddev
40+
with:
41+
install-mode: local
42+
cache-profile: local-ddev-base
4243

4344
- name: Configure ddev
4445
run: |
@@ -85,4 +86,4 @@ jobs:
8586
with:
8687
name: status_compressed.json
8788
path: status_compressed.json
88-
if-no-files-found: error
89+
if-no-files-found: error

.github/workflows/pr-all-windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ on:
1515
- '.github/workflows/test-all-windows.yml'
1616
# Also run in the action to install test-target scripts changes
1717
- '.github/actions/setup-test-target-scripts/**'
18+
- '.github/actions/setup-ddev/**'
1819

1920
concurrency:
2021
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref }}

.github/workflows/pr-all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- '.github/workflows/test-all.yml'
1717
# Also run if the action to install test-target scripts changes
1818
- '.github/actions/setup-test-target-scripts/**'
19+
- '.github/actions/setup-ddev/**'
1920

2021
concurrency:
2122
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref }}

.github/workflows/release-base.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ jobs:
2626
run: pip install --disable-pip-version-check --upgrade pip setuptools wheel
2727

2828
- name: Install ddev
29-
run: |
30-
pip install -e ./datadog_checks_dev[cli]
31-
pip install -e ./ddev
29+
uses: ./.github/actions/setup-ddev
30+
with:
31+
install-mode: local
32+
cache-profile: local-ddev-base
3233

3334
- name: Configure ddev
3435
run: |

.github/workflows/release-dev.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ jobs:
2626
run: pip install --disable-pip-version-check --upgrade pip setuptools wheel
2727

2828
- name: Install ddev
29-
run: |
30-
pip install -e ./datadog_checks_dev[cli]
31-
pip install -e ./ddev
29+
uses: ./.github/actions/setup-ddev
30+
with:
31+
install-mode: local
32+
cache-profile: local-ddev-base
3233

3334
- name: Configure ddev
3435
run: |

0 commit comments

Comments
 (0)