spring boot application to test with travis and deploy on Google Cloud - google-app-engine

Recently I ran my Spring Boot code into the Google Cloud platform. Now I want to introduce TRAVIS CI to my source code but I cant deploy it on Google Cloud because I receive the following error:
Step #0: Pulling image: gcr.io/gcp-runtimes/java/runtime-builder#sha256:abe30c228acd8514d83430452b5a45eedea568b55d02d4ddaa2a374b1b086dd8
Step #0: sha256:abe30c228acd8514d83430452b5a45eedea568b55d02d4ddaa2a374b1b086dd8: Pulling from gcp-runtimes/java/runtime-builder
Step #0: Digest: sha256:abe30c228acd8514d83430452b5a45eedea568b55d02d4ddaa2a374b1b086dd8
Step #0: Status: Downloaded newer image for gcr.io/gcp-runtimes/java/runtime-builder#sha256:abe30c228acd8514d83430452b5a45eedea568b55d02d4ddaa2a374b1b086dd8
Step #0: Exception in thread "main" com.google.cloud.runtimes.builder.exception.ArtifactNotFoundException: No deployable artifacts were found. Unable to proceed.
Step #0: at com.google.cloud.runtimes.builder.buildsteps.PrebuiltRuntimeImageBuildStep.getArtifact(PrebuiltRuntimeImageBuildStep.java:77)
Step #0: at com.google.cloud.runtimes.builder.buildsteps.RuntimeImageBuildStep.run(RuntimeImageBuildStep.java:50)
Step #0: at com.google.cloud.runtimes.builder.BuildPipelineConfigurator.generateDockerResources(BuildPipelineConfigurator.java:104)
Step #0: at com.google.cloud.runtimes.builder.Application.main(Application.java:147)
I have configured files like:
web.xml for using jetty
appengine-web.xml for using the Google cloud
.travis.yml for using Travis
app.yaml for using Google cloud
Am I missing some files?

Related

Step #0: exec: "gcc": executable file not found in $PATH

I keep running into this error when trying to deploy a very simple website to App Engine (this code without the Dockerfile, as specified in this tutorial).
I am running on macOS Monterey 12.2.1, go 1.18, fresh install of the Google Cloud SDK. I'm not using any external packages either.
Every time that I try to deploy, I get the Step #0: exec: "gcc": executable file not found in $PATH error. Here's a larger snippet:
Step #0: go: finding golang.org/x/tools v0.0.0-20200904185747-39188db58858
Step #0: go: finding google.golang.org/grpc v1.31.1
Step #0: go: finding golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f
Step #0: # net
Step #0: exec: "gcc": executable file not found in $PATH
Finished Step #0
ERROR
ERROR: build step 0 "gcr.io/gcp-runtimes/go1-builder#sha256:408a098788ef4cdeec452821946b986ef82ce5ebceecbdf748ffecf329765bce" failed: step exited with non-zero status: 2
Any clues what is going wrong? I read some similar posts that it could be an error with the PATH, but I could not get anything to work for myself. Here is my path:
/usr/bin:/usr/local/go/bin:/Users/temporaryadmin/go/bin:/Users/temporaryadmin/google-cloud-sdk/bin:/Users/temporaryadmin/.pyenv/shims:/Users/temporaryadmin/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/bin/python3:/usr/local/go/bin
Really struggling to understand what I can do to fix this so I can start uploading to App Engine. Thanks a lot!

App deploy fails on GCP App Engine (GAE) flexible when specifying engines.node version

