Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Resources: 1 created, 0 changed, 0 deleted, 0 unchanged

>>> print_app_requests
{
"body": {
"description": "my_app_description",
"name": "[UNIQUE_NAME]"
},
"method": "POST",
"path": "/api/2.0/apps",
"q": {
"no_compute": "true"
},
"body": {
"description": "my_app_description",
"name": "[UNIQUE_NAME]"
}
}

Expand All @@ -35,17 +35,17 @@ Resources: 0 created, 1 changed, 0 deleted, 0 unchanged

>>> print_app_requests
{
"body": {},
"method": "POST",
"path": "/api/2.0/apps/[UNIQUE_NAME]/start"
"path": "/api/2.0/apps/[UNIQUE_NAME]/start",
"body": {}
}
{
"method": "POST",
"path": "/api/2.0/apps/[UNIQUE_NAME]/deployments",
"body": {
"mode": "SNAPSHOT",
"source_code_path": "/Workspace/Users/[USERNAME]/.bundle/lifecycle-started-toggle-[UNIQUE_NAME]/default/files/app"
},
"method": "POST",
"path": "/api/2.0/apps/[UNIQUE_NAME]/deployments"
}
}

>>> errcode [CLI] apps get [UNIQUE_NAME]
Expand All @@ -63,9 +63,9 @@ Resources: 0 created, 1 changed, 0 deleted, 0 unchanged

>>> print_app_requests
{
"body": {},
"method": "POST",
"path": "/api/2.0/apps/[UNIQUE_NAME]/stop"
"path": "/api/2.0/apps/[UNIQUE_NAME]/stop",
"body": {}
}

>>> errcode [CLI] apps get [UNIQUE_NAME]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ cleanup() {
trap cleanup EXIT

print_app_requests() {
jq --sort-keys 'select(.method != "GET" and (.path | contains("/apps")) and (.path | contains("/api/2.0/bundle") | not)) | del(.body.url)' < "$OUT_REQUESTS"
rm "$OUT_REQUESTS"
# --unique: appdeploy.Deploy retries POST .../deployments after waiting when the first
# attempt fails, so on cloud the same request is occasionally recorded twice.
print_requests.py //apps '^//api/2.0/bundle' --del-body url --unique
}

title "Deploy with started=false: app created without compute (no_compute=true)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Created apps.myapp
Files: 3 uploaded, 0 deleted
Resources: 1 created, 0 changed, 0 deleted, 0 unchanged

>>> print_requests.py //apps
>>> print_requests.py //apps --unique
{
"method": "POST",
"path": "/api/2.0/apps",
Expand Down Expand Up @@ -38,7 +38,7 @@ Updated apps.myapp
Files: 1 uploaded, 0 deleted
Resources: 0 created, 1 changed, 0 deleted, 0 unchanged

>>> print_requests.py //deployments ^//api/2.0/bundle
>>> print_requests.py //deployments ^//api/2.0/bundle --unique
{
"method": "POST",
"path": "/api/2.0/apps/[UNIQUE_NAME]/deployments",
Expand Down Expand Up @@ -81,7 +81,7 @@ Updated apps.myapp
Files: 1 uploaded, 0 deleted
Resources: 0 created, 1 changed, 0 deleted, 0 unchanged

>>> print_requests.py //apps
>>> print_requests.py //apps --unique
{
"method": "POST",
"path": "/api/2.0/apps/[UNIQUE_NAME]/stop",
Expand Down Expand Up @@ -114,7 +114,7 @@ Updated apps.myapp
Files: 1 uploaded, 0 deleted
Resources: 0 created, 1 changed, 0 deleted, 0 unchanged

>>> print_requests.py //apps
>>> print_requests.py //apps --unique
{
"method": "POST",
"path": "/api/2.0/apps/[UNIQUE_NAME]/update",
Expand Down
12 changes: 8 additions & 4 deletions acceptance/bundle/resources/apps/lifecycle-started/script
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ cleanup() {
}
trap cleanup EXIT

# --unique: appdeploy.Deploy retries POST .../deployments after waiting when the first
# attempt fails (e.g. a deployment is already in progress right after start), so on
# cloud the same request is occasionally recorded twice.

title "Deploy with started=true: app created with compute running"
trace errcode $CLI bundle deploy
trace print_requests.py //apps
trace print_requests.py //apps --unique
rm -f "$OUT_REQUESTS"
{ trace errcode $CLI apps get $UNIQUE_NAME | jq '.compute_status.state'; } || true

title "Re-deploy with description change: code deployed again"
trace update_file.py databricks.yml my_app_description MY_APP_DESCRIPTION
trace errcode $CLI bundle deploy
trace print_requests.py //deployments ^//api/2.0/bundle
trace print_requests.py //deployments ^//api/2.0/bundle --unique
rm -f "$OUT_REQUESTS"

title "Stop app externally while config says started=true: plan detects drift"
Expand All @@ -31,14 +35,14 @@ title "Stop app externally, then deploy with started=false: app stays stopped"
trace update_file.py databricks.yml "started: true" "started: false"
trace update_file.py databricks.yml MY_APP_DESCRIPTION MY_APP_DESCRIPTION_2
trace errcode $CLI bundle deploy
trace print_requests.py //apps
trace print_requests.py //apps --unique
rm -f "$OUT_REQUESTS"
{ trace errcode $CLI apps get $UNIQUE_NAME | jq '.compute_status.state'; } || true

title "Deploy with started=true: compute restarted and code deployed"
trace update_file.py databricks.yml "started: false" "started: true"
trace update_file.py databricks.yml MY_APP_DESCRIPTION_2 MY_APP_DESCRIPTION_3
trace errcode $CLI bundle deploy
trace print_requests.py //apps
trace print_requests.py //apps --unique
rm -f "$OUT_REQUESTS"
{ trace errcode $CLI apps get $UNIQUE_NAME | jq '.compute_status.state'; } || true
Loading