aws-greengrass / aws-greengrass-gdk-cli

The Greengrass Development Kit - Command Line Interface (GDK CLI) is a tool that helps you create Greengrass V2 components either using templates or community repositories.
https://docs.aws.amazon.com/greengrass/v2/developerguide/greengrass-development-kit-cli.html
Apache License 2.0
28 stars 19 forks source link

feat: zip build exclusions support all globs #254

Closed patrzhan closed 1 year ago

patrzhan commented 1 year ago

Issue #, if available: https://github.com/aws-greengrass/aws-greengrass-gdk-cli/issues/143 Description of changes: Update zip build to accept full globs to match with when picking files/directories to exclude from the build. In GDK 1.4.0 and earlier, glob-like patterns were provided to match individual file names against, regardless of the subdirectory level. In PR: https://github.com/aws-greengrass/aws-greengrass-gdk-cli/pull/253, this was changed to only exclude items at the root level. This change supports full glob notation including directories, so that items that should only be excluded from root (i.e. test*) can do so, but items that should still be excluded from all subdirectories such as node_modules folders can also be excluded.

This also means the defaults have changed. The default globs for exclusion have been set to test*, **/.*, and **/node_modules, meaning that test* is matched only against the root directory, but hidden files and node_modules are excluded at any level by default. This also means that any custom patterns provided in the gdk-config.json file may need to be changed, as the behavior may have changed.

Why is this change necessary: Bugfix for the linked issue while maintaining support for exclusion in any subdirectory level.

How was this change tested: Manually tested changes with a sample project to confirm that expected directories and files were excluded based on various provided globs. Also updated unit/integration tests to test the functionality that is changed.

Any additional information or context required to review the change: Since this feature impacts default values and may change behavior of existing projects that upgrade to this version, input is needed on how to mitigate impact if necessary.

Checklist:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

codecov[bot] commented 1 year ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (a1a3ffe) 98.01% compared to head (bbb8f40) 98.02%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## development #254 +/- ## =============================================== + Coverage 98.01% 98.02% +0.01% =============================================== Files 47 47 Lines 1813 1824 +11 =============================================== + Hits 1777 1788 +11 Misses 36 36 ``` | [Flag](https://app.codecov.io/gh/aws-greengrass/aws-greengrass-gdk-cli/pull/254/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-greengrass) | Coverage Δ | | |---|---|---| | [integ](https://app.codecov.io/gh/aws-greengrass/aws-greengrass-gdk-cli/pull/254/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-greengrass) | `80.26% <100.00%> (+0.11%)` | :arrow_up: | | [uat](https://app.codecov.io/gh/aws-greengrass/aws-greengrass-gdk-cli/pull/254/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-greengrass) | `70.33% <100.00%> (+0.17%)` | :arrow_up: | | [unit](https://app.codecov.io/gh/aws-greengrass/aws-greengrass-gdk-cli/pull/254/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-greengrass) | `94.46% <100.00%> (+0.03%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-greengrass#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/aws-greengrass/aws-greengrass-gdk-cli/pull/254?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-greengrass) | Coverage Δ | | |---|---|---| | [gdk/build\_system/Zip.py](https://app.codecov.io/gh/aws-greengrass/aws-greengrass-gdk-cli/pull/254?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws-greengrass#diff-Z2RrL2J1aWxkX3N5c3RlbS9aaXAucHk=) | `91.52% <100.00%> (+1.94%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.