Disclamer – this post covers the situation with Travis CI and GAE as of January 2017, APIs may be changed and issues may be resolved soon.
Travis CI provides possibility to deploy go applications to GAE after a successful build. There are quite severe limitations if you’re using plain App Engine, not Managed VMs.
First of all there are two ways Golang application can be deployed to GAE. You can use either gcloud command
The difference is that if use
goapp an application is being built locally and then
sent to application engine, if you use
gcloud source code is being sent to Google
Cloud storage and built out of GCS bucket. Travis CI uses
gcloud under the hood
and it appears gcloud is going to be the default way in the future.
There are two major issues with deploying via
gcloud – first service account you use
to deploy should have both ‘App Engine Deployer’ and ‘Storage Object Admin’ roles assigned.
If it does not have ‘Storage Object Admin’ role upload to storage fails and you see something like
this is Travis log:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
the second issue is dependencies.
gcloud does not pull any prior to building an application.
In Travis log you see following import errors:
1 2 3 4 5
names of problem packages may vary, of course. Vendoring package dependencies along with your
application is tricky as GAE prohibits using certain functionality. For example one of packages
you depend on imports
syscall package. You’ll get the following compilation error:
I get this error even if I add
nobuild_files as suggested here. It’s also possible `nobuild_files option is deprecated
as it’s not listed in Google documentation.
At this point I gave up. Maybe if I play more with packages in vendor directory I could fix build but the whole pipeline would be too flimsy anyway. I’ll be deploying manually until something better shows up on a horizon. Travis may work better with Golang apps deployed to Managed VMs as there are no restrictions on imports.