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

Alexharvey/1318 part 1 #2

Closed
wants to merge 195 commits into from
Closed

Conversation

alex-harvey-z3q
Copy link
Owner

[Your PR description here]

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 (make test) are passing.
  • Used the same coding conventions as the rest of the project.
  • The new code passes flake8 (make lint) checks.
  • 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

alex-harvey-z3q and others added 30 commits December 17, 2019 13:22
Before this, the _call_sceptre_handler method makes multiple calls to
os.getcwd() in determining paths to add and then later paths to remove.
In the event that the sceptre_handler code then makes a call to
os.chdir, the second call ends up removing the wrong path.

This patch ensures that the paths removed are the same ones that are
added.
)

Allow hooks and resolvers to take complex data objects as arguments.
This is a port of commit ed681aa to Sceptre V2
The Sceptre documentation has been moved from `sceptre.cloureach.com` to
`sceptre.github.io`.
Our execute change-set command was attempting to execute all change sets
even if the change-set creation had failed due to no changes.

This commit adds a filter for change-sets that have failed because there
were no changes. Information is logged to the user and sceptre continues
launching all change-sets that were successfully created.

[Resolves Sceptre#846]
Adds before_create_change_set and after_create_change_set hooks.

These are used for "update -c" or "create" for change set.

Hooks for create_change_set are necessary for actions that need to
happen before any update. For example, upload templates for nested
stacks.

Co-authored-by: Niall Grant <ngfgrant@gmail.com>
Co-authored-by: Nicholas Taylor <nick.taylor@extomic.com>
Python 2.7 is deprecated and it is no longer availble on
Circle CI build VMs. This PR removes python ver 2.7 support
from Sceptre.
Updates CHANGELOG for version 2.4.0
Adds before_validate and after_validate hooks.
Hooks for validate are necessary for actions that need to
happen before any template validation.
For example, downloading required artifacts.
This enables `before_generate` and `after_generate` hook actions to
allow users to execute hooks when running the `generate` command.
Provide examples of creating a Serverless app using SAM
with Sceptre
sceptre fails to install when installed after awscli. make colorama
dependency more flexible so that it will not fail.
Documentation source code looks like there is some attempt at creating info boxes, however they do not appear in the html output. Change source a little so that html looks better.
…fix build (Sceptre#959)

* [Resolves Sceptre#956] Fix sceptre build

Python 2.7 support was removed from `cloudreach/sceptre-circleci` docker image in commit
Sceptre/sceptre-circleci@975fa09
and tagged with https://github.com/Sceptre/sceptre-circleci/releases/tag/v0.5.0

We removed python 2.7 support from sceptre in PR Sceptre#922 however we neglected to update
cicleci to build with the updated docker image. This PR will update the docker image
to remove python 2.7 from the builds.

* update pip

* fix pip flag

* adjust updated version with PR sceptre-circleci/pull/1
* update container image for builds

Update container image with fix from PR Sceptre/sceptre-circleci#3

* disable sonarqube

Disable sonar build from running because it's failing and we don't have
access to the sonarcloud.io account it requires.  Hoping @ngfgrant will
re-appear and help us get it going again.

* Disable integration tests

Disable integration tests because we don't have access to the
AWS account it depends on.  We'll need to get an account before
we can run these tests again.

The intention is to disable it to get the builds passing again and
to be able to merge non-code changes. We also inted to get these
tests running again before merging any code related changes.
Trigger a circlci build on every PR.  It will run build sceptre,
lint scepter code, run sceptre unit-tests, and build sceptre docker image.
All tasks which do not require secrets.
zaro0508 and others added 29 commits November 24, 2022 10:23
)

Deploy sceptre docker images to dockerhub sceptreorg repo instead of cloudreach repo
Implements coloured diffs for the diff (difflib) command. Responds to --no-color.
Resolves Sceptre#1273 by starting event filtering from the timestamp returned in the AWS response headers rather than relying on the workstation clock.
This PR addresses Sceptre#1253 by throwing an informative error when the template fails to download instead of passing the error message to CloudFormation.
Resolves Sceptre#1276 by reformatting all Python files using the Black code formatter. This also delivers a new function for generating `__repr__` methods which was needed to deal with a line-too-long issue in Template. Per discussion in Sceptre#1276 this PR also disables E203 in flake8.
This extends the stack_status_colourer to include the 'IMPORT' related
states.
Update to build and test with a docker image that's based on the official circleci python docker image.

depends on Sceptre/sceptre-circleci#18
…re#1282)

Allow user to disable a cloudformation rollback on a sceptre deployment.
…tre-cdk-handler (Sceptre#1285)

This updates our docs to no longer reference the old CDK approach (which didn't work with CDK assets). In its place, it references the new sceptre-cdk-handler package that covers that functionality.
…ptre#1288)

We want the default value to be None to represent "Do whatever's configured in the StackConfig" and True/False will override the StackConfig.
…esolvers, and template handlers (Sceptre#1287)

This creates adds the public "get_session()" and "create_session_environment_variables()" methods to make AWS interactions easier and more consistent with individual stack configurations for iam_role, profile, and region configurations.
…ssage to include the Stack Name (Sceptre#1294)

Improves the stack config Jinja syntax error message to include the stack name.

### Original Error Message

```
expected token 'end of print statement', got 'bar'
```

### New Error Message

```
dev/stack.yaml - expected token 'end of print statement', got 'bar'
```
…to include the Stack Name (Sceptre#1269)

Improves the stack config Jinja error message to include the stack name.

### Original Error Message

```
'foo2' is undefined
```

### New Error Message

```
dev/stack.yaml - 'foo2' is undefined
```
…ath; Introducing sceptre_role, cloudformation_service_role (Sceptre#1295)

This PR brings about three Stack Config deprecations (two of which have been renamed).

* `iam_role` has been deprecated and aliased to a new Stack Config key of `sceptre_role`. This change has also been made on the ConnectionManager.
* `role_arn` has been deprecated and aliased to a new Stack Config key of `cloudformation_service_role`.
* `template_path` has been deprecated officially (it has been discouraged in docs since 2.7 but this makes it official). Functionality on this hasn't really changed apart from the warnings (see below).

With these deprecations, **Sceptre will now emit DeprecationWarnings whenever these fields are set or accessed.** All locations within Sceptre have been fixed, but external and custom hooks and resolvers will also need to be updated if they're referencing these deprecated fields.
It turns out we had a line that showed EVERY instance of DeprecationWarning in the CLI root function. But this mixed VERY POORLY with the deprecation warnings we were emitting. If there were 30 uses of a deprecated field, it would emit 30 identical warnings.

This fixes the issue.
Update pre-commit linter to fix pre-commit error:
```
An unexpected error has occurred: CalledProcessError: command: ('/home/circleci/.cache/pre-commit/repoen6j6mg_/py_env-python3/bin/python', '-mpip', 'install', '.')
```

Changes in this PR was generated from running the commands:
* `pre-commit autoupdate`
*  `pre-commit run --all-files`
## 4.0.0 (2023.02.08)

### Added
 - [Resolve Sceptre#1283] Introducing `sceptre_role`, `cloudformation_service_role` (Sceptre#1295)
   - These are just iam_role and role_arn renamed to be a lot clearer. See "Deprecations" below.


### Changed
 - [Resolve Sceptre#1299] Making the ConnectionManager a more "friendly" interface for hooks, resolvers,
   and template handlers (Sceptre#1287, Sceptre#1300)
   - This creates adds the public `get_session()` and
     `create_session_environment_variables()` methods to make AWS interactions
     easier and more consistent with individual stack configurations for
     iam_role, profile, and region configurations.
   - The `call()` method now properly distinguishes between default stack
     configurations for profile, region, and `sceptre_role` and setting those to
     `None` to nullify them.
 - Preventing Duplicate Deprecation Warnings from being emitted (Sceptre#1297)

#### _Potentially_ Breaking Changes
 - The !cmd hook now invokes the passed command using the AWS environment
   variables that correspond with the stack's IAM configurations (i.e. iam_role,
   profile, region). This means that the hook will operate the same as every
   other part of Sceptre and regard how the stack is configured. This should make
   it easier to invoke other tools like AWS CLI with your hooks. However, if
   your project is setting environment variables with the intent to change how
   the command authenticates with AWS (such as a different token, profile, or
   region), these environment variables will be overridden. To maintain the same
   functionality, you should prefix your command with
   `export AWS_SESSION_TOKEN={{environment_variable.AWS_SESSION_TOKEN}} &&` (or
   whatever other environment variable(s) you need to explicitly set).

### Deprecations
 - [Resolve Sceptre#1283] Deprecating `iam_role`, `role_arn`, and `template_path` (Sceptre#1295)
   - `iam_role` and `role_arn` have been aliased to `sceptre_role` and
      `cloudformation_service_role`. Using these fields will result in a
      DeprecationWarning.
   - `template_path` has actually been slated for removal since v2.7. `template`
      should be used instead. Using `template_path` will result in a
      DeprecationWarning.
   - All three deprecated StackConfig fields will be removed in v5.0.0.

## 3.3.0 (2023.02.06)

### Added
 - [Resolve Sceptre#1261] Add coloured differ (Sceptre#1260)
   - Implements coloured diffs for the diff (difflib) command. Responds to --no-color.
 - [Resolves Sceptre#1271] Extend stack colourer to include "IMPORT" states (Sceptre#1272)
 - [Resolves Sceptre#1179] cloudformation disable-rollback option (Sceptre#1282)
   - Allow user to disable a cloudformation rollback on a sceptre deployment.

### Changed
 - [Resolve Sceptre#1098] Deploy docker container to sceptreorg repo (Sceptre#1265)
   - Deploy sceptre docker images to dockerhub sceptreorg repo instead of cloudreach repo
 - Updating Setuptools and wheel versions to avert security issues
 - [Resolve Sceptre#1293] Improve the Stack Config Jinja Syntax Error Message to include the Stack Name (Sceptre#1294)
 - [Resolves Sceptre#1267] Improve the Stack Config Jinja Error Message to include the Stack Name (Sceptre#1269)

### Fixed
 - [Resolve Sceptre#1273] Events start from response time (Sceptre#1275)
   - Resolves Sceptre#1273 by starting event filtering from the timestamp returned in
     the AWS response headers rather than relying on the workstation clock.
 - [Resolve Sceptre#1253] Failed downloads raise error (Sceptre#1277)
   - Throwing an informative error when the template fails to download instead
     of passing the error message to CloudFormation.
 - [Resolves Sceptre#1179] Changed disable-rollback default to None (Sceptre#1288)
   - We want the default value to be None to represent "Do whatever's configured
     in the StackConfig" and True/False will override the StackConfig.

### Nonfunctional
 - Add tweet-release to CircleCI config (Sceptre#1259)
 - [Resolves Sceptre#1276] Adopt Black Auto-formatter (Sceptre#1278)
   - Reformatting all Python files using the Black code formatter. This also
     delivers a new function for generating `__repr__` methods which was needed
     to deal with a line-too-long issue in Template. Per discussion in Sceptre#1276 this
     PR also disables E203 in flake8.
 - Update sceptre-circleci docker image (Sceptre#1284)
   - Update to build and test with a docker image that's based on the official
     circleci python docker image.
 - [Resolve Sceptre#1264] Updating the CDK docs to point to the new sceptre-cdk-handler
   (Sceptre#1285)
   - This updates our docs to no longer reference the old CDK approach (which
     didn't work with CDK assets). In its place, it references the new
     sceptre-cdk-handler package that covers that functionality.
## 4.0.1 (2023.02.12)

### Changed
 - Supporting `!rcmd` resolver up to v2
This resolves a bug discovered in the ConnectionManager from Sceptre#1307.

The specific situation is when the ConnectionManager.call is invoked using a stack_name and explicitly passes None for each of profile, region, and sceptre_role. The overhaul of the ConnectionManager in v4 accidentally omitted this edge case which happen to specifically affect the !stack_output_external resolver when it's run without either an AWS_DEFAULT_REGION environment variable or without an AWS_PROFILE environment variable set to a profile that defines a region.
## 4.0.2 (2023.02.20)
### Fixed
 - [Resolve Sceptre#1307] Fixing Connection Manager bug (Sceptre#1308)
… and template handlers (Sceptre#1309)

This converts the loggers for Hooks, Resolvers, and Template Handlers to be LoggerAdapters that prefix all log messages with the Stack name
This PR caches the stack outputs of each cache so that we're not making redundant requests for the same stack outputs over and over again (which is what we currently do now in every instance we use !stack_output or !stack_output_external).

Thanks to @dboitnot for the very simple solution suggestion!

(I've not written any tests because I believe that if existing unit and integration tests pass, this should be considered very "safe".)
…ments, with new !substitute, !join, !split, and !select resolvers! (Sceptre#1313)

This pull request brings the ability for Hooks and Resolvers to have resolvers in their arguments and have those resolvers automatically resolve when `self.argument` is accessed. When a resolver or hook is `setup`, it will also setup all nested resolvers in its argument. And when it is attached to a Stack, it and its argument will be recursively cloned so that no resolver is associated with a different stack. This will let resolvers be "inherited" from parent stack configurations.
This adds a sceptre dump template command and deprecates sceptre
generate.
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.