internal: Refactor immutable folder upload as an internal resource in direct engine - #6084
internal: Refactor immutable folder upload as an internal resource in direct engine#6084andrewnester wants to merge 5 commits into
Conversation
Approval status: pending
|
Integration test reportCommit: aa73e34
11 interesting tests: 4 SKIP, 3 FAIL, 3 RECOVERED, 1 KNOWN
Top 1 slowest tests (at least 2 minutes):
|
| Deploying resources... | ||
| Updating deployment state... | ||
| Deployment complete! | ||
| \nSnapshot did not change as expected |
There was a problem hiding this comment.
nit: \n is printed verbatim rather than as newline.
| // For regular resources like "resources.jobs.foo.name", returns ("resources.jobs.foo", "name"). | ||
| // For sub-resources like "resources.jobs.foo.permissions[0].level", returns ("resources.jobs.foo.permissions", "[0].level"). | ||
| func splitResourcePath(path *structpath.PathNode) (string, *structpath.PathNode) { | ||
| // Internal resources: "internal.<name>.<field>" — key is first two components. |
There was a problem hiding this comment.
Can we keep using resources. format? Could be resources.internal_files or resources.files. We control the namespace so we can ensure they don't conflict.
| "deployments": [ | ||
| { | ||
| "command_path": "${workspace.snapshot_path}/files/src/main.py", | ||
| "command_path": "${internal.snapshot.full_path}/files/src/main.py", |
There was a problem hiding this comment.
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.
|
|
||
| // NewAdapterFromInstance creates an Adapter from an already-initialized resource | ||
| // instance. Use this for internal resources whose New() method doesn't take a | ||
| // workspace client. |
There was a problem hiding this comment.
Unclear why do we need it a custom New there. SnapshotClient is a wrapper for WorkspaceClient, so we can just create it normally?
Changes
Refactor immutable folder upload as an internal resource in direct engine
Why
This enables us:
${internal.snapshot.full_path}and it's automatically resolved during deployTests
Existing tests pass