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

Description of cfn-lint development environment and build steps #903

Closed
matsev opened this issue May 15, 2019 · 5 comments
Closed

Description of cfn-lint development environment and build steps #903

matsev opened this issue May 15, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@matsev
Copy link

matsev commented May 15, 2019

cfn-lint version:
cfn-lint 0.20.1

Description of issue.

In the Contributing via Pull Requests paragraph, it is stated that

  1. Ensure local tests pass.

However, neither in the CONTRIBUTING.md nor in the README.md document is it described how one can setup the cfn-lint development environment and execute these tests.

@fatbasstard
Copy link
Contributor

Yeah, you're completely right, the development setup is not really described.
We'll make sure this is (better) documented.

Do you need any help or got a specific question right now @matsev ?

@cmmeyer cmmeyer changed the title Description of con-lint development environment and build steps Description of cfn-lint development environment and build steps May 15, 2019
@kddejong kddejong added the enhancement New feature or request label May 15, 2019
@matsev
Copy link
Author

matsev commented May 16, 2019

@fatbasstard My intention was to setup the build environment and play with it to get a better understanding of the linter and CloudFormation, however I got stuck before I started. I have only some Python experience and last time I tried I spent a lot of time struggling with installing runtime versions, dependency management (pip, anaconda, virtualenv) and so on before I could do anything useful. I suggest that you add a few lines about required runtime, tools (if any, preferably with a link to each homepage respectively), environment config etc to your documentation.

@PatMyron
Copy link
Contributor

PatMyron commented Jan 16, 2020

Biggest thing that helped me was realizing local repositories can be installed using:
pip3 install -e .

These commands check which Python and cfn-lint version you're currently using:

which cfn-lint | xargs cat
pip3 show cfn-lint

(the officially released version can be forcibly reinstalled)

@PatMyron
Copy link
Contributor

PatMyron commented Mar 5, 2020

common PRs

new region
new availability zones
new lambda runtimes parsed from botocore
new instance types parsed from pricing
new aws-sam-translator
new Python version
~weekly maintenance script / release
Visual Studio Code extension ~weekly maintenance script / release

rough estimate of maintenance per rule

CLI parameters added to cfnlint.core.run_cli(), data/CfnLintCli/config/schema.json, + another argparse.ArgumentParser.add_argument()

script to generate test snapshots

commonly maintained structured property information

AdditionalSpecs/RdsProperties.json written by scripts/update_specs_from_pricing.py
AdditionalSpecs/Policies.json written by cfn-lint --update-iam-policies

At least one of these properties must be specified:

"AWS::EC2::Instance": [
[
"ImageId",
"LaunchTemplate"
]
],

Only one of these properties may be specified:

"AWS::CloudWatch::Alarm": [
[
"MetricName",
"Metrics"
]
],

If this property (SnapshotIdentifier) is specified, these properties must be excluded:

"AWS::RDS::DBCluster": {
"SnapshotIdentifier": [
"MasterUsername",
"MasterUserPassword"
]
},

If this property (VpcId) is specified, these properties must be included:

"AWS::OpsWorks::Stack": {
"VpcId": [
"DefaultSubnetId"
]
}


ExtendedSpecs/$REGION/05_pricing_property_values.json written by scripts/update_specs_from_pricing.py
ExtendedSpecs/$REGION/06_ssm_service_removal.json written by scripts/update_specs_services_from_ssm.py
ExtendedSpecs/$REGION/07_ssm_service_addition.json written by scripts/update_specs_services_from_ssm.py

Allowed values from botocore (preferred):

{
"op": "add",
"path": "/ValueTypes/AWS::Glue::Connection.ConnectionInput.ConnectionType",
"value": {
"botocore": "glue/2017-03-31/ConnectionType"
}
},

Allowed values (hardcoded):

{
"op": "add",
"path": "/ValueTypes/AWS::CodeBuild::Project.Artifacts.Packaging",
"value": {
"AllowedValues": [
"NONE",
"ZIP"
]
}
},

Allowed patterns:

"CidrIp": {
"AllowedPattern": "x.x.x.x/y",
"AllowedPatternRegex": "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(/([0-9]|[1-2][0-9]|3[0-2]))$"
},

Number size constraints:

{
"op": "add",
"path": "/ValueTypes/AWS::SQS::Queue.MaximumMessageSize",
"value": {
"NumberMax": 262144,
"NumberMin": 1024
}
},

String size constraints:

{
"op": "add",
"path": "/ValueTypes/AWS::Logs::LogGroup.LogGroupName",
"value": {
"StringMax": 512,
"StringMin": 1
}
},

List size constraints:

{
"op": "add",
"path": "/ValueTypes/AWS::IAM::Group.Names",
"value": {
"ListMax": 10,
"ListMin": 0
}
},

Json size constraints


There should be no functional difference, but 03_value_types and 04_property_values are more organized than 03_value_types.json and 04_property_values.json, so they should be preferred locations for new constraints


After editing src/cfnlint/data/ExtendedSpecs, the necessary CloudSpecs changes should be auto-generatable by running:

cfn-python-lint $ pip3 install -e .
cfn-python-lint $ cfn-lint --update-specs # https://github.com/aws-cloudformation/cfn-python-lint/pull/1383#issuecomment-629891506

@miparnisari
Copy link
Contributor

In the Contributing via Pull Requests paragraph, it is stated that "Ensure local tests pass."
However, neither in the CONTRIBUTING.md nor in the README.md document is it described how one can setup the cfn-lint development environment and execute these tests.

This is now documented here: https://github.com/aws-cloudformation/cfn-python-lint/blob/master/CONTRIBUTING.md#development-environment

Resolving :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants