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

Release candidate 4.5.0 #1473

Closed

Conversation

alex-harvey-z3q
Copy link
Contributor

@alex-harvey-z3q alex-harvey-z3q commented Jun 4, 2024

This branch merges these PRs for local testing with a view to releasing as Sceptre v4.5.0.

Screenshot 2024-06-03 at 10 49 42 am

PR Checklist

  • Wrote a good commit message & description [see guide below].
  • Commit message starts with [Resolve #issue-number].
  • Added/Updated unit tests.
  • Added/Updated integration tests (if applicable).
  • All unit tests (poetry run tox) are passing.
  • Used the same coding conventions as the rest of the project.
  • The new code passes pre-commit validations (poetry run pre-commit run --all-files).
  • The PR relates to only one subject with a clear title.
    and description in grammatically correct, complete sentences.

Approver/Reviewer Checklist

  • Before merge squash related commits.

Other Information

Guide to writing a good commit

While reading config files, Sceptre caches the variables used by Jinja.
If a template is missing a variable, one from a different StackGroup
is used instead.
…le stacks

Previously the update command would exit if any change sets status
was not equal to READY. However, when a stack does not contain
any updates, it will not be READY since there is nothing to execute.
This should not prevent other change sets to be executed.

To get around this, we introduce another change set status, NO_CHANGES,
and handle that gracefully.

To clean up the output a bit, we also pass on describing the changes
for empty change sets.
This resolves a bug in `sceptre outputs` where all `ClientError`
exceptions (e.g. `ExpiredToken`) are suppressed, for no apparent reason.

In 682a306, (October 2018, commit
summary "Move Stack operations from Stack to StackActions"), a big
refactor had occurred. That refactor had introduced a public method
`describe` in the `StackActions` class.

A month later, in 182f0b6 (November 2018,
commit summary "Implement algorithm to execute Stacks from StackGraph"),
another big refactor occurred. A part of that refactor was to introduce an
essentially duplicate method `_describe` and then in the
`describe_output` method, catch all `ClientError` exceptions and always
return an empty list.

So far as I can tell, there was no good reason to introduce either the
new method, or catch all `ClientError` exceptions. The suppression of
exceptions may have been accidental, or a hack to get the unit tests to
pass.

This patch attempts to fix all of this up:

- Duplicate method removed in favour of the public `describe` method. I
  have opted to keep the public method as the differ class is calling,
  making it public.

- The change to `describe_outputs` is reverted.

- The unit tests are rewritten.
Akin to `sceptre delete`, display the order of operations when issuing
`sceptre launch` for a visual representation of dependencies.
This adds logic supporting the case of creating change sets for a stack
that does not already exist, i.e. specifying ChangeSetType of CREATE.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudformation/client/create_change_set.html
In already-resolved and merged issue Sceptre#1443 we implemented parameter
validation.

Subsequent discussion led to a consensus that it would be better to not
only validate parameters, but also cast where applicable to string. This
will lead to a cleaner user experience for most Sceptre users where
parameters passed as ints, floats and bools in their YAML values files
are cast to strings first and then sent to CloudFormation, since
CloudFormation's API is unable to handle other types.

This PR changes the behaviour of the `_ensure_parameters` method in the
Stack class to handle casting to strings where applicable instead of
only validating.
alex-harvey-z3q and others added 27 commits June 14, 2024 19:16
This adds logic to _cast_parameters to also handle the case that the
`parameters` dict itself is not a dict but some other invalid type.
This adds code to handle the case of failures in stack groups that have
missing or errored stacks when creating, describing and executing
change-sets.

Before this, any stack group that contained a stack that had been
deleted, or had errored out, resulted in all change set operations on
that stack group failing.

The reason for this is no error or exception handling had ever been
added for change sets, but assumed all stacks in the stack group were
clean and could respond to the change set APIs.

For example, deleting change sets might error out with:

```
% sceptre delete -y network.yaml sceptre-network
The Change Set will be delete on the following stacks, if applicable:
network

"An error occurred (ValidationError) when calling the DeleteChangeSet
operation: Stack [test-e2e-direct-connect] does not exist"
```

This is particularly an issue for sites that employ as best practice
analysis of change sets for safety prior to launching updates.

This patch adds the missing error handling for `delete_change_set`,
`create_change_set`, `describe_change_set` and
`execute_change_set`.
@alex-harvey-z3q
Copy link
Contributor Author

All in master now.

@alex-harvey-z3q alex-harvey-z3q deleted the release-candidate-4.5.0 branch August 3, 2024 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants