Matt Wilbert
Matt Wilbert

Reputation: 384

Can you deploy a Gen2 cloud function from below the top level of a Cloud Source repository?

It appears that you cannot deploy a Gen2 cloud function using gcloud from a cloud source repo unless it is at the top level.

Here's a sample redacted deploy command for a gen 1 python function that works:

gcloud beta functions deploy funcname --source https://source.developers.google.com/projects/projectname/repos/reponame/moveable-aliases/main/paths/pathname --runtime python310 --trigger-http --project=projectname

if you add the -gen2 flag, it fails because it can't find main.py. Error is:

OperationError: code=3, message=Build failed with status: FAILURE and message: missing main.py and GOOGLE_FUNCTION_SOURCE not specified. Either create the function in main.py or specify GOOGLE_FUNCTION_SOURCE to point to the file that contains the function.

If you add main.py to the root of the repo and run the same command, it finds main.py, which indicates to me that it isn't honoring the paths.

There is an additional problem which doesn't matter unless the first one is fixed, which is that if pathname is below the top level (folder/subfolder) gcloud sees that as a syntax error when the gen2 flag is set, but not without it.

Is there any way around this? It is very inconvenient.

Upvotes: 0

Views: 813

Answers (1)

Sathi Aiswarya
Sathi Aiswarya

Reputation: 2905

Answering as community wiki.As per above comments

There is a bug raised for this at issue tracker. Which is still open further progress can be tracked there.

Upvotes: 1

Related Questions