Skip to content

[DevSetting] Replace cinc_version/cinc_installer_url with CliAttributeOverrides which is similar to ExtraChefAttributes#7447

Open
himani2411 wants to merge 2 commits into
aws:developfrom
himani2411:cli-devsetting
Open

[DevSetting] Replace cinc_version/cinc_installer_url with CliAttributeOverrides which is similar to ExtraChefAttributes#7447
himani2411 wants to merge 2 commits into
aws:developfrom
himani2411:cli-devsetting

Conversation

@himani2411

Copy link
Copy Markdown
Contributor

Description of changes

Replace cinc_version/cinc_installer_url with CliAttributeOverrides

  • Model the CLI-side CINC overrides as a single freeform JSON DevSetting (CliAttributeOverrides), mirroring Cookbook.ExtraChefAttributes, instead of two scalar settings. The config exposes cinc_version/cinc_installer_url as read-only accessors that unfurl the blob, so imagebuilder_stack.py and parallelcluster.yaml keep populating CfnParamCincVersion/CfnParamCincInstaller unchanged.

  • Add CliAttributeOverridesValidator for JSON well-formedness (object), with a KNOWN_CLI_ATTRIBUTE_OVERRIDES hook for optional future strict key validation.

  • Add tests which cover CliAttributeOverridesValidator (valid object, empty/None, malformed JSON, non-object array/scalar) and the ImagebuilderDevSettings cinc_version/ cinc_installer_url accessors that unfurl the JSON blob (full, empty, partial, unknown-keys).

  • CincVersion was added [DevSetting] Add CincVersion override to version during imagebuilder #7420

Tests

  • Build Image

References

  • Link to impacted open issues.
  • Link to related PRs in other packages (i.e. cookbook, node).
  • Link to documentation useful to understand the changes.

Checklist

  • Make sure you are pointing to the right branch.
  • If you're creating a patch for a branch other than develop add the branch name as prefix in the PR title (e.g. [release-3.6]).
  • Check all commits' messages are clear, describing what and why vs how.
  • Make sure to have added unit tests or integration tests to cover the new/modified code.
  • Check if documentation is impacted by this change.

Please review the guidelines for contributing and Pull Request Instructions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@himani2411 himani2411 requested review from a team as code owners June 12, 2026 16:37
@himani2411 himani2411 added skip-changelog-update Disables the check that enforces changelog updates in PRs 3.x labels Jun 12, 2026
…eOverrides JSON

* Model the CLI-side CINC overrides as a single freeform JSON DevSetting
(CliAttributeOverrides), mirroring Cookbook.ExtraChefAttributes, instead of two
scalar settings. The config exposes cinc_version/cinc_installer_url as read-only
accessors that unfurl the blob, so imagebuilder_stack.py and parallelcluster.yaml
keep populating CfnParamCincVersion/CfnParamCincInstaller unchanged.

* Add CliAttributeOverridesValidator for JSON well-formedness (object), with a
KNOWN_CLI_ATTRIBUTE_OVERRIDES hook for optional future strict key validation.

* Add tests which cover CliAttributeOverridesValidator (valid object, empty/None, malformed JSON,
non-object array/scalar) and the ImagebuilderDevSettings cinc_version/
cinc_installer_url accessors that unfurl the JSON blob (full, empty, partial,
unknown-keys).
# ---------------------- Dev Settings Schema ---------------------- #


class ImagebuilderDevSettingsSchema(BaseDevSettingsSchema):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

NOTE FOR REVIEWER: The cli_attribute_overrides can later be moved to BaseDevSettingsSchema when we add more overrides; since the 2 paramters are related to only Build Image I am keeping it in ImagebuilderDevSettingsSchema

f"Invalid value in {CLI_ATTRIBUTE_OVERRIDES_PATH}: must be a JSON object.",
FailureLevel.ERROR,
)
# TODO: optionally validate keys against KNOWN_CLI_ATTRIBUTE_OVERRIDES here.

@himani2411 himani2411 Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

NOTE FOR REVIEWER: Keeping this as a future improvement since we do not validate all JSON content for ExtraChefAttributes as of today and the cinc attributes that I am replacing also do no have any validators. Any un-related attribute apart from the cinc* one's in the JSON will be a no-op.

… cluster all-validators check

test_slurm_all_validators_are_called asserts every dev_settings validator
fires during cluster validation. CliAttributeOverridesValidator is registered
only on the image-builder config, so skip it like the other non-cluster validators.
CLI_ATTRIBUTE_OVERRIDES_PATH = "DevSettings/CliAttributeOverrides"
# Keys the CLI currently unfurls from the blob. Kept for an optional future
# strict check; today validation is well-formedness only (like ExtraChefAttributes).
KNOWN_CLI_ATTRIBUTE_OVERRIDES = {"cinc_version", "cinc_installer_url"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess we can remove this constant because we are only interested in enforcing the json formatting of the CliAttributeOverrides without making eny assumption or enforcement about its field.

In Cookbook Chef Attribute we introduced the validation of specific attributes only because we decided to vend those attributes publicly to mitigate an impact, but in general we should not do it and keep it free form.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will do

self.distribution_configuration = distribution_configuration
self.terminate_instance_on_failure = Resource.init_param(terminate_instance_on_failure, default=True)
self.disable_validate_and_test = Resource.init_param(disable_validate_and_test, default=True)
self.cinc_installer_url = Resource.init_param(cinc_installer_url, default="")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removing this parameter from DevSettings schema is ok because we do not guarantee backward compatibility for DevSettings by definition. However, I suggest to document the removal in the changelog. the fact that we do not guarantee backward compatibility means it is ok to make this change, but does not mean we should not surface it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

IF we never surface the addition of DevSettings in chnagelog; why should we surface their removal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x skip-changelog-update Disables the check that enforces changelog updates in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants