Skip to content

Preserve folder structure for app source code in bundle generate#2848

Merged
andrewnester merged 9 commits intomainfrom
fix/generate-subfolders
May 13, 2025
Merged

Preserve folder structure for app source code in bundle generate#2848
andrewnester merged 9 commits intomainfrom
fix/generate-subfolders

Conversation

@andrewnester
Copy link
Copy Markdown
Contributor

Changes

Preserve folder structure for app source code in bundle generate

Why

App source code is often complex and contains many subfolders so we need to keep the folder structure so the generated app is working correctly.

Tests

Added acceptance test

@andrewnester andrewnester temporarily deployed to test-trigger-is May 9, 2025 15:50 — with GitHub Actions Inactive
@andrewnester andrewnester temporarily deployed to test-trigger-is May 9, 2025 16:07 — with GitHub Actions Inactive

filename := path.Base(*filePath)
targetPath := filepath.Join(n.sourceDir, filename)
if n.basePath == "" {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to mutate state here? Would be easier to reason about if it's just a variable assignment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do need state because these functions are called recursively so we need to preserve what the basePath is

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might have missed this, but which function is recursive here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I wasn't clear there, it's markDirectoryForDownload calling markFileForDownload. We could pass basePath to markFileForDownload and markNotebookForDownload but I'd prefer to incapsulate it into state of the downloader object instead


filename := path.Base(*notebookPath) + ext
targetPath := filepath.Join(n.sourceDir, filename)
if n.basePath == "" {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to modify markNotebookForDownload? Seems like only markFileForDownload is called for apps generate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For apps - yes, but generally it makes sense to make this improvement for all types of files we donwload

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we only call markDirectoryForDownload in apps. We also don't call markNotebookForDownload in markDirectoryForDownload.

Is there still an improvement to be had?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we don't need, this is more for consistency between the functions, so all of the respect the basePath

Copy link
Copy Markdown
Contributor

@shreyas-goenka shreyas-goenka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Approving to unblock.

@andrewnester andrewnester enabled auto-merge May 13, 2025 11:43
@andrewnester andrewnester added this pull request to the merge queue May 13, 2025
Merged via the queue into main with commit a3f0fff May 13, 2025
10 checks passed
@andrewnester andrewnester deleted the fix/generate-subfolders branch May 13, 2025 12:23
deco-sdk-tagging bot added a commit that referenced this pull request May 14, 2025
## Release v0.252.0

### Dependency updates
* Upgraded Go SDK to 0.69.0 ([#2867](#2867))
* Upgraded to TF provider 1.79.0 ([#2869](#2869))

### Bundles
* Remove unused fields from resources.models schema: creation\_timestamp, last\_updated\_timestamp, latest\_versions and user\_id. Using them now raises a warning ([#2828](#2828)).
* Preserve folder structure for app source code in bundle generate ([#2848](#2848))
* Fix normalising requirements file path in dependencies section ([#2861](#2861))
* Fix default-python template not to add environments when serverless=yes and include\_python=no ([#2866](#2866))
* Fix handling of Unicode characters in Python support ([#2873](#2873))
* Add support for secret scopes in DABs ([#2744](#2744))
* Make `artifacts.*.type` optional in bundle JSON schema ([#2881](#2881))
* Fix support for `spot_bid_max_price` field in Python support ([#2883](#2883))
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.

2 participants