GoogleContainerTools / skaffold

Easy and Repeatable Kubernetes Development
https://skaffold.dev/
Apache License 2.0
15.05k stars 1.62k forks source link

Skaffold REST API for noticing file changes responds with "missing required boolean parameter 'enabled'" #7503

Closed pre closed 2 years ago

pre commented 2 years ago

Skaffold Control API documentation tells us we can curl :

Running skaffold dev --auto-build=false --auto-deploy=false --rpc-http-port=1234 with the linked example skaffold/examples/getting-started.

The Control API documentation says:

We can make Skaffold start noticing file changes automatically again by issuing the requests:

curl -X PUT http://localhost:50052/v1/build/auto_execute -d '{"enabled": true}' curl -X PUT http://localhost:50052/v1/deploy/auto_execute -d '{"enabled": true}'

Expected behavior

Ask status

❯ curl -X POST http://localhost:1234/v1/state -d '{"build": true}'
{"buildState":{"artifacts":{"skaffold-example":"Not Started"}, "autoTrigger":false, "statusCode":"OK"}, "deployState":{"status":"Complete", "autoTrigger":false, "statusCode":"DEPLOY_SUCCESS"}, "forwardedPorts":{}, "statusCheckState":{"status":"Succeeded", "resources":{"pods":"Succeeded", "transdolan:pod/getting-started":"In Progress"}, "statusCode":"STATUSCHECK_SUCCESS"}, "fileSyncState":{"status":"Not Started", "autoTrigger":true}, "debuggingContainers":[], "metadata":{"build":{"numberOfArtifacts":1, "builders":[{"type":"DOCKER", "count":1}], "type":"LOCAL", "additional":{}}, "deploy":{"deployers":[{"type":"KUBECTL", "count":1}], "cluster":"OTHER"}, "test":null, "additional":{}}, "testState":{"status":"Not Started", "statusCode":"OK"}}%
❯ curl -X POST http://localhost:1234/v1/state -d '{"deploy": true}'
{"buildState":{"artifacts":{"skaffold-example":"Not Started"}, "autoTrigger":false, "statusCode":"OK"}, "deployState":{"status":"Complete", "autoTrigger":false, "statusCode":"DEPLOY_SUCCESS"}, "forwardedPorts":{}, "statusCheckState":{"status":"Succeeded", "resources":{"pods":"Succeeded", "transdolan:pod/getting-started":"In Progress"}, "statusCode":"STATUSCHECK_SUCCESS"}, "fileSyncState":{"status":"Not Started", "autoTrigger":true}, "debuggingContainers":[], "metadata":{"build":{"numberOfArtifacts":1, "builders":[{"type":"DOCKER", "count":1}], "type":"LOCAL", "additional":{}}, "deploy":{"deployers":[{"type":"KUBECTL", "count":1}], "cluster":"OTHER"}, "test":null, "additional":{}}, "testState":{"status":"Not Started", "statusCode":"OK"}}%

Enable build watcher

❯ curl -X POST http://localhost:1234/v1/build/auto_execute -d '{"enabled": true}'
{"code":3, "message":"missing required boolean parameter 'enabled'", "details":[]}%

Enable deploy watcher

❯ curl -X POST http://localhost:1234/v1/deploy/auto_execute -d '{"enabled": true}'
{"code":3, "message":"missing required boolean parameter 'enabled'", "details":[]}%

Actual behavior

Information

Using the Getting Started example as-is:

apiVersion: skaffold/v2beta28
kind: Config
build:
  artifacts:
  - image: skaffold-example
deploy:
  kubectl:
    manifests:
      - k8s-*

Steps to reproduce the behavior

  1. Clone the skaffold Getting Started example
  2. skaffold dev --auto-build=false --auto-deploy=false --rpc-http-port=1234
  3. curl -X POST http://localhost:1234/v1/build/auto_execute -d '{"enabled": true}'
pre commented 2 years ago

Ok, found it .. Thanks for rubber ducking ... the /v1/deploy/auto_execute requires PUT instead of POST.

❯ curl -X PUT http://localhost:1234/v1/deploy/auto_execute -d '{"enabled": true}'
{}  # it works