6

Every time I try to run an update through deployment manager to an existing deployment in preview, I get the error:

$ gcloud deployment-manager deployments update abc --config abc.yaml
ERROR: (gcloud.deployment-manager.deployments.update) ResponseError: code=400, message=Invalid value for field 'resource.target': ''.  Deployment in preview must not have a target with UPDATE

However, if I don't use the update on the gcloud command line and go to the console and click 'deploy' the update goes through fine.

What can be causing this?

John S
  • 130
  • 6

4 Answers4

10

Just ran into this, I wasn't following the instructions properly. After you created something in preview you do NOT pass the config again you just apply.

create preview

gcloud deployment-manager deployments update my-deployment --config my-config.yaml --preview

run deployment

gcloud deployment-manager deployments update my-deployment

Docs https://cloud.google.com/deployment-manager/docs/deployments/updating-deployments#make_the_update_request

Steve Miskiewicz
  • 1,114
  • 1
  • 10
  • 23
  • This actually makes so much more sense. But i swear the documentation wasn't there when i explored this a year back. Thanks! – John S Jul 24 '19 at 03:34
4

Cancel the preview and then run the deployment update again.

gcloud deployment-manager deployments cancel-preview DEPLOYMENT
Bsquare ℬℬ
  • 4,423
  • 11
  • 24
  • 44
Jeff
  • 41
  • 2
1

This is an issue on our end. We are currently working on a fix; I cannot provide an ETA for the fix at the moment. I strongly suggest continuing to use the work around you’ve found by deploying through the console.

xavierc
  • 502
  • 2
  • 13
1

For me the issue was that I was calling the update API for applying the preview with the full body parameter that I passed when first creating the preview.

The fix was to pass only the fingerprint and name properties in the body parameter for the preview-apply call.

project_name = '...'
deployment_name = '...'

existing_deployment = service.deployments().get(
    project=project_name,
    deployment=deployment_name).execute()

service.deployments().update(
    project=project_name,
    deployment=deployment_name,
    body={
        'name': deployment_name,
        'fingerprint': existing_deployment["fingerprint"],
    },
    preview=False).execute()
Re'em
  • 230
  • 2
  • 11