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

feat: Add git based bundling strategy #7

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

chrismcg
Copy link
Contributor

@chrismcg chrismcg commented Nov 29, 2024

Allow for specifying a bundlingStrategy as part of the bundling params. If this is BundlingStrategy.SOURCE then do the same as before. If it's BundlingStrategy.GIT then use git command output to decide if the package needs rebuilt or not.

 new PythonFunction(stack, 'workspaces_app', {
      rootDir: path.join(rootPath, 'workspaces_app'),
      workspacePackage: 'app',
      index: 'app_handler.py',
      handler: 'handle_event',
      runtime: Runtime.PYTHON_3_10,
      architecture: await getDockerHostArch(),
      bundling: {
        bundlingStrategy: BundlingStrategy.GIT,
      },
    });

If we're not using a package in a workspace app then use the last commit hash for the entire rootDir and anything in git diff to generate the custom hash for CDK bundling.

If we are using a package in a workspace app then get the list of dependencies and check and local ones for changes. This uses the hash of the last commit and any git diff in that part of the tree for each dependency and the package itself.

As this involved editing files in the project the tests add some helper functions to clone the workspace to a temporary directory and do the edits there.

This PR originally had the PACKAGE_VERSION bundling strategy but it's been removed as the tests couldn't be made to pass because of something uv related so lower confidence it would work in practise.

A copy of the SOURCE tests to start.
Make the functions both depend on common and have different external
dependencies.
These are not working correctly yet as `uv sync` is changing the lockfile in a
way that's breaking things. Committing so can make a PR and get help debugging
further.
@chrismcg chrismcg requested a review from eoinsha November 29, 2024 12:18
If we're not using a package in a workspace app then use the last commit hash
for the entire rootDir and anything in git diff to generate the custom hash for
CDK bundling.

If we are using a package in a workspace app then get the list of dependencies
and check and local ones for changes. This uses the hash of the last commit and
any git diff in that part of the tree for each dependency and the package
itself.
Couldn't get the tests to pass so removing for now until we can figure out why
and put it back in.
@chrismcg chrismcg changed the title feat: Add package version bundling strategy feat: Add git based bundling strategy Nov 29, 2024
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