Skip to content

Commit

Permalink
Merge branch 'main' into vincent.whitchurch/gotls-periodic
Browse files Browse the repository at this point in the history
  • Loading branch information
vitkyrka authored Nov 27, 2024
2 parents 7c18f13 + c5298c3 commit d19135f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
22 changes: 16 additions & 6 deletions tasks/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ def __get_force_option(force: bool) -> str:
return force_option


def __tag_single_module(ctx, module, agent_version, commit, push, force_option, devel):
def __tag_single_module(ctx, module, agent_version, commit, force_option, devel):
"""Tag a given module."""
tags = []
for tag in module.tag(agent_version):
if devel:
tag += "-devel"
Expand All @@ -146,9 +147,8 @@ def __tag_single_module(ctx, module, agent_version, commit, push, force_option,
message = f"Could not create tag {tag}. Please rerun the task to retry creating the tags (you may need the --force option)"
raise Exit(color_message(message, "red"), code=1)
print(f"Created tag {tag}")
if push:
ctx.run(f"git push origin {tag}{force_option}")
print(f"Pushed tag {tag}")
tags.append(tag)
return tags


@task
Expand All @@ -173,11 +173,17 @@ def tag_modules(ctx, agent_version, commit="HEAD", verify=True, push=True, force
check_version(agent_version)

force_option = __get_force_option(force)
tags = []
for module in get_default_modules().values():
# Skip main module; this is tagged at tag_version via __tag_single_module.
if module.should_tag and module.path != ".":
__tag_single_module(ctx, module, agent_version, commit, push, force_option, devel)
new_tags = __tag_single_module(ctx, module, agent_version, commit, force_option, devel)
tags.extend(new_tags)

if push:
tags_list = ' '.join(tags)
ctx.run(f"git push origin {tags_list}{force_option}")
print(f"Pushed tag {tags_list}")
print(f"Created module tags for version {agent_version}")


Expand All @@ -203,7 +209,11 @@ def tag_version(ctx, agent_version, commit="HEAD", verify=True, push=True, force

# Always tag the main module
force_option = __get_force_option(force)
__tag_single_module(ctx, get_default_modules()["."], agent_version, commit, push, force_option, devel)
tags = __tag_single_module(ctx, get_default_modules()["."], agent_version, commit, force_option, devel)
if push:
tags_list = ' '.join(tags)
ctx.run(f"git push origin {tags_list}{force_option}")
print(f"Pushed tag {tags_list}")
print(f"Created tags for version {agent_version}")


Expand Down
26 changes: 13 additions & 13 deletions test/new-e2e/tests/agent-platform/common/agent_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,48 +23,48 @@ func CheckIntegrationInstall(t *testing.T, client *TestClient) {
freezeContent, err := client.FileManager.ReadFile(requirementIntegrationPath)
require.NoError(t, err)

freezeContent = ciliumRegex.ReplaceAll(freezeContent, []byte("datadog-cilium==2.2.1"))
freezeContent = ciliumRegex.ReplaceAll(freezeContent, []byte("datadog-cilium==4.0.0"))
_, err = client.FileManager.WriteFile(requirementIntegrationPath, freezeContent)
require.NoError(t, err)

t.Run("install-uninstall package", func(tt *testing.T) {
installIntegration(tt, client, "datadog-cilium==2.2.1")
installIntegration(tt, client, "datadog-cilium==4.0.0")

freezeRequirement := client.AgentClient.Integration(agentclient.WithArgs([]string{"freeze"}))
require.Contains(tt, freezeRequirement, "datadog-cilium==2.2.1", "before removal integration should be in freeze")
require.Contains(tt, freezeRequirement, "datadog-cilium==4.0.0", "before removal integration should be in freeze")

client.AgentClient.Integration(agentclient.WithArgs([]string{"remove", "-r", "datadog-cilium"}))

freezeRequirementNew := client.AgentClient.Integration(agentclient.WithArgs([]string{"freeze"}))
require.NotContains(tt, freezeRequirementNew, "datadog-cilium==2.2.1", "after removal integration should not be in freeze")
require.NotContains(tt, freezeRequirementNew, "datadog-cilium==4.0.0", "after removal integration should not be in freeze")
})

t.Run("upgrade a package", func(tt *testing.T) {
installIntegration(tt, client, "datadog-cilium==2.2.1")
installIntegration(tt, client, "datadog-cilium==4.0.0")

freezeRequirement := client.AgentClient.Integration(agentclient.WithArgs([]string{"freeze"}))
require.NotContains(tt, freezeRequirement, "datadog-cilium==2.3.0", "before update integration should not be in 2.3.0")
require.NotContains(tt, freezeRequirement, "datadog-cilium==5.0.0", "before update integration should not be in 5.0.0")

installIntegration(tt, client, "datadog-cilium==2.3.0")
installIntegration(tt, client, "datadog-cilium==5.0.0")

freezeRequirementNew := client.AgentClient.Integration(agentclient.WithArgs([]string{"freeze"}))
require.Contains(tt, freezeRequirementNew, "datadog-cilium==2.3.0", "after update integration should be in 2.3.0")
require.Contains(tt, freezeRequirementNew, "datadog-cilium==5.0.0", "after update integration should be in 5.0.0")
})

t.Run("downgrade a package", func(tt *testing.T) {
installIntegration(tt, client, "datadog-cilium==2.3.0")
installIntegration(tt, client, "datadog-cilium==5.0.0")

freezeRequirement := client.AgentClient.Integration(agentclient.WithArgs([]string{"freeze"}))
require.NotContains(tt, freezeRequirement, "datadog-cilium==2.2.1", "before downgrade integration should not be in 2.2.1")
require.NotContains(tt, freezeRequirement, "datadog-cilium==4.0.0", "before downgrade integration should not be in 4.0.0")

installIntegration(tt, client, "datadog-cilium==2.2.1")
installIntegration(tt, client, "datadog-cilium==4.0.0")

freezeRequirementNew := client.AgentClient.Integration(agentclient.WithArgs([]string{"freeze"}))
require.Contains(tt, freezeRequirementNew, "datadog-cilium==2.2.1", "after downgrade integration should be in 2.2.1")
require.Contains(tt, freezeRequirementNew, "datadog-cilium==4.0.0", "after downgrade integration should be in 4.0.0")
})

t.Run("downgrade to older version than shipped", func(tt *testing.T) {
_, err := client.AgentClient.IntegrationWithError(agentclient.WithArgs([]string{"install", "-r", "datadog-cilium==2.2.0"}))
_, err := client.AgentClient.IntegrationWithError(agentclient.WithArgs([]string{"install", "-r", "datadog-cilium==3.6.0"}))
require.Error(tt, err, "should raise error when trying to install version older than the one shipped")
})
}
Expand Down

0 comments on commit d19135f

Please sign in to comment.