Skip to content

Commit d075f44

Browse files
committed
Bring latest from master
2 parents 07adbbe + 7207f56 commit d075f44

File tree

19 files changed

+176
-77
lines changed

19 files changed

+176
-77
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
* @DataDog/agent-integrations
77

88
# Documentation
9-
/docs/ @DataDog/documentation @DataDog/agent-integrations
10-
*.md @DataDog/documentation @DataDog/agent-integrations
9+
/docs/ @DataDog/agent-integrations
10+
**/README.md @DataDog/documentation @DataDog/agent-integrations
1111
conf.yaml.example @DataDog/documentation @DataDog/agent-integrations
1212
conf.yaml.default @DataDog/documentation @DataDog/agent-integrations
1313
auto_conf.yaml @DataDog/documentation @DataDog/agent-integrations @DataDog/container-integrations
1414
manifest.json @DataDog/documentation @DataDog/agent-integrations
1515
**/assets @DataDog/documentation @DataDog/agent-integrations
16-
16+
**/metadata.csv @DataDog/documentation @DataDog/agent-integrations
1717

1818
# Dependencies
1919
/.deps/ @DataDog/agent-integrations @DataDog/agent-delivery
@@ -120,7 +120,7 @@ manifest.json @DataDog/documentation @DataDog/agent-integrations
120120
/network_path/*.md @DataDog/network-device-monitoring @DataDog/Networks @DataDog/agent-integrations @DataDog/documentation
121121

122122
/datadog_checks_dev/datadog_checks/dev/tooling/commands/meta/snmp/ @DataDog/ndm-core @DataDog/agent-integrations
123-
/docs/developer/tutorials/snmp/ @DataDog/ndm-core @DataDog/agent-integrations @DataDog/documentation
123+
/docs/developer/tutorials/snmp/ @DataDog/ndm-core @DataDog/agent-integrations
124124

125125
# System checks
126126
/disk/ @DataDog/agent-integrations @DataDog/windows-agent

.gitlab-ci.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,27 +128,37 @@ release-manual:
128128
tagger-image-builder:
129129
stage: build
130130
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:24.0.4-gbi-focal
131-
only:
132-
changes:
133-
- .gitlab/tagger/**/*
134-
- ddev/**/*
135-
- .gitlab-ci.yml
136-
refs:
137-
- master
131+
rules:
132+
- if: $CI_PIPELINE_SOURCE == 'schedule'
133+
when: never
134+
- if: $CI_COMMIT_TAG
135+
when: never
136+
- if: $CI_COMMIT_BRANCH == 'master'
137+
when: always
138+
- changes:
139+
- .gitlab/tagger/**/*
140+
- ddev/**/*
141+
- .gitlab-ci.yml
142+
# Allow to manually trigger a build if we need to
143+
- when: manual
144+
allow_failure: true
138145
script:
139146
- docker buildx build --tag $TAGGER_IMAGE -f .gitlab/tagger/Dockerfile . --push
140-
except: [ tags, schedules ]
141147
tags: [ "arch:amd64" ]
142148

143149
validate-log-intgs-builder:
144150
stage: build
145151
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:24.0.4-gbi-focal
146-
only:
147-
changes:
148-
- .gitlab/validate-logs-intgs/**/*
149-
- .gitlab-ci.yml
150-
refs:
151-
- master
152+
rules:
153+
- if: $CI_PIPELINE_SOURCE == 'schedule'
154+
when: never
155+
- if: $CI_COMMIT_TAG
156+
when: never
157+
- if: $CI_COMMIT_BRANCH == 'master'
158+
when: always
159+
- changes:
160+
- .gitlab/validate-logs-intgs/**/*
161+
- .gitlab-ci.yml
152162
script:
153163
- cd .gitlab/validate-logs-intgs/
154164
- docker buildx build --tag $VALIDATE_LOG_INTGS . --push
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix tracemalloc usage error

datadog_checks_base/datadog_checks/base/checks/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,10 +1305,10 @@ def run(self):
13051305

13061306
enter_pdb(self.check, line=self.init_config['set_breakpoint'], args=(instance,))
13071307
elif self.should_profile_memory():
1308-
# self.init_config['profile_memory'] could be `/tmp/datadog-agent-memory-profiler*`
1308+
# self.init_config.get('profile_memory') could be `/tmp/datadog-agent-memory-profiler*`
13091309
# that is generated by Datadog Agent.
13101310
# If we use `--m-dir` for `agent check` command, a hidden flag, it should be same as a given value.
1311-
namespaces = [self.init_config['profile_memory']]
1311+
namespaces = [self.init_config.get('profile_memory')]
13121312
for id in self.check_id.split(":"):
13131313
namespaces.append(id)
13141314
self.profile_memory(func=self.check, namespaces=namespaces, args=(instance,))

datadog_checks_base/tests/base/checks/test_agent_check.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,3 +1316,24 @@ def test_env_var_logic_preset():
13161316
AgentCheck()
13171317
assert os.getenv('OPENSSL_CONF', None) == preset_conf
13181318
assert os.getenv('OPENSSL_MODULES', None) == preset_modules
1319+
1320+
1321+
@pytest.mark.parametrize(
1322+
"should_profile_value, expected_calls",
1323+
[
1324+
(True, 1),
1325+
(False, 0),
1326+
],
1327+
)
1328+
def test_profile_memory(should_profile_value, expected_calls):
1329+
"""
1330+
Test that profile_memory is called when should_profile_memory is True
1331+
"""
1332+
check = AgentCheck('test', {}, [{}])
1333+
check.should_profile_memory = mock.MagicMock(return_value=should_profile_value)
1334+
check.profile_memory = mock.MagicMock()
1335+
1336+
check.run()
1337+
1338+
assert check.should_profile_memory.call_count == 1
1339+
assert check.profile_memory.call_count == expected_calls
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update release tag to ensure that tags are fetched before getting the list of tags

datadog_checks_dev/datadog_checks/dev/tooling/commands/release/tag.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Licensed under a 3-clause BSD style license (see LICENSE)
44
import click
55

6-
from ...git import git_tag, git_tag_list
6+
from ...git import git_fetch, git_tag, git_tag_list
77
from ...release import get_release_tag_string
88
from ...utils import complete_valid_checks, get_valid_checks, get_version_string
99
from ..console import CONTEXT_SETTINGS, abort, echo_info, echo_success, echo_waiting, echo_warning
@@ -19,7 +19,8 @@
1919
@click.option('--push/--no-push', default=True)
2020
@click.option('--dry-run', '-n', is_flag=True)
2121
@click.option('--skip-prerelease', is_flag=True)
22-
def tag(check, version, push, dry_run, skip_prerelease):
22+
@click.option('--fetch/--no-fetch', default=True)
23+
def tag(check, version, push, dry_run, skip_prerelease, fetch):
2324
"""Tag the HEAD of the git repo with the current release number for a
2425
specific check. The tag is pushed to origin by default.
2526
@@ -28,6 +29,13 @@ def tag(check, version, push, dry_run, skip_prerelease):
2829
Notice: specifying a different version than the one in `__about__.py` is
2930
a maintenance task that should be run under very specific circumstances
3031
(e.g. re-align an old release performed on the wrong commit).
32+
33+
Return codes:
34+
0: Success
35+
1: Invalid command call
36+
2: Nothing to tag
37+
3: Failed to fetch tags
38+
Other: Git tag command returned a non-zero exit code
3139
"""
3240
tagging_all = check == 'all'
3341

@@ -44,6 +52,13 @@ def tag(check, version, push, dry_run, skip_prerelease):
4452

4553
# Check for any new tags
4654
tagged = False
55+
# Fetch all tags from the remote
56+
if fetch:
57+
echo_info('Fetching all tags from remote...')
58+
59+
if (result := git_fetch(tags=True)).code != 0:
60+
abort(f'Failed to fetch tags: {result.stderr}', 3)
61+
4762
existing_tags = git_tag_list()
4863

4964
for check in checks:

datadog_checks_dev/datadog_checks/dev/tooling/git.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from semver import VersionInfo
88

99
from ..fs import chdir
10-
from ..subprocess import run_command
10+
from ..subprocess import SubprocessResult, run_command
1111
from .constants import get_root
1212

1313

@@ -144,6 +144,17 @@ def git_tag(tag_name, push=False):
144144
return result
145145

146146

147+
def git_fetch(remote: str = 'origin', tags: bool = False) -> SubprocessResult:
148+
"""
149+
Fetch all tags from the remote
150+
"""
151+
with chdir(get_root()):
152+
cmd = ['git', 'fetch', remote]
153+
if tags:
154+
cmd.append('--tags')
155+
return run_command(cmd, capture=True)
156+
157+
147158
def git_tag_list(pattern=None, contains=None):
148159
"""
149160
Return a list of all the tags in the git repo matching a regex passed in

datadog_checks_dev/tests/tooling/test_git.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
# All rights reserved
33
# Licensed under a 3-clause BSD style license (see LICENSE)
44
import mock
5+
import pytest
56

67
from datadog_checks.dev.tooling.constants import set_root
78
from datadog_checks.dev.tooling.git import (
89
files_changed,
910
get_commits_since,
1011
get_current_branch,
1112
git_commit,
13+
git_fetch,
1214
git_show_file,
1315
git_tag,
1416
git_tag_list,
@@ -200,3 +202,20 @@ def test_tracked_by_git():
200202
tracked_by_git('bar')
201203
chdir.assert_called_once_with('/foo/')
202204
run.assert_called_once_with('git ls-files --error-unmatch bar', capture=True)
205+
206+
207+
@pytest.mark.parametrize(
208+
'tags, expected_command',
209+
[
210+
(True, ['git', 'fetch', 'origin', '--tags']),
211+
(False, ['git', 'fetch', 'origin']),
212+
],
213+
ids=['with_tags', 'without_tags'],
214+
)
215+
def test_git_fetch(tags: bool, expected_command: list[str]):
216+
with mock.patch('datadog_checks.dev.tooling.git.chdir') as chdir:
217+
with mock.patch('datadog_checks.dev.tooling.git.run_command') as run:
218+
set_root('/foo/')
219+
git_fetch(tags=tags)
220+
chdir.assert_called_once_with('/foo/')
221+
run.assert_called_once_with(expected_command, capture=True)

ddev/tests/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ def isolation() -> Generator[Path, None, None]:
145145
def local_clone(isolation, local_repo) -> Generator[ClonedRepo, None, None]:
146146
cloned_repo_path = isolation / local_repo.name
147147

148+
# Get the current origin remote url
149+
with local_repo.as_cwd():
150+
origin_url = PLATFORM.check_command_output(['git', 'remote', 'get-url', 'origin']).strip()
151+
148152
PLATFORM.check_command_output(
149153
['git', 'clone', '--local', '--shared', '--no-tags', str(local_repo), str(cloned_repo_path)]
150154
)
@@ -154,6 +158,11 @@ def local_clone(isolation, local_repo) -> Generator[ClonedRepo, None, None]:
154158
PLATFORM.check_command_output(['git', 'config', 'commit.gpgsign', 'false'])
155159
PLATFORM.check_command_output(['git', 'config', 'tag.gpgsign', 'false'])
156160

161+
# Set url to point to the origin of the local source and not to the local repo
162+
PLATFORM.check_command_output(['git', 'remote', 'set-url', 'origin', origin_url])
163+
# Now fetch latest updates
164+
PLATFORM.check_command_output(['git', 'fetch', 'origin'])
165+
157166
cloned_repo = ClonedRepo(cloned_repo_path, 'origin/master', 'ddev-testing')
158167
cloned_repo.reset_branch()
159168

gpu/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ datadog:
114114

115115
For **mixed environments**, two different Helm charts need to be deployed with different affinity sets and with one of them joining the other's Cluster Agent [as documented here](https://github.com/DataDog/helm-charts/tree/main/charts/datadog#how-to-join-a-cluster-agent-from-another-helm-chart-deployment-linux).
116116

117+
While the `nvidia.com/gpu.present` tag is commonly used to identify GPU nodes (often automatically added by the NVIDIA GPU operator), your specific environment might use different tags or labeling schemes. It's important to identify the correct tag and value that distinguishes your GPU nodes from non-GPU nodes. You can then adapt the examples below accordingly.
118+
117119
Assuming we have already a `values.yml` file for a regular, non-GPU deployment, the steps to enable GPU monitoring only on GPU nodes are the following:
118120

119121
1. In `agents.affinity`, add a node selector that stops the non-GPU Agent from running on GPU nodes:
@@ -132,7 +134,7 @@ agents:
132134
- "true"
133135
```
134136

135-
The `nvidia.com/gpu.present` tag is used above as it's automatically added to GPU nodes by the NVIDIA GPU operator. However, any other appropriate tag may be chosen.
137+
Additionally, if you need to select nodes based on the presence of a label key, irrespective of its value, you can use the `Exists` [operator](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity). Conversely, to exclude nodes that have a specific label key, you can use `DoesNotExist`. For example, to select nodes that have the label `custom.gpu/available` (regardless of its value), you would use `operator: Exists`.
136138

137139
2. Create another file (for example, `values-gpu.yaml`) to apply on top of the previous one. In this file, enable GPU monitoring, configure the Cluster Agent to join the existing cluster as per the [instructions],(<https://github.com/DataDog/helm-charts/tree/main/charts/datadog#how-to-join-a-cluster-agent-from-another-helm-chart-deployment-linux>) and include the affinity for the GPU nodes:
138140

ivanti_nzta/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": "2.0.0",
33
"app_uuid": "c161337b-578b-4c24-bc14-adf35e0ee0ed",
44
"app_id": "ivanti-nzta",
5-
"display_on_public_website": false,
5+
"display_on_public_website": true,
66
"tile": {
77
"overview": "README.md#Overview",
88
"configuration": "README.md#Setup",

0 commit comments

Comments
 (0)