gae, golang, gcloud
別の環境でデプロイできたのに、手元の mac でデプロイできなくなった
GAE の App を deploy するときに、
1$ gcloud app deploy
とすると思います。これを別の環境で行ったときはうまくいっていたのですが、mac から実行するとうまくいきませんでした。
1starting build "*****************"
2
3FETCHSOURCE
4BUILD
5Starting Step #0 - "fetcher"
6Step #0 - "fetcher": Already have image (with digest): gcr.io/cloud-builders/gcs-fetcher
7Step #0 - "fetcher": Fetching manifest gs://staging.hogehoge.appspot.com/ae/*****************************/manifest.json.
8Step #0 - "fetcher": Processing 6 files.
9Step #0 - "fetcher": ******************************************************
10Step #0 - "fetcher": Status: SUCCESS
11Step #0 - "fetcher": Started: 2019-01-30T15:07:00Z
12Step #0 - "fetcher": Completed: 2019-01-30T15:07:00Z
13Step #0 - "fetcher": Requested workers: 200
14Step #0 - "fetcher": Actual workers: 6
15Step #0 - "fetcher": Total files: 6
16Step #0 - "fetcher": Total retries: 0
17Step #0 - "fetcher": GCS timeouts: 0
18Step #0 - "fetcher": MiB downloaded: 0.00 MiB
19Step #0 - "fetcher": MiB/s throughput: 0.01 MiB/s
20Step #0 - "fetcher": Time for manifest: 383.67 ms
21Step #0 - "fetcher": Total time: 0.72 s
22Step #0 - "fetcher": ******************************************************
23Finished Step #0 - "fetcher"
24Starting Step #1 - "builder"
25Step #1 - "builder": Pulling image: gcr.io/gae-runtimes/go111_app_builder:go111_20190123_1_11_3_RC00
26Step #1 - "builder": go111_20190123_1_11_3_RC00: Pulling from gae-runtimes/go111_app_builder
27Step #1 - "builder": Digest: sha256:80ace9b4a0ee4ea753bdd20a1c000bb93510f8f0160ca08a09f2d666973c1993
28Step #1 - "builder": Status: Downloaded newer image for gcr.io/gae-runtimes/go111_app_builder:go111_20190123_1_11_3_RC00
29Step #1 - "builder": 2019/01/30 15:07:03 Your app is not on your GOPATH, this build may fail.
30Step #1 - "builder": 2019/01/30 15:07:03 Building from Go source in /tmp/staging659230188/srv, with main package at ./...
31Step #1 - "builder": 2019/01/30 15:07:03 Building /tmp/staging659230188/srv, saving to /tmp/staging659230188/usr/local/bin/start
32Step #1 - "builder": 2019/01/30 15:07:03 Wrote build output to /builder/outputs/output
33Step #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.
34Step #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:
35Step #1 - "builder": /usr/local/go/src/github.com/go-zen-chu/gae-fitbit-go/pkg/application/command (from $GOROOT)
36Step #1 - "builder": /tmp/staging659230188/srv/gopath/src/github.com/go-zen-chu/gae-fitbit-go/pkg/application/command (from $GOPATH)
37Step #1 - "builder": srv/main.go:4:2: cannot find package "github.com/go-zen-chu/gae-fitbit-go/pkg/domain/index" in any of:
38Step #1 - "builder": /usr/local/go/src/github.com/go-zen-chu/gae-fitbit-go/pkg/domain/index (from $GOROOT)
39...
GOPATH の設定なんてした覚えないぞ…
1$ gcloud version
2Google Cloud SDK 183.0.0
3app-engine-python 1.9.64
4bq 2.0.27
5core 2017.12.08
6gsutil 4.28
古い… アップデートしてみる
1$ gcloud components update
2
3
4
5Your current Cloud SDK version is: 183.0.0
6You will be upgraded to version: 232.0.0
7
8┌────────────────────────────────────────────────────────────────────────────┐
9│ These components will be updated. │
10├─────────────────────────────────────────────────────┬────────────┬─────────┤
11│ Name │ Version │ Size │
12├─────────────────────────────────────────────────────┼────────────┼─────────┤
13│ BigQuery Command Line Tool │ 2.0.40 │ < 1 MiB │
14│ BigQuery Command Line Tool (Platform Specific) │ 2.0.34 │ < 1 MiB │
15│ Cloud SDK Core Libraries │ 2019.01.27 │ 9.2 MiB │
16│ Cloud SDK Core Libraries (Platform Specific) │ 2018.09.24 │ < 1 MiB │
17│ Cloud Storage Command Line Tool │ 4.35 │ 3.6 MiB │
18│ Cloud Storage Command Line Tool (Platform Specific) │ 4.34 │ < 1 MiB │
19│ gcloud app Python Extensions │ 1.9.82 │ 6.2 MiB │
20│ gcloud cli dependencies │ 2019.01.04 │ 2.4 MiB │
21│ gcloud cli dependencies │ 2018.08.03 │ 1.5 MiB │
22└─────────────────────────────────────────────────────┴────────────┴─────────┘
23
24# サイドデプロイを試す
25
26$ gcloud app deploy
27
28The component [app-engine-go] is required for staging this
29application.
30
31Your current Cloud SDK version is: 232.0.0
32Installing components from version: 232.0.0
33
34
35┌───────────────────────────────────────────────┐
36│ These components will be installed. │
37├──────────────────────────┬─────────┬──────────┤
38│ Name │ Version │ Size │
39├──────────────────────────┼─────────┼──────────┤
40│ App Engine Go Extensions │ │ │
41│ App Engine Go Extensions │ 1.9.70 │ 56.4 MiB │
42└──────────────────────────┴─────────┴──────────┘
43
44For the latest full release notes, please visit:
45 https://cloud.google.com/sdk/release_notes
46
47Do you want to continue (Y/n)? Y
App Engine Go Extensions これっぽい。ということで、アップデートが完了したら、すんなり通った。
1starting build "**************************"
2
3FETCHSOURCE
4BUILD
5Starting Step #0 - "fetcher"
6Step #0 - "fetcher": Already have image (with digest): gcr.io/cloud-builders/gcs-fetcher
7Step #0 - "fetcher": Fetching manifest gs://staging.hogehoge.appspot.com/ae/**************************/manifest.json.
8Step #0 - "fetcher": Processing 707 files.
9Step #0 - "fetcher": ******************************************************
10Step #0 - "fetcher": Status: SUCCESS
11Step #0 - "fetcher": Started: 2019-01-30T15:11:00Z
12Step #0 - "fetcher": Completed: 2019-01-30T15:11:03Z
13Step #0 - "fetcher": Requested workers: 200
14Step #0 - "fetcher": Actual workers: 200
15Step #0 - "fetcher": Total files: 707
16Step #0 - "fetcher": Total retries: 107
17Step #0 - "fetcher": GCS timeouts: 107
18Step #0 - "fetcher": MiB downloaded: 12.96 MiB
19Step #0 - "fetcher": MiB/s throughput: 4.43 MiB/s
20Step #0 - "fetcher": Time for manifest: 433.02 ms
21Step #0 - "fetcher": Total time: 3.37 s
22Step #0 - "fetcher": ******************************************************
23Finished Step #0 - "fetcher"
24Starting Step #1 - "builder"
25Step #1 - "builder": Pulling image: gcr.io/gae-runtimes/go111_app_builder:go111_20190123_1_11_3_RC00
26Step #1 - "builder": go111_20190123_1_11_3_RC00: Pulling from gae-runtimes/go111_app_builder
27Step #1 - "builder": Digest: sha256:80ace9b4a0ee4ea753bdd20a1c000bb93510f8f0160ca08a09f2d666973c1993
28Step #1 - "builder": Status: Downloaded newer image for gcr.io/gae-runtimes/go111_app_builder:go111_20190123_1_11_3_RC00
29Step #1 - "builder": 2019/01/30 15:11:05 Copying /workspace/_gopath/src/github.com to /tmp/staging177487791/srv/gopath/src/github.com
30Step #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
31Step #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
32Step #1 - "builder": 2019/01/30 15:11:24 Wrote build output to /builder/outputs/output
33Step #1 - "builder": 2019/01/30 15:11:24 Wrote output to /tmp/staging177487791/usr/local/bin/start
34Step #1 - "builder": 2019/01/30 15:11:24 Making tarball /tmp/tar-out301830978/app.tar.gz
35Step #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
36Finished Step #1 - "builder"
37PUSH
38DONE
そんなぁ (´・ω・`)