gcloud --project my-project-id app deploy app.yaml
fails on GAE Flex when I specify a engines.node version in package.json
but succeeds when I remove it from the package.json, which is contradictory to the https://cloud.google.com/appengine/docs/flexible/nodejs/runtime documentation.
I have specified
"engines": {
"node": "16.x"
}
in my package.json
The error I ultimately get is:
ERROR: gcloud crashed (IOError): [Errno 11] Resource temporarily unavailable
It seems this error is transient as on vary rare occasions in the past 24 hours, the app deploy succeeded.
Google folks, can you confirm the problem is on your side ?
I am deploying on GAE Flex in asia-southeast2-a (Jakarta)
Thanks
Below a more complete log trace
BUILD
Starting Step #0
Step #0: Pulling image: gcr.io/gcp-runtimes/nodejs/gen-dockerfile#sha256:770f37e7042652138c7dac203fc35ef0218002515ddd9f311db1c6c54d6816aa
Step #0: gcr.io/gcp-runtimes/nodejs/gen-dockerfile#sha256:770f37e7042652138c7dac203fc35ef0218002515ddd9f311db1c6c54d6816aa: Pulling from gcp-runtimes/nodejs/gen-dockerfile
Step #0: Digest: sha256:770f37e7042652138c7dac203fc35ef0218002515ddd9f311db1c6c54d6816aa
Step #0: Status: Downloaded newer image for gcr.io/gcp-runtimes/nodejs/gen-dockerfile#sha256:770f37e7042652138c7dac203fc35ef0218002515ddd9f311db1c6c54d6816aa
Step #0: gcr.io/gcp-runtimes/nodejs/gen-dockerfile#sha256:770f37e7042652138c7dac203fc35ef0218002515ddd9f311db1c6c54d6816aa
Step #0: Checking for Node.js.
Finished Step #0
Starting Step #1
Step #1: Already have image (with digest): gcr.io/kaniko-project/executor#sha256:f87c11770a4d3ed33436508d206c584812cd656e6ed08eda1cff5c1ee44f5870
Step #1: INFO[0000] Removing ignored files from build context: [node_modules .dockerignore Dockerfile npm-debug.log yarn-error.log .git .hg .svn app.yaml]
Step #1: INFO[0000] Downloading base image gcr.io/google-appengine/nodejs#sha256:721ce182842495a610589261688f1abc1801c915a7e24880fa15af9e9d725459
Step #1: INFO[0017] Taking snapshot of full filesystem...
Step #1: INFO[0026] Using files from context: [/workspace]
Step #1: INFO[0026] COPY . /app/
Step #1: INFO[0026] Taking snapshot of files...
Step #1: INFO[0026] RUN /usr/local/bin/install_node '16.x'
Step #1: INFO[0026] cmd: /bin/sh
Step #1: INFO[0026] args: [-c /usr/local/bin/install_node '16.x']
Step #1: % Total % Received % Xferd Average Speed Time Time Time Current
Step #1: Dload Upload Total Spent Left Speed
100 30.8M 100 30.8M 0 0 68.9M 0 --:--:-- --:--:-- --:--:-- 68.9M
Step #1: % Total % Received % Xferd Average Speed Time Time Time Current
Step #1: Dload Upload Total Spent Left Speed
100 4035 100 4035 0 0 35238 0 --:--:-- --:--:-- --:--:-- 35394
Step #1: node-v16.13.0-linux-x64.tar.gz: OK
Step #1: Installed Node.js v16.13.0
Step #1: INFO[0028] Taking snapshot of full filesystem...
Step #1: INFO[0030] Adding whiteout for /nodejs/lib/node_modules/npm/node_modules/npm-install-checks/CHANGELOG.md
Step #1: INFO[0030] Adding whiteout for /nodejs/lib/node_modules/npm/node_modules/os-tmpdir
Step #1: INFO[0030] Adding whiteout for /nodejs/lib/node_modules/npm/node_modules/npmlog/CHANGELOG.md
Step #1: INFO[0030] Adding whiteout for /nodejs/lib/node_modules/npm/node_modules/lodash.uniq
(...)
ERROR: gcloud crashed (IOError): [Errno 11] Resource temporarily unavailable
Thanks
[Update] I have upgrade the gcloud-sdk and the error message is a little different now, I get a
[Errno 11] write could not complete without blocking
in the middle of the long logging stream generated by the gcloud app deploy command.
Following the advise of other developers (related to python lib issues, link I found a workaround by adding the --no-user-output-enabled flag to the gcloud app deploy command. This prevents the error from happening.
But this is a temp workaround and I hope the GCP team will fix the issue in the CLI library.

exec: "gcc": executable file not found in $PATH

I'm having an issue where an App Engine project will no longer build remotely (via gcloud app deploy)
This has started out of the blue, with no code changes at this end. Not sure if relevant, but it's a go 1.9 project deploying to the App Engine Flex environment.
I'm not sure how to test this in the same environment as the build, since the error is coming from Google's Container Registry
Here is the log from the Container Registry console
starting build "73f85b4d-7370-41bd-bbb2-bcf42fc38873"
FETCHSOURCE
Fetching storage object: gs://staging.[project].appspot.com/us.gcr.io/[project]/appengine/default.1ed3c690ead06f27aa651a30fab342611:latest#1531698266413753
Copying gs://staging.[project].appspot.com/us.gcr.io/[project]/appengine/default.1ed3c690ead49f731806f27aa630fab342611:latest#1531698266413753...
Operation completed over 1 objects/1.7 MiB.
BUILD
Starting Step #0
Step #0: Pulling image: gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
Step #0: sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db: Pulling from gcp-runtimes/go1-builder
Step #0: Digest: sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
Step #0: Status: Downloaded newer image for gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
Step #0: exec: "gcc": executable file not found in $PATH Finished
Step #0 ERROR ERROR: build step 0 "gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db" failed: exit status 2
It looks like you are using container gcr.io/gcp-runtimes/go1-builder as your build step. Looking at the source in GitHub, I see that there have been no updates since ~late June. I see in the Dockerfile that the base image in the FROM directive is gcr.io/google-appengine/debian9:latest, and a look at that image reveals no gcc installed. I see no step in the Dockerfile installing gcc, and looking at your build step image confirms that it isn't there:
~$ docker run --rm -t -i --entrypoint /bin/bash gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db -- which gcc
Unable to find image 'gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db' locally
sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db: Pulling from gcp-runtimes/go1-builder
e154cec6816f: Pull complete
<pulls elided>
Digest: sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
Status: Downloaded newer image for gcr.io/gcp-runtimes/go1-builder#sha256:c62ac3fbec31ddec70601d6c5b44d07063bcff6a823bdcf5e0bbaa9d3799d1db
~$
Perhaps an earlier version of the base debian9 image had it installed, you could dig into history to look. But it looks like there is no recent change to the go1-builder image to remove gcc.
If you need gcc, you can always separate building your app from deploying it. Build with your own cloudbuild.yaml via gcloud container builds submit and then deploy the built container using gcloud app deploy --image-url=... With full control over the build, you can always based on the go-builder image and install additional tooling you need like gcc on top of that before using Docker to build your final app container.

`gcloud app deploy` command picking the wrong GOPATH

Trying to deploy my GO application with Cloud SQL using gcloud app deploy but build is failing every time with package not found error. Not sure where it is picking the GOPATH from. Is it possible to change the GOPATH in google cloud engine.
Step #0: main.go:9:2: cannot find package "github.com/gin-gonic/gin"
in any of: Step #0: /usr/local/go/src/github.com/gin-gonic/gin (from
$GOROOT) Step #0: /workspace/_gopath/src/github.com/gin-gonic/gin
(from $GOPATH) Step #0: main.go:10:2: cannot find package
"github.com/go-sql-driver/mysql" in any of: Step #0:
/usr/local/go/src/github.com/go-sql-driver/mysql (from $GOROOT) Step
#0: /workspace/_gopath/src/github.com/go-sql-driver/mysql (from $GOPATH) Step #0: main.go:8:2: cannot find package
"google.golang.org/appengine" in any of: Step #0:
/usr/local/go/src/google.golang.org/appengine (from $GOROOT) Step #0:
/workspace/_gopath/src/google.golang.org/appengine (from $GOPATH)
I have import statements to include the above libraries. My local GOPATH is set to /Users/amar.jain/go/ and it is trying to use /workplace/_gopath/
I'm also using the GO App Engine SDK.
As mentioned in here, the following line should be deleted from the app.yaml file when using Flexible environment:
api_version: go1
Compare an example of an app.yaml file when in Flexible and Standard.
These are the options available when configuring the Flexible environment.
Are you using the app engine standard environment?
The app engine standard environment is picky about GOPATH, it does try to upload all files required but it often helps to vendor the dependancies and make sure the app.yaml is at the top level.
https://cloud.google.com/appengine/docs/standard/go/building-app/creating-your-application#structuring_your_application_project
Ive had problems with the standard environment when using the standard go /cmd /pkg structure for example.

Cannot find package when deploy to App Engine

I can not deploy my golang application (with echo framework) on App Engine.
I have some kind of error like:
...
Step #0: main.go:4:2: cannot find package "FBackend/router" in any of:
Step #0: /usr/local/go/src/FBackend/router (from $GOROOT)
Step #0: /workspace/_gopath/src/FBackend/router (from $GOPATH)
Finished
Step #0 ERROR
ERROR: build step 0 "..." failed: exit status 1
In project I have file three like this:
FBackend
...
|___router
| |____router.go
...
|
|___main.go
On localhost all works fine
Judging from the error message, you should set one of the paths to the "src" folder.
They should be able to find "FBackend/router" in "/usr/local/go/src/" since it's there.
I can understand how it can't find "FBackend/router" in "/usr/local/go/src/FBackend/router" cause you probably don't have "/usr/local/go/src/FBackend/router/FBackend/router" setup.

Resources