GoogleCloudPlatform / functions-framework-dotnet

FaaS (Function as a service) framework for writing portable .NET functions
Apache License 2.0
189 stars 41 forks source link

GOOGLE_BUILDABLE flag - nested project supprt #187

Closed AshleyMedway closed 3 years ago

AshleyMedway commented 3 years ago

I have a scenario where I have a two layout project setup. e.g.

root ├── Parent1 │ ├── Project1 │ └── Project2 ├── Parent2 │ ├── Project3 │ └── Project4

Project1 contains my cloud function, but it depends on all the projects. I am running gcloud functions deploy at the root level. I have tried the following variation of the flag --set-build-env-vars=GOOGLE_BUILDABLE but nothing works. The command hangs with no output.

Is this a limitation in the build variable or am I doing something wrong?

Running the command from Parent1 level with just --set-build-env-vars=GOOGLE_BUILDABLE=Project1 works as expected, but of course the build fails because the dependencies in Parent2 are not uploaded.

Thanks, Ashley

jskeet commented 3 years ago

I'll have a look at this on Monday. If you could provide a complete (but still minimal!) example as a zip file, that would be really helpful. (I'd expect Parent1/Project1 to be what you want, so I'm surprised that doesn't work.)

AshleyMedway commented 3 years ago

Right, so when creating an MCVE, it worked! So its not an issue with the flag. So I looked for what was different between my example and my real code and the only difference is the presence of a .cloudignore. When I delete the .cloudignore it worked for my real project.

Here's a sample of my .cloudignore file:

# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
#   $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.git-hooks
.gitignore

#!include:.gitignore

AdminPanel
AlexaSkill
BuildDefinitions
BusinessAlerts

It's actually 68 lines long, but nothing more complex than ignoring some top level folders. My gut feel is the reference to the .gitignore which is 600 lines long.

I'll do some further testing but we can close this issue.

jskeet commented 3 years ago

Thanks - do feel free to reopen if (after investigating) it still looks like a problem.

AshleyMedway commented 3 years ago

It might also be worth noting that GOOGLE_BUILDABLE is case-sensitive which gave me a little bit of a headache 😃

jskeet commented 3 years ago

Ah yes - will do that on Monday; thanks for the feedback, that's really helpful.