cloudformation-cli icon indicating copy to clipboard operation
cloudformation-cli copied to clipboard

Add logging for canary auto generation and refactor canarySettings

Open marc-1010 opened this issue 1 year ago • 0 comments

Issue #, if available:

Description of changes:

  • Remove file_generation_enabled from canarySettings. If the canarySettings field is provided with an empty object, canaries will be generated with contract_test_file_names: [input1.json] default. If canarySettings are removed from .rpdk-config, no canary generation will occur.
  • Improved logging will simplify debugging canary autogeneration.
  • Add a warning log when canarySettings are provided but empty
  • Add Logging at info level for skipping, starting, and finishing canary autogeneration
  • Add Logging at the debug level for loading contract test inputs and writing canary file outputs.
"canarySettings": {
        "contract_test_file_names": ["inputs1.json"]
    }
#positive case at Debug Log Level

% cfn generate -v -v -v
Logging set up successfully
...
Starting Canary Auto-Generation...
Writing: /[ROOT]/testcfncli/canary-bundle/bootstrap.yaml
Loading contract test input file: /[ROOT]/testcfncli/contract-tests-artifacts/inputs_1.json
Writing Canary Stack Template File: /[ROOT]/testcfncli/canary-bundle/canary/canary1_001.yaml
Writing Canary Stack Template File: /[ROOT]/testcfncli/canary-bundle/canary/canary1_002.yaml
Loading contract test input file: /[ROOT]/testcfncli/contract-tests-artifacts/inputs_2.json
Writing Canary Stack Template File: /[ROOT]/testcfncli/canary-bundle/canary/canary2_001.yaml
Writing Canary Stack Template File: /[ROOT]/testcfncli/canary-bundle/canary/canary2_002.yaml
Loading contract test input file: /[ROOT]/testcfncli/contract-tests-artifacts/inputs_3.json
Writing Canary Stack Template File: /[ROOT]/testcfncli/canary-bundle/canary/canary3_001.yaml
Writing Canary Stack Template File: /[ROOT]/testcfncli/canary-bundle/canary/canary3_002.yaml
Finished Canary Auto-Generation
Generated files for TestOrg::TestService::TestResource
Finished generate

# canarySettings not in .rpdk-config

% cfn generate -vv
Logging set up successfully
...
Skipping Canary Auto-Generation
Generated files for TestOrg::TestService::TestResource
Finished generate

#canarySettings:{} with DEBUG Log Level

Logging set up successfully
Writing docs README: [ROOT]/testcfncli/docs/README.md
Starting Canary Auto-Generation...
canarySettings are provided but empty. Generation is enabled with default settings.
Writing: [ROOT]/testcfncli/canary-bundle/bootstrap.yaml
Loading contract test input file: [ROOT]/testcfncli/contract-tests-artifacts/inputs_1.json
Writing Canary Stack Template File: [ROOT]/testcfncli/canary-bundle/canary/canary1_001.yaml
Writing Canary Stack Template File: [ROOT]/testcfncli/canary-bundle/canary/canary1_002.yaml
Finished Canary Auto-Generation
Generated files for TestOrg::TestService::TestResource
Finished generate


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

marc-1010 avatar Jun 24 '24 21:06 marc-1010