Skip to content

internal: Refactor immutable folder upload as an internal resource in direct engine - #6084

Open
andrewnester wants to merge 12 commits into
mainfrom
feat/upload-resource
Open

internal: Refactor immutable folder upload as an internal resource in direct engine#6084
andrewnester wants to merge 12 commits into
mainfrom
feat/upload-resource

Conversation

@andrewnester

Copy link
Copy Markdown
Contributor

Changes

Refactor immutable folder upload as an internal resource in direct engine

Why

This enables us:

  1. Keep track of upload state and upload paths, so next deployment can check the status of the uploaded folder. Needed for breakglass
  2. Easier path resolution: now all resources can just reference to internal resource like ${internal.snapshot.full_path} and it's automatically resolved during deploy
  3. Plan is correct now and can easily skip uploads if nothing changed and no need to upload

Tests

Existing tests pass

@andrewnester
andrewnester requested a review from denik July 28, 2026 11:29
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

13 files changed
Suggested: @denik
Also eligible: @pietern, @janniklasrose, @shreyas-goenka, @lennartkats-db, @anton-107

/bundle/ - needs approval

30 files changed
Suggested: @denik
Also eligible: @pietern, @janniklasrose, @shreyas-goenka, @lennartkats-db, @anton-107

/cmd/bundle/ - needs approval

Files: cmd/bundle/plan.go
Suggested: @denik
Also eligible: @pietern, @janniklasrose, @shreyas-goenka, @lennartkats-db, @anton-107

General files (require maintainer)

Files: libs/snapshot/client.go, libs/snapshot/hash.go, libs/testserver/handlers.go
Based on git history:

  • @denik -- recent work in bundle/direct/dresources/, bundle/direct/, bundle/phases/

Any maintainer (@anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 54a7dc0

Run: 30825422939

Env ❌​FAIL 💚​RECOVERED 🙈​SKIP ✅​pass 🙈​skip Time
❌​ aws linux 1 4 4 305 1070 7:39
❌​ aws windows 1 4 4 307 1068 5:41
❌​ azure linux 1 4 4 304 1070 8:15
❌​ azure windows 1 4 4 306 1068 5:50
❌​ gcp linux 1 1 5 305 1070 6:38
❌​ gcp windows 1 1 5 307 1068 6:16
9 interesting tests: 4 RECOVERED, 4 SKIP, 1 FAIL
Test Name aws linux aws windows azure linux azure windows gcp linux gcp windows
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
🙈​ TestAccept/bundle/invariant/no_drift 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_endpoints/drift/recreated_same_name 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/bundle/resources/vector_search_indexes/recreate/embedding_dimension 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
🙈​ TestAccept/ssh/connection 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S 🙈​S
❌​ TestInvariantConfigsCoverage ❌​F ❌​F ❌​F ❌​F ❌​F ❌​F
💚​ TestFetchRepositoryInfoAPI_FromRepo 💚​R 💚​R 💚​R 💚​R 🙈​S 🙈​S
💚​ TestFetchRepositoryInfoAPI_FromRepo/root 💚​R 💚​R 💚​R 💚​R
💚​ TestFetchRepositoryInfoAPI_FromRepo/subdir 💚​R 💚​R 💚​R 💚​R
Top 5 slowest tests (at least 2 minutes):
duration env testname
2:57 gcp windows TestAccept
2:53 azure windows TestAccept
2:52 aws windows TestAccept
2:11 azure windows TestFilerWorkspaceFilesExtensionsStat
2:04 gcp linux TestFilerWorkspaceFilesExtensionsReadDir

@denik denik left a comment

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.

I think we should not have edge case for "internal" resources. We can just create resources.internal_files, populate it ourselves (forbid users from touching it) and then just let the framework handle it as a regular resource.

Deploying resources...
Updating deployment state...
Deployment complete!
\nSnapshot did not change as expected

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.

nit: \n is printed verbatim rather than as newline.

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.

Also, is this expected "Snapshot did not change as expected"?

Comment thread bundle/direct/bundle_plan.go Outdated
"deployments": [
{
"command_path": "${workspace.snapshot_path}/files/src/main.py",
"command_path": "${internal.snapshot.full_path}/files/src/main.py",

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.

Instead of custom path, can we keep using ${workspace.file_path}, just make it an alias internally to internal resource's snapshot path.

That way:

  • users know what this means
  • users can use the variable themselves and it'll work both in regular and immutable case.

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.

${workspace.file_path} is ${internal.snapshot.full_path}/files and because we resolve the variables ${workspace.file_path} resolved to this pass. I'd prefer not to change the way variable reslution works and introduce some custom aliases

Comment thread bundle/direct/dresources/adapter.go Outdated
@andrewnester
andrewnester requested a review from denik August 3, 2026 13:00
Comment thread bundle/config/mutator/reject_internal_resources.go Outdated
}

func (v *filesToSync) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
// Immutable folder does not use the sync mechanism, so we don't need to validate it.

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.

why not? This validates "sync:" section in the config, is that ignored for immutable deployments?

I thought the source set of files is unchanged for immutable deployments, is that not true?

Comment thread libs/snapshot/client.go
@@ -35,12 +36,15 @@ type ACLEntry struct {
// the same workspace location.
// This interface exists so the implementation can later be replaced with a Go SDK call.

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.

This does not explain why we need the interface - do we plan on supporting multiple implementation at the same time?

trace $CLI jobs get $JOB_ID | jq '.settings.tasks' | jq '.[] | select(.spark_python_task != null) | .spark_python_task.python_file'
trace $CLI jobs get $JOB_ID | jq '.settings.tasks' | jq '.[] | select(.notebook_task != null) | .notebook_task.notebook_path'
trace $CLI jobs get $JOB_ID | jq '.settings.tasks' | jq '.[] | select(.notebook_task != null) | .notebook_task.base_parameters.path'
PYTHON_FILE_1=$($CLI jobs get $JOB_ID | jq '.settings.tasks' | jq '.[] | select(.spark_python_task != null) | .spark_python_task.python_file')

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.

we can store "jobs get" output and query it multiple times - would matter if we run this test on Cloud.

trace jq '.plan["resources.snapshots.immutable"]' plan.json
rm plan.json

trace $CLI bundle deploy

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.

could you read EnvMatrix.READPLAN here for serialized plan? This is good at catching issues with implicit state transfer.

Deploying resources...
Updating deployment state...
Deployment complete!
\nSnapshot did not change as expected

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.

Also, is this expected "Snapshot did not change as expected"?

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.

3 participants