GAE の build で Your app is not on your GOPATH と出る場合

gcloud を最新にしたら動いた


Posted by Akira Masuda on Wed, Jan 30, 2019
Tags gae, golang, gcloud

別の環境でデプロイできたのに、手元の mac でデプロイできなくなった

GAE の App を deploy するときに、

$ gcloud app deploy

とすると思います。これを別の環境で行ったときはうまくいっていたのですが、mac から実行するとうまくいきませんでした。

starting build "*****************"

FETCHSOURCE
BUILD
Starting Step #0 - "fetcher"
Step #0 - "fetcher": Already have image (with digest): gcr.io/cloud-builders/gcs-fetcher
Step #0 - "fetcher": Fetching manifest gs://staging.hogehoge.appspot.com/ae/*****************************/manifest.json.
Step #0 - "fetcher": Processing 6 files.
Step #0 - "fetcher": ******************************************************
Step #0 - "fetcher": Status: SUCCESS
Step #0 - "fetcher": Started: 2019-01-30T15:07:00Z
Step #0 - "fetcher": Completed: 2019-01-30T15:07:00Z
Step #0 - "fetcher": Requested workers: 200
Step #0 - "fetcher": Actual workers: 6
Step #0 - "fetcher": Total files: 6
Step #0 - "fetcher": Total retries: 0
Step #0 - "fetcher": GCS timeouts: 0
Step #0 - "fetcher": MiB downloaded: 0.00 MiB
Step #0 - "fetcher": MiB/s throughput: 0.01 MiB/s
Step #0 - "fetcher": Time for manifest: 383.67 ms
Step #0 - "fetcher": Total time: 0.72 s
Step #0 - "fetcher": ******************************************************
Finished Step #0 - "fetcher"
Starting Step #1 - "builder"
Step #1 - "builder": Pulling image: gcr.io/gae-runtimes/go111_app_builder:go111_20190123_1_11_3_RC00
Step #1 - "builder": go111_20190123_1_11_3_RC00: Pulling from gae-runtimes/go111_app_builder
Step #1 - "builder": Digest: sha256:80ace9b4a0ee4ea753bdd20a1c000bb93510f8f0160ca08a09f2d666973c1993
Step #1 - "builder": Status: Downloaded newer image for gcr.io/gae-runtimes/go111_app_builder:go111_20190123_1_11_3_RC00
Step #1 - "builder": 2019/01/30 15:07:03 Your app is not on your GOPATH, this build may fail.
Step #1 - "builder": 2019/01/30 15:07:03 Building from Go source in /tmp/staging659230188/srv, with main package at ./...
Step #1 - "builder": 2019/01/30 15:07:03 Building /tmp/staging659230188/srv, saving to /tmp/staging659230188/usr/local/bin/start
Step #1 - "builder": 2019/01/30 15:07:03 Wrote build output to /builder/outputs/output
Step #1 - "builder": 2019/01/30 15:07:03 Failed to build app: Your app is not on your GOPATH, please move it there and try again.
Step #1 - "builder": building app with command '[go build -o /tmp/staging659230188/usr/local/bin/start ./...]', env '[PATH=/go/bin:/usr/local/go/bin:/builder/google-cloud-sdk/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin HOSTNAME=21c041d1877a HOME=/builder/home BUILDER_OUTPUT=/builder/outputs DEBIAN_FRONTEND=noninteractive GOROOT=/usr/local/go/ GOPATH=/go GOPATH=/tmp/staging659230188/srv/gopath]': err=exit status 1, out=srv/main.go:10:2: cannot find package "github.com/go-zen-chu/gae-fitbit-go/pkg/application/command" in any of:
Step #1 - "builder": /usr/local/go/src/github.com/go-zen-chu/gae-fitbit-go/pkg/application/command (from $GOROOT)
Step #1 - "builder": /tmp/staging659230188/srv/gopath/src/github.com/go-zen-chu/gae-fitbit-go/pkg/application/command (from $GOPATH)
Step #1 - "builder": srv/main.go:4:2: cannot find package "github.com/go-zen-chu/gae-fitbit-go/pkg/domain/index" in any of:
Step #1 - "builder": /usr/local/go/src/github.com/go-zen-chu/gae-fitbit-go/pkg/domain/index (from $GOROOT)
...

GOPATH の設定なんてした覚えないぞ…

$ gcloud version
Google Cloud SDK 183.0.0
app-engine-python 1.9.64
bq 2.0.27
core 2017.12.08
gsutil 4.28

古い… アップデートしてみる

$ gcloud components update



Your current Cloud SDK version is: 183.0.0
You will be upgraded to version: 232.0.0

