Skip to content

Instantly share code, notes, and snippets.

@mkscrg
Last active August 7, 2018 17:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkscrg/526bf56abee7879ca8c29af8a3003218 to your computer and use it in GitHub Desktop.
Save mkscrg/526bf56abee7879ca8c29af8a3003218 to your computer and use it in GitHub Desktop.
gcloud app deploy fails with google.golang.org dependencies

gcloud app deploy fails with google.golang.org dependencies

This is a repro case for issue #13199: https://code.google.com/p/googleappengine/issues/detail?id=13199

# This code builds cleanly:
./build
# But fails to deploy with `gcloud`:
gcloud -q --project PROJECT_ID app deploy

Example gcloud ouput:

$ gcloud -q --project gcloud-app-deploy-issue app deploy
WARNING: Automatic app detection is currently in Beta
You are about to deploy the following services:
 - gcloud-app-deploy-issue/default/20160810t110640 (from [/Users/mike/Development/mkscrg/sandbox/gcloud-app-deploy-issue/app.yaml])
     Deployed URL: [https://gcloud-app-deploy-issue.appspot.com]

Beginning deployment of service [default]...
WARNING: Ignoring file [.gitignore]: File matches ignore regex.
WARNING: Ignoring directory [.sdk]: Directory matches ignore regex.
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] Deployment contains files that cannot be compiled: Compile failed:
2016/08/10 11:06:45 go-app-builder: build timing: 1×compile (123ms total), 0×link (0 total)
2016/08/10 11:06:45 go-app-builder: failed running compile: exit status 1

hello.go:6: can't find import: "google.golang.org/appengine"
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
#!/usr/bin/env bash
set -ex
if [ ! -d .sdk/go_appengine ]; then
mkdir -p .sdk
zip_file="go_appengine_sdk_darwin_amd64-1.9.40.zip"
curl "https://storage.googleapis.com/appengine-sdks/featured/$zip_file" > ".sdk/$zip_file"
( cd .sdk; unzip "$zip_file" )
fi
export PATH="$PWD/.sdk/go_appengine:$PATH"
export GOPATH="$PWD/.sdk/go_appengine/gopath"
goapp get google.golang.org/appengine
goapp build
package hello
import (
"fmt"
"net/http"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
)
func init() {
http.HandleFunc("/", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
ctx := appengine.NewContext(r);
log.Infof(ctx, "Got a request: %v", r.URL);
fmt.Fprint(w, "Hello, world!")
}
@m-mayran
Copy link

m-mayran commented Feb 3, 2017

Since Google Cloud SDK 142.0.0 with app-engine-go 1.9.50, you should be able to deploy your application doing
gcloud beta app deploy
This also enables you to use CI/CD tools

@afcastano
Copy link

afcastano commented May 17, 2017

With the new version of Google Cloud SDK 155.0.0 and app-engine-go 1.9.53, I can confirm that gcloud app deploy command works. I don't even need to add the beta argument.

Thanks!

@go101
Copy link

go101 commented Aug 7, 2018

works? Neither gcloud app deploy nor gcloud beta app deploy works for me.

@go101
Copy link

go101 commented Aug 7, 2018

go get -u google.golang.org/appengine/... is the key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment