Skip to content

Commit a283e57

Browse files
authored
Merge branch 'master' into ian.bucad/cisco-firepower-asa-memory-coverage
2 parents 90f7d12 + 0a4bb24 commit a283e57

68 files changed

Lines changed: 3844 additions & 337 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.

.github/workflows/release-trigger.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,30 @@ jobs:
6262
echo "is-stable-release=false" >> "$GITHUB_OUTPUT"
6363
fi
6464
65+
# TODO: this notification currently runs before the approval gate, so it
66+
# announces a *pending* release. Once the `release` environment gate is removed
67+
# the release starts immediately — switch `needs` back to the release step and
68+
# update the wording in notify_slack.py to "release starting".
69+
notify:
70+
name: Notify pending release
71+
needs: context
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Checkout notification script
75+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
76+
with:
77+
fetch-depth: 1
78+
sparse-checkout: .github/workflows/scripts
79+
- name: Notify Slack of pending release
80+
env:
81+
SLACK_API_TOKEN: ${{ secrets.SLACK_API_TOKEN }}
82+
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID_AGENT_INTEGRATIONS_RELEASE }}
83+
SOURCE_REPO: integrations-core
84+
REF: ${{ github.event_name == 'workflow_dispatch' && inputs.source-repo-ref || github.sha }}
85+
PACKAGES: ${{ inputs.packages || '' }}
86+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
87+
run: python3 .github/workflows/scripts/notify_slack.py
88+
6589
approve:
6690
name: Await release approval
6791
needs: context
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
"""Post a 'wheel release starting' Slack notification via chat.postMessage.
2+
3+
Env: SLACK_API_TOKEN, SLACK_CHANNEL_ID (both required or no-op), SOURCE_REPO,
4+
REF, PACKAGES, RUN_URL. Slack/network errors warn and never fail the job.
5+
"""
6+
import json
7+
import os
8+
import urllib.error
9+
import urllib.request
10+
11+
SLACK_URL = "https://slack.com/api/chat.postMessage"
12+
13+
14+
def build_text(source_repo: str, ref: str, packages: str, run_url: str) -> str:
15+
"""Return the release notification Slack message body."""
16+
# TODO: this fires before the approval gate, so the release is pending. Once
17+
# the `release` environment gate is removed, reword to "Wheel release starting"
18+
# with a "View release run" link, since the release will start immediately.
19+
return (
20+
f":hourglass_flowing_sand: *Wheel release pending approval* — `{source_repo}`\n"
21+
f"• ref: `{ref[:12] or '—'}`\n"
22+
f"• packages: {packages.strip() or 'auto-detect from tags at HEAD'}\n"
23+
f"• <{run_url}|Review &amp; approve →>"
24+
)
25+
26+
27+
def post(token: str, channel: str, text: str) -> None:
28+
"""Post *text* to *channel*, warning (not failing) on error."""
29+
data = json.dumps({"channel": channel, "text": text, "unfurl_links": False}).encode()
30+
request = urllib.request.Request(
31+
SLACK_URL,
32+
data=data,
33+
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json; charset=utf-8"},
34+
)
35+
try:
36+
with urllib.request.urlopen(request, timeout=15) as response:
37+
body = json.loads(response.read())
38+
except (urllib.error.URLError, TimeoutError, ValueError) as e:
39+
print(f"::warning::Slack request failed: {e}")
40+
return
41+
if not body.get("ok"):
42+
print(f"::warning::Slack notification failed: {body.get('error', 'unknown error')}")
43+
44+
45+
def main() -> None:
46+
token = os.environ.get("SLACK_API_TOKEN", "").strip()
47+
channel = os.environ.get("SLACK_CHANNEL_ID", "").strip()
48+
if not token or not channel:
49+
print("Slack token or channel not configured; skipping notification.")
50+
return
51+
post(
52+
token,
53+
channel,
54+
build_text(
55+
os.environ.get("SOURCE_REPO", "integrations-core"),
56+
os.environ.get("REF", ""),
57+
os.environ.get("PACKAGES", ""),
58+
os.environ.get("RUN_URL", ""),
59+
),
60+
)
61+
62+
63+
if __name__ == "__main__":
64+
main()
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""Tests for notify_slack."""
2+
import urllib.error
3+
from unittest.mock import patch
4+
5+
import notify_slack
6+
7+
8+
def test_build_text_lists_packages():
9+
text = notify_slack.build_text("integrations-core", "abcdef1234567890", '["postgres"]', "http://run")
10+
assert "pending approval" in text
11+
assert '["postgres"]' in text
12+
assert "`abcdef123456`" in text
13+
assert "http://run" in text
14+
15+
16+
def test_build_text_auto_detect_and_dash_ref():
17+
text = notify_slack.build_text("marketplace", "", "", "http://run")
18+
assert "auto-detect from tags at HEAD" in text
19+
assert "ref: `—`" in text
20+
21+
22+
def test_main_no_op_without_config(monkeypatch):
23+
monkeypatch.delenv("SLACK_API_TOKEN", raising=False)
24+
monkeypatch.setenv("SLACK_CHANNEL_ID", "C1")
25+
with patch.object(notify_slack, "post") as post:
26+
notify_slack.main()
27+
post.assert_not_called()
28+
29+
30+
def test_main_posts_when_configured(monkeypatch):
31+
monkeypatch.setenv("SLACK_API_TOKEN", "xoxb")
32+
monkeypatch.setenv("SLACK_CHANNEL_ID", "C1")
33+
with patch.object(notify_slack, "post") as post:
34+
notify_slack.main()
35+
post.assert_called_once()
36+
37+
38+
def test_post_warns_on_error(capsys):
39+
with patch("urllib.request.urlopen", side_effect=urllib.error.URLError("boom")):
40+
notify_slack.post("token", "C1", "hi")
41+
assert "failed" in capsys.readouterr().out

.in-toto/tag.ec45eb9d.link

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

AGENTS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ ddev -x validate config -s <INTEGRATION_NAME>
7171
ddev -x validate models -s <INTEGRATION_NAME>
7272
```
7373

74+
## Worktrees
75+
76+
When working in a git worktree (anything other than the primary checkout), run `ddev config override` as the first step after entering the directory. This writes a gitignored `.ddev.toml` that points the `core` repo at the current worktree.
77+
78+
Without this override, `ddev` resolves `core` to whatever the global configuration points at, which is usually a different worktree. Every `ddev test`, `ddev test --lint`, and `ddev env` command would then run against the wrong checkout and produce misleading results.
79+
80+
Verify the override took effect with `ddev config show`: the `[repos]` `core` entry should point at the current directory and be marked as an override.
81+
82+
If `ddev config override` cannot write the file in your environment, create `.ddev.toml` by hand at the worktree root:
83+
84+
```toml
85+
repo = "core"
86+
87+
[repos]
88+
core = "<absolute-path-to-this-worktree>"
89+
```
90+
7491
## Testing
7592

7693
Run unit and integration tests with `ddev --no-interactive test <INTEGRATION>`. For example, for the pgbouncer integration, run `ddev --no-interactive test pgbouncer`.
@@ -129,6 +146,8 @@ For E2E tests, `--recreate` performs `docker compose down --volumes` followed by
129146

130147
Format code with `ddev test -fs <INTEGRATION>`. For example, for the pgbouncer integration, run `ddev test -fs pgbouncer`.
131148

149+
Always run linting and formatting through `ddev`: use `ddev test -fs <INTEGRATION>` to fix issues and `ddev test --lint <INTEGRATION>` (or `-s`) to check them. Do not invoke `ruff`, `black`, or `mypy` directly. CI runs them inside `ddev`'s pinned hatch lint environment, and a different locally installed version can report different results, passing locally while failing CI or the other way around.
150+
132151
## Changelog Management
133152

134153
Changelog entries are required for any change to a file that is shipped with the Agent. This includes Python sources under `datadog_checks/`, `pyproject.toml`, and the integration's `conf.yaml.example`. Changes limited to tests, fixtures, or developer-only assets do not need a changelog entry.

AGENT_CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Datadog Agent version [7.80.4](https://github.com/DataDog/datadog-agent/blob/master/CHANGELOG.rst#7804)
2+
3+
### Integration Updates
4+
* Windows Service [6.7.2](https://github.com/DataDog/integrations-core/blob/master/windows_service/CHANGELOG.md)
5+
16
## Datadog Agent version [7.80.3](https://github.com/DataDog/datadog-agent/blob/master/CHANGELOG.rst#7803)
27

38
* There were no integration updates for this version of the Agent.

0 commit comments

Comments
 (0)