'gcloud promote a version

So, I've deployed a custom runtime to gcloud (with --no-promote), using:

gcloud preview app deploy --project $PROJECT_NAME --version ${VERSION} --no-promote --quiet app.yaml

I saw that it all works well, and now I want to route traffic to it. Using the UI, it is simple - just checking the version's checkbox, and clicking a button.

However, from the CLI, it appears that I need specify the app.yaml again. Why is that? Everything was already deployed...

Is there a way to route traffic to it (i.e., "promote" it), without having to specify app.yaml again? i.e., other means rather than:

gcloud preview app deploy --project $PROJECT_NAME --version ${VERSION} --promote --quiet app.yaml

Thanks for all your help.

Cheers,

Ohad



Solution 1:[1]

I think what you are looking for is

gcloud preview app modules set-default <module_name> --version <version_name> --project=<project_name>

This will set the specified version as default for the module you want. Additional documentation can be found here:

https://cloud.google.com/sdk/gcloud/reference/preview/app/modules/set-default

Solution 2:[2]

My solution in 2022 used in pipeline script:

gcloud --project "$PROJECT_ID_PRODUCTION" app versions migrate  "$CI_COMMIT_SHORT_SHA"

Documentation link https://cloud.google.com/sdk/gcloud/reference/app/versions/migrate

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vilas
Solution 2 Simon