┌────────────────────────────────────────────────────────────────────────────┐
│                     These components will be updated.                      │
├─────────────────────────────────────────────────────┬────────────┬─────────┤
│                         Name                        │  Version   │   Size  │
├─────────────────────────────────────────────────────┼────────────┼─────────┤
│ BigQuery Command Line Tool                          │     2.0.40 │ < 1 MiB │
│ BigQuery Command Line Tool (Platform Specific)      │     2.0.34 │ < 1 MiB │
│ Cloud SDK Core Libraries                            │ 2019.01.27 │ 9.2 MiB │
│ Cloud SDK Core Libraries (Platform Specific)        │ 2018.09.24 │ < 1 MiB │
│ Cloud Storage Command Line Tool                     │       4.35 │ 3.6 MiB │
│ Cloud Storage Command Line Tool (Platform Specific) │       4.34 │ < 1 MiB │
│ gcloud app Python Extensions                        │     1.9.82 │ 6.2 MiB │
│ gcloud cli dependencies                             │ 2019.01.04 │ 2.4 MiB │
│ gcloud cli dependencies                             │ 2018.08.03 │ 1.5 MiB │
└─────────────────────────────────────────────────────┴────────────┴─────────┘

# サイドデプロイを試す

$ gcloud app deploy

The component [app-engine-go] is required for staging this
application.

Your current Cloud SDK version is: 232.0.0
Installing components from version: 232.0.0


┌───────────────────────────────────────────────┐
│      These components will be installed.      │
├──────────────────────────┬─────────┬──────────┤
│           Name           │ Version │   Size   │
├──────────────────────────┼─────────┼──────────┤
│ App Engine Go Extensions │         │          │
│ App Engine Go Extensions │  1.9.70 │ 56.4 MiB │
└──────────────────────────┴─────────┴──────────┘

For the latest full release notes, please visit:
  https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)?  Y

App Engine Go Extensions これっぽい。ということで、アップデートが完了したら、すんなり通った。

starting build "**************************"

FETCHSOURCE
BUILD
Starting Step #0 - "fetcher"
Step #0 - "fetcher": Already have image (with digest): gcr.io/cloud-builders/gcs-fetcher
Step #0 - "fetcher": Fetching manifest gs://staging.hogehoge.appspot.com/ae/**************************/manifest.json.
Step #0 - "fetcher": Processing 707 files.
Step #0 - "fetcher": ******************************************************
Step #0 - "fetcher": Status: SUCCESS
Step #0 - "fetcher": Started: 2019-01-30T15:11:00Z
Step #0 - "fetcher": Completed: 2019-01-30T15:11:03Z
Step #0 - "fetcher": Requested workers: 200
Step #0 - "fetcher": Actual workers: 200
Step #0 - "fetcher": Total files: 707
Step #0 - "fetcher": Total retries: 107
Step #0 - "fetcher": GCS timeouts: 107
Step #0 - "fetcher": MiB downloaded: 12.96 MiB
Step #0 - "fetcher": MiB/s throughput: 4.43 MiB/s
Step #0 - "fetcher": Time for manifest: 433.02 ms
Step #0 - "fetcher": Total time: 3.37 s
Step #0 - "fetcher": ******************************************************
Finished Step #0 - "fetcher"
Starting Step #1 - "builder"
Step #1 - "builder": Pulling image: gcr.io/gae-runtimes/go111_app_builder:go111_20190123_1_11_3_RC00
Step #1 - "builder": go111_20190123_1_11_3_RC00: Pulling from gae-runtimes/go111_app_builder
Step #1 - "builder": Digest: sha256:80ace9b4a0ee4ea753bdd20a1c000bb93510f8f0160ca08a09f2d666973c1993
Step #1 - "builder": Status: Downloaded newer image for gcr.io/gae-runtimes/go111_app_builder:go111_20190123_1_11_3_RC00
Step #1 - "builder": 2019/01/30 15:11:05 Copying /workspace/_gopath/src/github.com to /tmp/staging177487791/srv/gopath/src/github.com
Step #1 - "builder": 2019/01/30 15:11:06 Building from Go source in /tmp/staging177487791/srv/gopath/src/github.com/go-zen-chu/gae-fitbit-go/app/gae-fitbit-go, with main package at github.com/go-zen-chu/gae-fitbit-go/app/gae-fitbit-go
Step #1 - "builder": 2019/01/30 15:11:06 Building /tmp/staging177487791/srv/gopath/src/github.com/go-zen-chu/gae-fitbit-go/app/gae-fitbit-go, saving to /tmp/staging177487791/usr/local/bin/start
Step #1 - "builder": 2019/01/30 15:11:24 Wrote build output to /builder/outputs/output
Step #1 - "builder": 2019/01/30 15:11:24 Wrote output to /tmp/staging177487791/usr/local/bin/start
Step #1 - "builder": 2019/01/30 15:11:24 Making tarball /tmp/tar-out301830978/app.tar.gz
Step #1 - "builder": 2019/01/30 15:11:25 Creating app image on GCR: asia.gcr.io/hogehoge/app-engine-tmp/app/ttl-2h:ed35c5fe-08ce-4e33-b801-0792b9d2b652
Finished Step #1 - "builder"
PUSH
DONE

そんなぁ (´・ω・`)

comments powered by Disqus