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

Add optional --skip-git-repos option to bake_config.py script #991

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kporangehat
Copy link

@kporangehat kporangehat commented Oct 3, 2024

Use Case

We license external Toolkit bundles from GPL (@GPLgithub) and also develop our own TK bundles in house which we store in our Github org repos. In order to maintain their code privacy, the TK config lives in GPL's org on Github. When a new version is tagged, a CI job is run that bakes the GPL bundles into our config using the developer/bake_config.py script with the command:

bake_config.py "sgtk:descriptor:[email protected]:GPLgithub/tk-config-wba.git&version=${BUILD_SOURCEBRANCHNAME}" $(Build.ArtifactStagingDirectory)/baked --skip-bundle-types=app_store

This works great except that it bakes all of the bundles of type: git, which includes our internal bundles resulting in a very bloated config with lots of unnecessary bundles baked in (Our users have access to our org's repos and don't need our bundles baked into the config).

Proposed Change

This PR adds an optional --skip-git-repos option to augment the existing --skip-bundle-types option. It accepts 1 or more comma-separated string patterns that will be matched with hosted git repo names. Any bundle using a git, git_branch, or github_release descriptor type will have the filtered path value checked with each of the string patterns provided. If there is a match, the bundle will be skipped and not be baked into the config.

Descriptor path values are filtered down to their organization/repo name for the (case-insensitive) comparisons. So the path value, [email protected]:someorgname/tk-multi-someapp.git would have a value of someorgname/tk-multi-someapp for the comparison.

Examples:

  • --skip-git-repos someorgname/tk-multi-someapp would skip any hosted git repo starting with someorgname/tk-multi-someapp
  • --skip-git-repos someorgname/ would skip any hosted git repo in the organization someorgname
  • --skip-git-repos someorgname/tk-multi-someapp, anotherorg/ would skip any hosted git repo starting with someorgname/tk-multi-someapp and any repo in the organization anotherorg

For our use-case described above, we want to skip baking all of the git repos hosted in our organization so we only bake GPL's bundles.

bake_config.py "sgtk:descriptor:[email protected]:GPLgithub/tk-config-wba.git&version=${BUILD_SOURCEBRANCHNAME}" $(Build.ArtifactStagingDirectory)/baked --skip-bundle-types=app_store --skip-git-repos=wbanimation/

CI checks

Happy to modify code as-needed to get tests passing. I don't have visibility into the violations remaining however. :)

Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.66%. Comparing base (eea2ae6) to head (348c7d1).

❗ There is a different number of reports uploaded between BASE (eea2ae6) and HEAD (348c7d1). Click for more details.

HEAD has 12 uploads less than BASE
Flag BASE (eea2ae6) HEAD (348c7d1)
24 12
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #991      +/-   ##
==========================================
- Coverage   79.78%   73.66%   -6.12%     
==========================================
  Files         198      198              
  Lines       20770    20770              
==========================================
- Hits        16571    15301    -1270     
- Misses       4199     5469    +1270     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

1 participant