GoogleCloudPlatform / app-gradle-plugin

The library has moved to https://github.com/GoogleCloudPlatform/appengine-plugins/tree/main/app-gradle-plugin
Apache License 2.0
153 stars 40 forks source link

Unable to deploy dispatch.yaml file with `appengineDeployAll` #400

Closed jianglai closed 3 years ago

jianglai commented 3 years ago

I am able to run appengineDeployDispatch to deploy the generated dispatch.yaml file in appengine-generated, but when running appengineDeployAll I encounter what seems to be a contention.

Content of dispatch.yaml:

$ cat /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/dispatch.yaml
dispatch:
- url: '*/rdap/*'
  module: pubapi
- url: '*/whois/*'
  module: pubapi
- url: '*/_dr/whois'
  module: pubapi
- url: '*/check'
  module: pubapi

Running appengineDeployDispatch:

> Task :services:default:appengineDeployDispatch
Configurations to update:

descriptor:      [/usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/dispatch.yaml]
type:            [routing rules]
target project:  [domain-registry-alpha]

Updating config [dispatch]...
..Waiting for operation [apps/domain-registry-alpha/operations/b8e441a4-786e-4d0c-8dbb-efcbf672adc5] to complete...
...............................................................done.
.done.

Custom routings have been updated.

Running appengineDeployAll:

> Task :services:default:appengineStage
Reading application configuration data...
2021-04-14 15:16:52.970:INFO::main: Logging initialized @903ms to org.eclipse.jetty.util.log.StdErrLog
Apr 14, 2021 3:16:53 PM com.google.apphosting.utils.config.IndexesXmlReader readConfigXml
INFO: Successfully processed /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/exploded-default/WEB-INF/datastore-indexes.xml

Beginning interaction for module default...
0% Scanning for jsp files.
0% Generated git repository information file.
Success.
Temporary staging for module default directory left in /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app

> Task :services:default:appengineDeployAll
Services to deploy:

descriptor:      [/usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/app.yaml]
source:          [/usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app]
target project:  [domain-registry-alpha]
target service:  [default]
target version:  [20210414t151656]
target url:      [https://domain-registry-alpha.appspot.com]

Configurations to update:

descriptor:      [/usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/cron.yaml]
type:            [cron jobs]
target project:  [domain-registry-alpha]

descriptor:      [/usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/dispatch.yaml]
type:            [routing rules]
target project:  [domain-registry-alpha]

descriptor:      [/usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/dos.yaml]
type:            [DoS blacklist]
target project:  [domain-registry-alpha]

descriptor:      [/usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/index.yaml]
type:            [datastore indexes]
target project:  [domain-registry-alpha]

descriptor:      [/usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/queue.yaml]
type:            [task queues]
target project:  [domain-registry-alpha]

WARNING: Caution: You are updating queue configuration. This will override any changes
performed using 'gcloud tasks'. More details at
https://cloud.google.com/tasks/docs/queue-yaml

Beginning deployment of service [default]...
╔════════════════════════════════════════════════════════════╗
╠═ Uploading 4 files to Google Cloud Storage                ═╣
╚════════════════════════════════════════════════════════════╝
File upload done.
Updating service [default]...
.............................................................................................................................................................................................................................................................................................................................................................done.
Setting traffic split for service [default]...
.................................done.
Stopping version [domain-registry-alpha/default/20210414t150846].
Sent request to stop version [domain-registry-alpha/default/20210414t150846]. This operation may take some time to complete. If you would like to verify that it succeeded, run:
  $ gcloud app versions describe -s default 20210414t150846
until it shows that the version has stopped.
Deployed service [default] to [https://domain-registry-alpha.appspot.com]
Updating config [cron]...
.....done.
Updating config [dispatch]...
.failed.
ERROR: (gcloud.app.deploy) Apps instance [domain-registry-alpha] is the subject of a conflict: Cannot operate on apps/domain-registry-alpha because an operation is already in progress for apps/domain-registry-alpha by a4f41679-308b-4729-8319-d13d96842d14.
- '@type': type.googleapis.com/google.rpc.DebugInfo
  detail: |-
    [ORIGINAL ERROR] generic::aborted: Cannot operate on apps/domain-registry-alpha because an operation is already in progress for apps/domain-registry-alpha by a4f41679-308b-4729-8319-d13d96842d14.
    com.google.net.rpc3.RpcException: generic::ABORTED: Cannot operate on apps/domain-registry-alpha because an operation is already in progress for apps/domain-registry-alpha by a4f41679-308b-4729-8319-d13d96842d14. [google.rpc.error_details_ext] { code: 10 message: "Cannot operate on apps/domain-registry-alpha because an operation is already in progress for apps/domain-registry-alpha by a4f41679-308b-4729-8319-d13d96842d14." }

> Task :services:default:appengineDeployAll FAILED
chanseokoh commented 3 years ago

I don't think this is an issue in the app-gradle-plugin tooling. You'll likely hit the same issue when using gcloud.

Handing this over to the App Engine service team: @eamonnmcmanus @ludoch

jianglai commented 3 years ago

I don't think this is an issue in the app-gradle-plugin tooling. You'll likely hit the same issue when using gcloud.

Handing this over to the App Engine service team: @eamonnmcmanus @ludoch

I think it might have to do with how the plugin calls gcloud (assuming that's that it uses under the hood) in appengineDeployAll that causes the contention. If I run gcloud directly it is fine. Also as I reported running appengineDeployDispatch is also fine.

$ gcloud app deploy /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/dispatch.yaml
Configurations to update:

descriptor:      [/usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/dispatch.yaml]
type:            [routing rules]
target project:  [domain-registry-alpha]

Do you want to continue (Y/n)?  y

Waiting for operation [apps/domain-registry-alpha/operations/6c645484-5377-4f4a-bf72-ae11ddbd21d7] to complete...done.      
Updating config [dispatch]...done.                                                                                          

Custom routings have been updated.
chanseokoh commented 3 years ago

What if you deploy all?

$ gcloud app deploy \
    /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/app.yaml \
    /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/cron.yaml \
    /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/dispatch.yaml \
    /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/dos.yaml \
    /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/index.yaml \
    /usr/local/google/home/jianglai/nomulus-overlay/services/default/build/staged-app/WEB-INF/appengine-generated/queue.yaml 
jianglai commented 3 years ago

It failed with the same message.

I tried both the internal and the external version of gcloud. Both gave the same error.

$ gcloud --version
Google Cloud SDK Fri Apr  9 10:16:58 2021 (1617977818) - CL @367627453
$ ~/google-cloud-sdk/bin/gcloud --version
Google Cloud SDK 336.0.0
bq 2.0.66
core 2021.04.09
gsutil 4.61
jianglai commented 3 years ago

Should I open a bug in buganizer for gcloud instead?

jianglai commented 3 years ago

Done. Filed b/185777977.

chanseokoh commented 3 years ago

Seems like the bug is fixed internally. Closing.