Skip to content

Commit e84a292

Browse files
authored
Remove src folder from immutable folder paths (#5939)
## Changes Remove `src` folder from immutable folder paths ## Why API won't unpack the snapshot into `src` folder and instead will unpack in the root of snapshot path. ## Tests Covered by acceptance tests <!-- If your PR needs to be included in the release notes for next release, add a changelog fragment: create .nextchanges/<section>/<name>.md with a one-line description (e.g. .nextchanges/cli/quickstart.md). See .nextchanges/README.md. -->
1 parent 8e7ad0e commit e84a292

6 files changed

Lines changed: 16 additions & 17 deletions

File tree

acceptance/bundle/deploy/immutable-no-artifacts/output.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Updating deployment state...
1515
Deployment complete!
1616

1717
>>> [CLI] jobs get [NUMID]
18-
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/src/files/src/main.py"
18+
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/files/src/main.py"
1919

2020
>>> [CLI] jobs get [NUMID]
21-
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/src/files/src/notebook"
21+
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/files/src/notebook"
2222

2323
>>> [CLI] jobs get [NUMID]
24-
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/src/files/some_path"
24+
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/files/some_path"
2525

2626
>>> [CLI] bundle destroy --auto-approve
2727
The following resources will be deleted:

acceptance/bundle/deploy/immutable/output.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Building python_artifact...
1313
[
1414
{
1515
"notebook_task": {
16-
"notebook_path": "${workspace.snapshot_path}/src/files/src/notebook"
16+
"notebook_path": "${workspace.snapshot_path}/files/src/notebook"
1717
},
1818
"task_key": "notebook_task"
1919
},
@@ -28,7 +28,7 @@ Building python_artifact...
2828
{
2929
"environment_key": "env",
3030
"spark_python_task": {
31-
"python_file": "${workspace.snapshot_path}/src/files/src/main.py"
31+
"python_file": "${workspace.snapshot_path}/files/src/main.py"
3232
},
3333
"task_key": "spark_python_task"
3434
}
@@ -42,14 +42,14 @@ Updating deployment state...
4242
Deployment complete!
4343

4444
>>> [CLI] jobs get [NUMID]
45-
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/src/files/src/main.py"
45+
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/files/src/main.py"
4646

4747
>>> [CLI] jobs get [NUMID]
48-
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/src/files/src/notebook"
48+
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/files/src/notebook"
4949

5050
>>> [CLI] jobs get [NUMID]
5151
[
52-
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/src/artifacts/.internal/immutable-0.0.1-py3-none-any.whl"
52+
"/Workspace/Users/[UUID]/.snapshots/[UUID]/[SNAPSHOT_HASH]/artifacts/.internal/immutable-0.0.1-py3-none-any.whl"
5353
]
5454

5555
>>> [CLI] bundle destroy --auto-approve

acceptance/bundle/resources/apps/immutable/output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ You can access the app at my-immutable-app-123.cloud.databricksapps.com
3737
"path": "/api/2.0/apps/my-immutable-app/deployments",
3838
"body": {
3939
"mode": "SNAPSHOT",
40-
"source_code_path": "${workspace.snapshot_path}/src/files/app"
40+
"source_code_path": "${workspace.snapshot_path}/files/app"
4141
}
4242
}

acceptance/bundle/validate/immutable_workspace_paths/output.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Warning: Pattern user_repls.json does not match any files
2323
"ai_runtime_task": {
2424
"deployments": [
2525
{
26-
"command_path": "${workspace.snapshot_path}/src/files/src/main.py",
26+
"command_path": "${workspace.snapshot_path}/files/src/main.py",
2727
"compute": {
2828
"accelerator_count": 1,
2929
"accelerator_type": "GPU_1xA10"
@@ -37,7 +37,7 @@ Warning: Pattern user_repls.json does not match any files
3737
{
3838
"existing_cluster_id": "0101-120000-aaaaaaaa",
3939
"spark_python_task": {
40-
"python_file": "${workspace.snapshot_path}/src/files/src/main.py"
40+
"python_file": "${workspace.snapshot_path}/files/src/main.py"
4141
},
4242
"task_key": "my_task"
4343
}

bundle/config/mutator/translate_paths.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,10 @@ func applyTranslations(ctx context.Context, b *bundle.Bundle, t *translateContex
333333
}}
334334
}
335335
// Use a placeholder referencing workspace.snapshot_path so that paths are stored
336-
// as ${workspace.snapshot_path}/src/files/<rel> during validate. After
336+
// as ${workspace.snapshot_path}/files/<rel> during validate. After
337337
// snapshot.Upload() sets workspace.snapshot_path, a variable-resolution pass
338338
// expands these references to the actual content-addressed paths.
339-
t.remoteRoot = "${workspace.snapshot_path}/src/files"
339+
t.remoteRoot = "${workspace.snapshot_path}/files"
340340
case config.IsExplicitlyEnabled(t.b.Config.Presets.SourceLinkedDeployment):
341341
t.remoteRoot = t.b.SyncRootPath
342342
default:

bundle/deploy/snapshot/upload.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,12 @@ func (m *snapshotUpload) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagn
6868

6969
log.Infof(ctx, "Snapshot uploaded to %s", info.Path)
7070

71-
// The API unpacks the zip under a "src" subdirectory.
7271
b.Config.Workspace.SnapshotPath = info.Path
73-
b.Config.Workspace.FilePath = path.Join(info.Path, "src", "files")
72+
b.Config.Workspace.FilePath = path.Join(info.Path, "files")
7473
// Only set artifact_path when artifacts are present; with no artifacts the
75-
// zip has no "src/artifacts" directory and a get-status on it would 404.
74+
// zip has no "artifacts" directory and a get-status on it would 404.
7675
if len(b.Config.Artifacts) > 0 {
77-
b.Config.Workspace.ArtifactPath = path.Join(info.Path, "src", "artifacts")
76+
b.Config.Workspace.ArtifactPath = path.Join(info.Path, "artifacts")
7877
}
7978

8079
return diags

0 commit comments

Comments
 (0)