Skip to content

Commit

Permalink
Release 0.2.21 (#947)
Browse files Browse the repository at this point in the history
# Description

Please describe the change you have made.

## Checklist

- [ ] Tests added/updated.
- [ ] Run Demo Job Locally.
- [ ] Documentation updated.
- [ ] Changelogs updated in
[CHANGELOG.cdf-tk.md](https://github.com/cognitedata/toolkit/blob/main/CHANGELOG.cdf-tk.md).
- [ ] Template changelogs updated in
[CHANGELOG.templates.md](https://github.com/cognitedata/toolkit/blob/main/CHANGELOG.templates.md).
- [ ] Version bumped.

[_version.py](https://github.com/cognitedata/toolkit/blob/main/cognite/cognite_toolkit/_version.py)
and

[pyproject.toml](https://github.com/cognitedata/toolkit/blob/main/pyproject.toml)
per [semantic versioning](https://semver.org/).
  • Loading branch information
doctrino authored Sep 13, 2024
2 parents f4d8eff + 9b69cb9 commit 1be6cf1
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,4 @@ cognite_toolkit/config.local.yaml
build.*
cognite_toolkit/.env.*
module_upgrade/project_inits
function_local_venvs/
6 changes: 6 additions & 0 deletions CHANGELOG.cdf-tk.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ Changes are grouped as follows:
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [0.2.21] - 2024-09-13

### Fixed

- Groups without metadata no longer triggers redeploy when running `cdf deploy`

## [0.2.20] - 2024-08-31

### Fixed
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Changes are grouped as follows:
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [0.2.21] - 2024-09-13

No changes to templates.

## [0.2.20] - 2024-08-31

## Fixed
Expand Down
7 changes: 6 additions & 1 deletion cognite_toolkit/_cdf_tk/_migration.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
- version: 0.2.20
- version: 0.2.21
cognite_modules: {}
resources: {}
tool: {}
cognite_modules_hash: ""
- version: 0.2.20
cognite_modules: {}
resources: {}
tool: {}
cognite_modules_hash: "6be0297c3e6f0097fb53653095b57c9d8d56ca840282199b68c721868ab8131c"
- version: 0.2.19
cognite_modules: {}
resources: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ def _are_equal(
local_dumped = local.dump()
cdf_dumped = cdf_resource.as_write().dump()

# Remove metadata if it is empty to avoid false negatives
# as a result of cdf_resource.metadata = {} != local.metadata = None
if not local_dumped.get("metadata"):
local_dumped.pop("metadata", None)
if not cdf_dumped.get("metadata"):
cdf_dumped.pop("metadata", None)

scope_names = ["datasetScope", "idScope", "extractionPipelineScope"]

ids_by_acl_by_actions_by_scope: dict[str, dict[frozenset[str], dict[str, list[str]]]] = {}
Expand Down
2 changes: 1 addition & 1 deletion cognite_toolkit/_system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ packages:
- example_pump_data_model

# This part is used by cdf-toolkit to keep track of the version and help you upgrade.
cdf_toolkit_version: 0.2.20
cdf_toolkit_version: 0.2.21
2 changes: 1 addition & 1 deletion cognite_toolkit/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.2.20"
__version__ = "0.2.21"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cognite_toolkit"
version = "0.2.20"
version = "0.2.21"
description = "Official Cognite Data Fusion tool for project templates and configuration deployment"
authors = ["Cognite AS <[email protected]>"]
license = "Apache-2"
Expand Down
2 changes: 1 addition & 1 deletion tests/data/build_core_model/_build_environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ project: project-loader-dev
type: dev
selected:
- modules
cdf_toolkit_version: 0.2.20
cdf_toolkit_version: 0.2.21
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ project: pytest-project
type: dev
selected:
- modules
cdf_toolkit_version: 0.2.20
cdf_toolkit_version: 0.2.21
2 changes: 1 addition & 1 deletion tests/data/project_for_test/_system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ packages:
- child_module

# This part is used by cdf-toolkit to keep track of the version and help you upgrade.
cdf_toolkit_version: 0.2.20
cdf_toolkit_version: 0.2.21
2 changes: 1 addition & 1 deletion tests/data/project_no_cognite_modules/_system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
packages: {}

# This part is used by cdf-toolkit to keep track of the version and help you upgrade.
cdf_toolkit_version: 0.2.20
cdf_toolkit_version: 0.2.21
2 changes: 1 addition & 1 deletion tests/data/project_with_bad_modules/_system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
packages: {}

# This part is used by cdf-toolkit to keep track of the version and help you upgrade.
cdf_toolkit_version: 0.2.20
cdf_toolkit_version: 0.2.21
2 changes: 1 addition & 1 deletion tests/data/run_data/_system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ packages:
- example_pump_data_model

# This part is used by cdf-toolkit to keep track of the version and help you upgrade.
cdf_toolkit_version: 0.2.20
cdf_toolkit_version: 0.2.21
44 changes: 43 additions & 1 deletion tests/test_unit/test_cdf_tk/test_loaders/test_group_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from _pytest.monkeypatch import MonkeyPatch
from cognite.client.data_classes import Group, GroupWrite
from cognite.client.data_classes import Group, GroupWrite, GroupWriteList

from cognite_toolkit._cdf_tk.commands import DeployCommand
from cognite_toolkit._cdf_tk.loaders import (
Expand Down Expand Up @@ -201,3 +201,45 @@ def test_get_dependent_items(self, item: dict, expected: list[tuple[type[Resourc
actual_dependent_items = GroupLoader.get_dependent_items(item)

assert list(actual_dependent_items) == expected

def test_unchanged_new_group_without_metadata(
self, cdf_tool_config: CDFToolConfig, cognite_client_approval: ApprovalCogniteClient, monkeypatch: MonkeyPatch
) -> None:
loader = GroupResourceScopedLoader.create_loader(cdf_tool_config, None)
local_group = GroupWrite.load("""name: gp_no_metadata
sourceId: 123
capabilities:
- assetsAcl:
actions:
- READ
scope:
all: {}
""")
cdf_group = Group.load("""name: gp_no_metadata
sourceId: 123
capabilities:
- assetsAcl:
actions:
- READ
scope:
all: {}
metadata: {}
id: 3760258445038144
isDeleted: false
deletedTime: -1
""")

# Simulate that one group is is already in CDF
cognite_client_approval.append(
Group,
[cdf_group],
)
cmd = DeployCommand(print_warning=False)
to_create, to_change, unchanged = cmd.to_create_changed_unchanged_triple(
GroupWriteList([local_group]),
loader,
)

assert len(to_create) == 0
assert len(to_change) == 0
assert len(unchanged) == 1

0 comments on commit 1be6cf1

Please sign in to comment.