Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CDF-21470, CDF-21469] Prep release 0.1.4 #507

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.cdf-tk.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ Changes are grouped as follows:
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [0.1.4] - 2024-04-30

### Fixed

- When running `cdf-tk deploy` with container `YAML` from before `cogniet-sdk<7.37`, the user would get an error
`Missing required field: 'list'.` for the `direct` container properties. This is now fixed.
- When running `cdf-tk init --upgrade`, the user would get an error `IndexError: list index out of range`.
This is now fixed.

## [0.1.3] - 2024-04-28

### 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.1.4] - 2024-04-30

No changes to templates.

## [0.1.3] - 2024-04-29

### Fixed
Expand Down
21 changes: 14 additions & 7 deletions cognite_toolkit/_cdf_tk/load/_resource_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -1553,22 +1553,29 @@ def get_id(cls, item: ContainerApply | Container) -> ContainerId:
def load_resource(
self, filepath: Path, ToolGlobals: CDFToolConfig, skip_validation: bool
) -> ContainerApply | ContainerApplyList | None:
loaded = super().load_resource(filepath, ToolGlobals, skip_validation)
if loaded is None:
return None
items = loaded if isinstance(loaded, ContainerApplyList) else [loaded]
raw_yaml = load_yaml_inject_variables(filepath, ToolGlobals.environment_variables())
if not isinstance(raw_yaml, list):
raw_yaml = [raw_yaml]
# When upgrading to SDK 7.37.0 there was a breaking change in the SDK requiring 'list' for direct relations.
# This patches the yaml to include the list key for direct relations if it is missing.
for raw_instance in raw_yaml:
for prop in raw_instance.get("properties", {}).values():
type_ = prop.get("type", {})
if type_.get("type") == "direct" and "list" not in type_:
type_["list"] = False
items = ContainerApplyList.load(raw_yaml)
if not skip_validation:
ToolGlobals.verify_spaces(list({item.space for item in items}))
for item in items:
# Todo Bug in SDK, not setting defaults on load
for prop_name in item.properties.keys():
prop_dumped = item.properties[prop_name].dump()
if prop_dumped.get("nullable") is None:
prop_dumped["nullable"] = False
prop_dumped["nullable"] = False # type: ignore[assignment]
if prop_dumped.get("autoIncrement") is None:
prop_dumped["autoIncrement"] = False
prop_dumped["autoIncrement"] = False # type: ignore[assignment]
item.properties[prop_name] = ContainerProperty.load(prop_dumped)
return loaded
return items

def create(self, items: Sequence[ContainerApply]) -> ContainerList:
return self.client.data_modeling.containers.apply(items)
Expand Down
7 changes: 6 additions & 1 deletion cognite_toolkit/_cdf_tk/templates/_migration.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
- version: 0.1.3
cognite_modules: {}
resources: {}
tool: {}
cognite_modules_hash: "de5b3ba4639c9e8fca4c0b33622ce706cce2cd9f9347fbf5770de3f9097a366f"
- version: 0.1.2
cognite_modules: {}
resources: {}
tool: {}
cognite_modules_hash: ""
cognite_modules_hash: "2ba2d52530d69a2ad23d5fedd1c5ccc58c28f7ac0d11b7f57552ea930bf982f2"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing the Index error

- version: 0.1.1
cognite_modules: {}
resources: {}
Expand Down
2 changes: 1 addition & 1 deletion cognite_toolkit/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.3"
__version__ = "0.1.4"
2 changes: 1 addition & 1 deletion cognite_toolkit/cognite_modules/_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.1.3
cdf_toolkit_version: 0.1.4
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.1.3"
version = "0.1.4"
description = "Official Cognite Data Fusion tool for project templates and configuration deployment"
authors = ["Cognite AS <support@cognite.com>"]
license = "Apache-2"
Expand Down
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.1.3
cdf_toolkit_version: 0.1.4
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.1.3
cdf_toolkit_version: 0.1.4
Loading