Skip to content

Commit

Permalink
Merge branch 'master' into vivek-datadog/AGENT-10479
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek-datadog authored Oct 26, 2023
2 parents 9aacd2c + 3e89c67 commit f44a628
Show file tree
Hide file tree
Showing 70 changed files with 535 additions and 696 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-quick-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ jobs:
--diff-file /tmp/diff
--pr-file "$GITHUB_EVENT_PATH"
${{ github.event.pull_request.base.repo.private && '--private' || '' }}
--repo "${{ inputs.repo }}"
2 changes: 1 addition & 1 deletion .in-toto/tag.b9ca7eb3.link

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions cacti/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 2.0.1 / 2023-10-26

***Fixed***:

* Bump the `pymysql` version to 1.1.0 on Python 3 ([#16042](https://github.com/DataDog/integrations-core/pull/16042))
Expand Down
2 changes: 1 addition & 1 deletion cacti/datadog_checks/cacti/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

__version__ = '2.0.0'
__version__ = '2.0.1'
13 changes: 13 additions & 0 deletions changelog_template.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% if sections[""] %}
{% for category, val in definitions.items() if category in sections[""] %}
***{{ definitions[category]['name'] }}***:

{% for text, values in sections[""][category].items() %}
* {{ text }} {{ values|join(', ') }}
{% endfor %}

{% endfor %}
{% else %}
No significant changes.

{% endif %}
2 changes: 2 additions & 0 deletions cilium/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## 3.1.0 / 2023-10-26

***Added***:

* Add missing Azure metrics ([#16073](https://github.com/DataDog/integrations-core/pull/16073))
Expand Down
2 changes: 1 addition & 1 deletion cilium/datadog_checks/cilium/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = '3.0.0'
__version__ = '3.1.0'
6 changes: 6 additions & 0 deletions cisco_aci/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## 2.4.1 / 2023-10-26

***Fixed***:

* Bump the `cryptography` version to 41.0.5 ([#16083](https://github.com/DataDog/integrations-core/pull/16083))

## 2.4.0 / 2023-09-29

***Added***:
Expand Down
2 changes: 1 addition & 1 deletion cisco_aci/datadog_checks/cisco_aci/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

__version__ = "2.4.0"
__version__ = "2.4.1"
2 changes: 1 addition & 1 deletion cisco_aci/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ license = "BSD-3-Clause"
[project.optional-dependencies]
deps = [
"cryptography==3.3.2; python_version < '3.0'",
"cryptography==41.0.4; python_version > '3.0'",
"cryptography==41.0.5; python_version > '3.0'",
]

[project.urls]
Expand Down
6 changes: 6 additions & 0 deletions datadog_checks_base/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

* Bump librdkafka and confluent-kafka to v2.3.0 ([#16088](https://github.com/DataDog/integrations-core/pull/16088))

## 34.1.1 / 2023-10-26

***Fixed***:

* Bump the `cryptography` version to 41.0.5 ([#16083](https://github.com/DataDog/integrations-core/pull/16083))

## 34.1.0 / 2023-10-20

***Added***:
Expand Down
2 changes: 1 addition & 1 deletion datadog_checks_base/datadog_checks/base/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = "34.1.0"
__version__ = "34.1.1"
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cm-client==45.0.4
confluent-kafka==2.3.0; python_version > '3.0'
contextlib2==0.6.0.post1; python_version < '3.0'
cryptography==3.3.2; python_version < '3.0'
cryptography==41.0.4; python_version > '3.0'
cryptography==41.0.5; python_version > '3.0'
ddtrace==0.32.2; sys_platform == 'win32' and python_version < '3.0'
ddtrace==0.53.2; sys_platform != 'win32' and python_version < '3.0'
ddtrace==1.11.2; python_version > '3.0'
Expand Down
2 changes: 1 addition & 1 deletion datadog_checks_base/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ deps = [
"cachetools==5.3.1; python_version > '3.0'",
"contextlib2==0.6.0.post1; python_version < '3.0'",
"cryptography==3.3.2; python_version < '3.0'",
"cryptography==41.0.4; python_version > '3.0'",
"cryptography==41.0.5; python_version > '3.0'",
"ddtrace==0.32.2; sys_platform == 'win32' and python_version < '3.0'",
"ddtrace==0.53.2; sys_platform != 'win32' and python_version < '3.0'",
"ddtrace==1.11.2; python_version > '3.0'",
Expand Down
4 changes: 3 additions & 1 deletion datadog_checks_dev/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# CHANGELOG - Datadog Checks Dev

## Unreleased
<!-- towncrier release notes start -->

## 27.0.1 / 2023-10-26

***Fixed***:

Expand Down
3 changes: 3 additions & 0 deletions datadog_checks_dev/changelog.d/15983.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Generate changelogs from fragment files using towncrier.
There are no changes to the ddev commands, only to their outputs.
We are making this change to avoid merge conflicts in high-traffic packages where people used to have to modify one CHANGELOG.md file.
2 changes: 1 addition & 1 deletion datadog_checks_dev/datadog_checks/dev/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Datadog, Inc. 2018-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
__version__ = '27.0.0'
__version__ = '27.0.1'
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,53 @@
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import sys
from collections import namedtuple
from datetime import date, datetime
from io import StringIO

import click
from semver import VersionInfo

from ....fs import stream_file_lines, write_file
from ...constants import get_root
from datadog_checks.dev.tooling.constants import get_root

from ...utils import complete_testable_checks, get_valid_checks, get_version_string
from ..console import CONTEXT_SETTINGS, abort, echo_info, echo_success, validate_check_arg
from ..console import CONTEXT_SETTINGS, abort, echo_info, run_or_abort, validate_check_arg

ChangelogEntry = namedtuple('ChangelogEntry', 'number, title, url, author, author_url, from_contributor')


def towncrier(target_dir, cmd, *cmd_args):
'''
Run towncrier command with its arguments in target_dir.
'''
tc_res = run_or_abort(
[
sys.executable,
"-m",
"towncrier",
cmd,
"--config",
os.path.join(get_root(), "towncrier.toml"),
"--dir",
target_dir,
*cmd_args,
],
capture='both',
)
echo_info(tc_res.stdout.rstrip())
return tc_res


@click.command(context_settings=CONTEXT_SETTINGS, short_help='Update the changelog for a check')
@click.argument('check', shell_complete=complete_testable_checks, callback=validate_check_arg)
@click.argument('version')
@click.argument('old_version', required=False)
@click.option('--end')
@click.option('--initial', is_flag=True)
@click.option('--organization', '-r', default='DataDog')
@click.option('--quiet', '-q', is_flag=True)
@click.option('--dry-run', '-n', is_flag=True)
@click.option('--output-file', '-o', default='CHANGELOG.md', show_default=True)
@click.option('--tag-pattern', default=None, hidden=True)
@click.option('--tag-prefix', '-tp', default='v', show_default=True)
@click.option('--no-semver', '-ns', default=False, is_flag=True)
@click.option('--exclude-branch', default=None, help="Exclude changes comming from a specific branch")
@click.pass_context
def changelog(
ctx,
check,
version,
old_version,
end,
initial,
quiet,
dry_run,
output_file,
tag_pattern,
tag_prefix,
no_semver,
organization,
exclude_branch,
):
@click.option('--date', default=None)
def changelog(check, version, old_version, quiet, dry_run, tag_pattern, tag_prefix, no_semver, date):
"""Perform the operations needed to update the changelog.
This method is supposed to be used by other tasks and not directly.
Expand All @@ -71,69 +72,9 @@ def changelog(
if not quiet:
echo_info(f'Current version of check {check}: {cur_version}, bumping to: {version}')

# read the old contents
if check:
changelog_path = os.path.join(get_root(), check, output_file)
else:
changelog_path = os.path.join(get_root(), output_file)
old = list(stream_file_lines(changelog_path))

if initial:
# For initial releases, just keep the ddev generated CHANGELOG but update the date to today
for idx, line in enumerate(old):
if line.startswith("## 1.0.0"):
old[idx] = f"## 1.0.0 / {date.today()}\n"
break
write_result(dry_run, changelog_path, ''.join(old), num_changes=1)
return

# find the first header below the Unreleased section
header_index = 2
for index in range(2, len(old)):
if old[index].startswith("##") and "## Unreleased" not in old[index]:
header_index = index
break

# get text from the unreleased section
if header_index == 4:
abort('There are no changes for this integration')

changelogs = old[4:header_index]
num_changelogs = 0
for line in changelogs:
if line.startswith('* '):
num_changelogs += 1

# the header contains version and date
header = f"## {version} / {datetime.utcnow().strftime('%Y-%m-%d')}\n"

# store the new changelog in memory
new_entry = StringIO()
new_entry.write(header)
new_entry.write('\n')

# write the new changelog in memory
changelog_buffer = StringIO()

# preserve the title and unreleased section
changelog_buffer.write(''.join(old[:4]))

# prepend the new changelog to the old contents
# make the command idempotent
if header not in old:
changelog_buffer.write(new_entry.getvalue())

# append the rest of the old changelog
changelog_buffer.write(''.join(old[4:]))

write_result(dry_run, changelog_path, changelog_buffer.getvalue(), num_changelogs)


def write_result(dry_run, changelog_path, final_output, num_changes):
# print on the standard out in case of a dry run
build_args = ["--yes", "--version", version]
if dry_run:
echo_info(final_output)
else:
# overwrite the old changelog
write_file(changelog_path, final_output)
echo_success(f"Successfully generated {num_changes} change{'s' if num_changes > 1 else ''}")
build_args.append("--draft")
if date:
build_args.extend(["--date", date])
towncrier(os.path.join(get_root(), check), "build", *build_args)
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ def make(ctx, checks, version, end, initial_release, skip_sign, sign_only, exclu
if check == 'ddev':
cur_version = get_version_string(check)
_, changelog_types = ctx.invoke(
changes, check=check, tag_pattern='ddev-v.+', tag_prefix='ddev-v', end=end, dry_run=True
changes, check=check, tag_pattern='ddev-v.+', tag_prefix='ddev-v', dry_run=True
)
else:
cur_version, changelog_types = ctx.invoke(changes, check=check, end=end, dry_run=True)
cur_version, changelog_types = ctx.invoke(changes, check=check, dry_run=True)

echo_debug(f'Current version: {cur_version}. Changes: {changelog_types}')
if not changelog_types:
Expand All @@ -149,18 +149,15 @@ def make(ctx, checks, version, end, initial_release, skip_sign, sign_only, exclu

# update the CHANGELOG
echo_waiting('Updating the changelog... ', nl=False)
# TODO: Avoid double GitHub API calls when bumping all checks at once
ctx.invoke(
changelog,
check=check,
version=version,
old_version=None if check == 'ddev' else cur_version,
end=end,
initial=initial_release,
tag_pattern='ddev-v.+' if check == 'ddev' else None,
tag_prefix='ddev-v' if check == 'ddev' else 'v',
quiet=True,
dry_run=False,
tag_pattern='ddev-v.+' if check == 'ddev' else None,
tag_prefix='ddev-v' if check == 'ddev' else 'v',
)
echo_success('success!')

Expand Down
Loading

0 comments on commit f44a628

Please sign in to comment.