I am on the learning curve for gcloud app deploy. I have been struggling with running the .net HelloWorld example code from this location:
https://github.com/GoogleCloudPlatform/dotnet-docs-samples/tree/master/appengine/flexible/HelloWorld
The example runs fine on a desktop when I start it with Visual Studio. But, I can't get past the step of
running using "gcloud app deploy" from a cmd window. Below are details of two runs, first as an
out-of-the-box, and second as after adding a doocker file.
Is anyone else able to run the HelloWorld example as is with the current version of gcloud sdk?
Thanks for your help,
Bob
Here is the gcloud version info:
gcloud --version
Google Cloud SDK 299.0.0
bq 2.0.58
core 2020.06.26
gsutil 4.51
RUN 1
Here is the tail end of the gcloud output after a fresh install of gcloud sdk, and a fresh clone of
/dotnet-docs-samples/...
...
Step #0: Status: Downloaded newer image for gcr.io/gcp-runtimes/aspnetcorebuild#sha256:f5552a5efdaf278a3124ea10fd1c9636b09fc9f98f9e620cbd71279797576b3f
Step #0: gcr.io/gcp-runtimes/aspnetcorebuild#sha256:f5552a5efdaf278a3124ea10fd1c9636b09fc9f98f9e620cbd71279797576b3f
Step #0: No .deps.json file found for the app
Finished Step #0
ERROR
ERROR: build step 0 "gcr.io/gcp-runtimes/aspnetcorebuild#sha256:f5552a5efdaf278a3124ea10fd1c9636b09fc9f98f9e620cbd71279797576b3f" failed: step exited with non-zero status: 1
------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.app.deploy) Cloud build failed. Check logs at https://console.cloud.google.com/cloud-build/builds/44677e0d-0fcb-4460-907b-835cbf621f5e?project=704308180369 Failure status: UNKNOWN: Error Response: [2] Build failed; check build logs for details
RUN 2
After some searching around, I found a suggestion to switch to using a custom runtime, and a docker file.
So I made two changes, one in the app.yaml file, and adding the docker file.
Here is the app.yaml file.
runtime: custom
env: flex
# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 4
disk_size_gb: 10
env_variables:
# The __ in My__Greeting will be translated to a : by ASP.NET.
My__Greeting: Hello AppEngine!
readiness_check:
app_start_timeout_sec: 600
Here is the Dockerfile. The file came from this location:
https://github.com/dotnet/dotnet-docker/blob/50e95cd9af6458ce0db21e6ec952e29c3ee1fadf/2.1/aspnet/alpine3.10/amd64/Dockerfile
ARG REPO=mcr.microsoft.com/dotnet/core/runtime-deps
FROM $REPO:2.1-alpine3.10
# Install ASP.NET Core
ENV ASPNETCORE_VERSION 2.1.15
RUN wget -O aspnetcore.tar.gz https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$ASPNETCORE_VERSION/aspnetcore-runtime-$ASPNETCORE_VERSION-linux-musl-x64.tar.gz \
&& aspnetcore_sha512='4a6ab78abc08c3e02c948de0af5fd324269785adad1b4e17bb849025ab280b7b8216cb48da5d480270cf3d596b342cedd4dc77eeaae82151fea44816e3856c69' \
&& echo "$aspnetcore_sha512 aspnetcore.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf aspnetcore.tar.gz -C /usr/share/dotnet \
&& rm aspnetcore.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
Here is the tail end of the run using the docker file.
...
},
"handlers": [
{
"script": {
"scriptPath": "PLACEHOLDER"
},
"urlRegex": ".*"
}
],
"manualScaling": {
"instances": 1
},
"resources": {
"cpu": 1.0,
"diskGb": 10,
"memoryGb": 0.5
},
"runtime": "vm"
}"
DEBUG: Operation [apps/solitairesupport/operations/a41d48d9-6fc8-422b-84b6-1e18b3a70162] not complete. Waiting to retry.
Updating service [default] (this may take several minutes).../DEBUG: Operation [apps/solitairesupport/operations/a41d48d9-6fc8-422b-84b6-1e18b3a70162] not complete. Waiting to retry.
Updating service [default] (this may take several minutes)...-DEBUG: Operation [apps/solitairesupport/operations/a41d48d9-6fc8-422b-84b6-1e18b3a70162] not complete. Waiting to retry.
[MANY LINES REMOVED HERE]
Updating service [default] (this may take several minutes)...-DEBUG: Operation [apps/solitairesupport/operations/a41d48d9-6fc8-422b-84b6-1e18b3a70162] not complete. Waiting to retry.
Updating service [default] (this may take several minutes).../DEBUG: Operation [apps/solitairesupport/operations/a41d48d9-6fc8-422b-84b6-1e18b3a70162] complete. Result: {
"done": true,
"error": {
"code": 9,
"message": "\nApplication startup error! Code: APP_CONTAINER_CRASHED\n"
},
"metadata": {
"#type": "type.googleapis.com/google.appengine.v1.OperationMetadataV1",
"insertTime": "2020-07-03T17:06:36.191Z",
"method": "google.appengine.v1.Versions.CreateVersion",
"target": "apps/solitairesupport/services/default/versions/20200703t100554",
"user": "xxxx#gmail.com"
},
"name": "apps/solitairesupport/operations/a41d48d9-6fc8-422b-84b6-1e18b3a70162"
}
Updating service [default] (this may take several minutes)...failed.
DEBUG: (gcloud.app.deploy) Error Response: [9]
Application startup error! Code: APP_CONTAINER_CRASHED
Traceback (most recent call last):
File "...AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\cli.py", line 983, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\calliope\backend.py", line 807, in Run
resources = command_instance.Run(args)
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\surface\app\deploy.py", line 117, in Run
default_strategy=flex_image_build_option_default))
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 651, in RunDeploy
ignore_file=args.ignore_file)
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\command_lib\app\deploy_util.py", line 437, in Deploy
extra_config_settings)
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\appengine_api_client.py", line 208, in DeployService
poller=done_poller)
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\operations_util.py", line 314, in WaitForOperation
sleep_ms=retry_interval)
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\util\waiter.py", line 264, in WaitFor
sleep_ms, _StatusUpdate)
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\util\waiter.py", line 326, in PollUntilDone
sleep_ms=sleep_ms)
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\util\retry.py", line 229, in RetryOnResult
if not should_retry(result, state):
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\util\waiter.py", line 320, in _IsNotDone
return not poller.IsDone(operation)
File "...\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\api_lib\app\operations_util.py", line 183, in IsDone
encoding.MessageToPyValue(operation.error)))
googlecloudsdk.api_lib.app.operations_util.OperationError: Error Response: [9]
Application startup error! Code: APP_CONTAINER_CRASHED
ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error! Code: APP_CONTAINER_CRASHED
Ok, I'm familiar with Google Cloud Platform but not (now) as familiar with .NET.
I'm using Linux (!) and Cloud Shell:
gcloud alpha cloud-shell ssh
I cloned the repo and made no other changes to it.
I am able to run the project locally and test it:
dotnet run
and, from another shell:
curl localhost:8080
Hello World!
NOTE it's unstated (perhaps obvious) but you must dotnet run (better dotnet publish) to create the ./bin/Debug directory.
I created a project, set up billing, created an app engine app:
PROJECT="[[YOUR-PROJECT-ID]]"
BILLING="[[YOUR-BILLING-ID]]"
REGION="[[YOUR-REGION]]"
gcloud projects create ${PROJECT}
gcloud beta billing projects link ${PROJECT} --billing-account=${BILLING}
gcloud app create --project=${PROJECT} --region=${REGION}
Then, per documentation:
dotnet publish
The contents of ./bin/Debug/netcoreapp2.1/publish:
56 Jul 6 16:23 appsettings.json
544 Jul 6 16:23 app.yaml
223992 Jul 6 16:27 HelloWorld.deps.json
8192 Jul 6 16:27 HelloWorld.dll
1708 Jul 6 16:27 HelloWorld.pdb
213 Jul 6 16:27 HelloWorld.runtimeconfig.json
516 Jul 6 16:30 web.config
NOTE contains app.yaml and HelloWorld.deps.json
Then:
gcloud app deploy ./bin/Debug/netcoreapp2.1/publish/app.yaml \
--project=${PROJECT}
And:
ENDPOINT=$(\
gcloud app describe \
--project=${PROJECT} \
--format="value(defaultHostname)")
curl ${ENDPOINT}
Hello AppEngine!
Then, in the ./appengine/flexible/HelloWorld directory, I created Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS builder
WORKDIR /source
COPY *.sln .
COPY *.csproj .
RUN dotnet restore
COPY . .
RUN dotnet publish -c release -o /app --no-restore
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1
WORKDIR /app
COPY --from=builder /app ./
ENTRYPOINT ["dotnet", "HelloWorld.dll"]
NOTE using this as a guide.
NOTE I downgraded to 2.1 (rather than 3.1) to avoid a dotnet build error but that's due to my unfamiliarity with the runtime(s).
I changed Program.cs to force the use of :8080:
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseUrls("http://0.0.0.0:8080")
.Build();
}
I revised app.yaml to use custom runtime:
runtime: custom
env: flex
Then:
gcloud app deploy --project=${PROJECT}
Works.
Related
I have a number of Python 3.7 apps on Google App Engine standard, all building and deploying fine. I'm trying to upgrade some of them to the new Python 3.8 runtime, but when I try to deploy, they fail in Cloud Build.
It looks like they're hitting this open pip bug (more background). Odd that only the Python 3.8 runtime triggers this bug, though, and 3.7 builds fine.
Full log below. (Note that it's happening in Cloud Build, not my local machine, so I can't upgrade pip or otherwise change any of the commands or environment.) Anyone know how I can fix or work around this?
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.beta.app.deploy) Error Response: [9] Cloud build 83e346a0-7e88-43dd-b89c-a4820526e4a1 status: FAILURE
Error ID: f8df99ad
Error type: INTERNAL
Error message: ... (setup.py): started
Building wheel for webapp2 (setup.py): finished with status 'done'
Created wheel for webapp2: filename=webapp2-3.0.0b1-py3-none-any.whl size=68362 sha256=9dd9f3ab6a55404492a88eb9a6bacb00faa37efafbc41f21a24d21cfba0eaea3
Stored in directory: /layers/google.python.pip/pipcache/wheels/55/e9/4d/76b030f418cac0bef4a3dcc15ca95c9671f1e826731ce2bc0f
Building wheel for tlslite-ng (setup.py): started
Building wheel for tlslite-ng (setup.py): finished with status 'done'
Created wheel for tlslite-ng: filename=tlslite_ng-0.7.5-py3-none-any.whl size=199869 sha256=b9ead00f0832041fba1e9d3883e57847995c2d6f83ecb7ea87d09cf82c730e8b
Stored in directory: /layers/google.python.pip/pipcache/wheels/a6/e1/a6/09610854c3405202d0b71d8f869811781e40cd26ffb85eacf8
Successfully built gdata humanize mf2py mf2util python-tumblpy ujson webapp2 tlslite-ng
Installing collected packages: six, ecdsa, tlslite-ng, lxml, gdata, certifi, urllib3, chardet, idna, requests, setuptools, protobuf, googleapis-common-protos, pyasn1, pyasn1-modules, rsa, cachetools, google-auth, pytz, grpcio, google-api-core, google-cloud-core, google-cloud-logging, gunicorn, pbr, extras, linecache2, traceback2, python-mimeparse, argparse, unittest2, testtools, fixtures, mox3, soupsieve, beautifulsoup4, gdata-python3, redis, google-cloud-datastore, google-cloud-ndb, humanize, MarkupSafe, jinja2, webencodings, html5lib, mf2py, mf2util, oauthlib, prawcore, websocket-client, update-checker, praw, requests-oauthlib, python-tumblpy, tweepy, ujson, webob, webapp2, oauth-dropins
Running setup.py develop for oauth-dropins
ERROR: Command errored out with exit status 1:
command: /opt/python3.8/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/workspace/setup.py'"'"'; __file__='"'"'/workspace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --home /tmp/pip-target-zp53suvg
cwd: /workspace/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --home not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: /opt/python3.8/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/workspace/setup.py'"'"'; __file__='"'"'/workspace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --home /tmp/pip-target-zp53suvg Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/opt/python3.8/bin/python3 -m pip install --upgrade pip' command.
Full build logs: https://console.cloud.google.com/cloud-build/builds/83e346a0-7e88-43dd-b89c-a4820526e4a1?project=216076569502
Here's my requirements.txt file. I suspect the -e . might be the problem...but it works with Python 3.7, so if so, that's disappointing.
git+https://github.com/dvska/gdata-python3.git#egg=gdata
google-cloud-logging~=1.14
gunicorn~=20.0
mox3~=0.28
# this includes everything in setup.py's install_requires.
# https://caremad.io/posts/2013/07/setup-vs-requirement/#developing-reusable-things-or-how-not-to-repeat-yourself
-e .
I checked pypi page of oauth-dropins (at which it is failing) and they're mentioning there exactly this issue being caused by -e
I'm trying the following tutorial.
Automatic serverless deployments with Cloud Source Repositories and Container Builder
But I got the error below.
$ gcloud container builds submit --config deploy.yaml .
BUILD
Already have image (with digest): gcr.io/cloud-builders/gcloud
ERROR: (gcloud.beta.functions.deploy) Error creating a ZIP archive with the source code for directory .: ZIP does not support timestamps before 1980
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gcloud" failed: exit status 1
I'm now trying to solve it. Do you have any idea? My gcloud is the latest version.
$ gcloud -v
Google Cloud SDK 193.0.0
app-engine-go
app-engine-python 1.9.67
beta 2017.09.15
bq 2.0.30
core 2018.03.09
gsutil 4.28
Sample google cloud function code on the tutorial.
#index.js
exports.f = function(req, res) {
res.send("hello, gcf!");
};
#deploy.yaml
steps:
- name: gcr.io/cloud-builders/gcloud
args:
- beta
- functions
- deploy
- --trigger-http
- --source=.
- --entry-point=f
- hello-gcf # Function name
#deploying without Cloud Container Builder is fine.
gcloud beta functions deploy --trigger-http --source=. --entry-point=f hello-gcf
Container Builder tars your source folder. Maybe something in your . directory has corrupted dates? That's why moving it to the source folder fixes it.
While I don't know the reason, I found a workaround.
(1) make src directory and move index.js into it.
├── deploy.yaml
└── src
└── index.js
(2) deploy via Cloud Container Builder.
$ gcloud container builds submit --config deploy.yaml ./src
I ran into the same issue now. I could not solve it but at least I found out where it comes from.
When you locally submit your build there is a tar created and uploaded to a bucket. In this tar the folders are created at 01.01.1970:
16777221 8683238 drwxr-xr-x 8 user staff 0 256 "Jan 1 01:00:00 1970" "Jan 1 01:00:00 1970" "May 15 12:42:04 2019" "Jan 1 01:00:00 1970" 4096 0 0 test
This issue only occurs locally. If you have a github build trigger it works
I recently came across the same issue using Cloud Build (the successor to Container Builder).
What helped was adding a step to list all the files/folders in the Cloud Build environment (default directory is /workspace) to identify the problematic file/folder. You can do this by overriding the gcloud container's entrypoint to execute the ls command.
steps
- name: gcr.io/cloud-builders/gcloud
entrypoint: "ls"
args: ["-la", "/workspace"]
Here is a MCVE:
/.travis.yml:
language: python
python:
- "3.5"
dist: trusty
addons:
chrome: stable
before_install:
- pip install selenium
- wget https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip -d test/driver/
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3
script:
- cd test
- python3 ./test_main.py
/test/test_main.py:
from selenium.webdriver import *
b=Chrome('driver/chromedriver')
b.get('http://example.com')
b.quit()
The build will fail, raising an exception saying that chrome is crashed:
$ python3 ./test_main.py
Traceback (most recent call last):
File "./test_main.py", line 2, in <module>
b=Chrome('driver/chromedriver')
File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__
desired_capabilities=desired_capabilities)
File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.14.12-041412-generic x86_64)
The code above used to work several days ago, so I am wondering if it is a bug in the travis build environment.
https://github.com/travis-ci/travis-ci/issues/8836
According to the support team:
It seems something changed with the Chrome version we are installing on our container-based infrastructure. We are still looking into the contributing factors and we will hopefully come up with a fix soon.
In the meantime, a workaround is to route your builds to our sudo-enabled infrastructure by adding the following to your .travis.yml file:
sudo: required
addons:
chrome: stable
I'm trying to deploy my GAE app remotely with a URL, and this part works nicely.
Jenkins checks out the latest revision correctly but when trying to build with the command specified in the Google Cloud Help:
gcloud --project=<project-id> preview app deploy -q app.yaml
I get the follow error message:
[workspace] $ /bin/sh -xe /opt/bitnami/apache-tomcat/temp/hudson7352698921882428590.sh
+ gcloud --project=XYZXYZXYZ preview app deploy -q app.yaml
/opt/bitnami/apache-tomcat/temp/hudson7352698921882428590.sh: 2:
/opt/bitnami/apache-tomcat/temp/hudson7352698921882428590.sh: gcloud: not found
Build step 'Execute shell' marked build as failure
I have changed the project-id to mine, but i can't figure out why it's missing the gcloud command..
EDIT
I ran
/usr/local/bin/gcloud --project=<project-id> preview app deploy -q app.yaml
and now i got this error:
Traceback (most recent call last):
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 199, in <module>
_cli = CreateCLI()
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 197, in CreateCLI
return loader.Generate()
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 384, in Generate
cli = self.__MakeCLI(top_group)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 546, in __MakeCLI
log.AddFileLogging(self.__logs_dir)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 546, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 330, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 407, in _SetupLogsDir
os.makedirs(day_dir_path)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/.config'
Build step 'Execute shell' marked build as failure
FINAL EDIT
For anyone comming around here later, i did not exactly solve this, but at least i managed to get around this error by creating an all new VM through the command Google has written in the guide Push-to-Deploy with Jenkins:
$ PASSWORD=<password> # 12 or more chars, with letters and numbers
$ PROJECT_ID=<project-id>
$ BITNAMI_IMAGE=<bitnami-image> # e.g. bitnami-jenkins-1-606-0-linux-debian-7-x86-64
$ gcloud compute \
instances create bitnami-jenkins \
--project ${PROJECT_ID} \
--image-project bitnami-launchpad \
--image ${BITNAMI_IMAGE} \
--zone us-central1-a \
--machine-type n1-standard-1 \
--metadata "bitnami-base-password=${PASSWORD},bitnami-default-user=user,bitnami-key=jenkins,bitnami-name=Jenkins,bitnami-url=//bitnami.com/stack/jenkins,bitnami-description=Jenkins,startup-script-url=https://dl.google.com/dl/jenkins/p2dsetup/setup-script.sh" \
--scopes "https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/devstorage.full_control,https://www.googleapis.com/auth/projecthosting,https://www.googleapis.com/auth/appengine.admin" \
--tags "bitnami-launchpad"
At least with this new VM i could move forward and i'm now close to get it working, but i'm stuck on another error which i've created another question for now:
Gcloud preview app can't parse my yaml
Try specifying the gcloud executable with its full path - it might not be accessible in jenkins' shell PATH environment.
OSError: [Errno 13] Permission denied: '/.config' suggests that Jenkins is attempting to use the root directory as a configuration directory, possibly because of an unusual $HOME directory configuration.
Try setting $CLOUDSDK_CONFIG to point to a directory that the Jenkins user has access to:
CLOUDSDK_CONFIG=/tmp /home/margorjon/google-cloud-sdk/bin/gcloud version
As Dan Cornilescu said, path env variable was not set correctly. Run:
ln -s /var/jenkins_home/google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud
in your worker node to symlink gcloud to global path
I'm trying to deploy my appengine go application to managed vm, and I keep getting this error
Pulling image: google/appengine-go
Traceback (most recent call last):
File "/home/honeybooboo/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 170, in <module>
main()
File "/home/honeybooboo/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 166, in main
_cli.Execute()
File "/home/honeybooboo/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 385, in Execute
post_run_hooks=self.__post_run_hooks, kwargs=kwargs)
File "/home/honeybooboo/google-cloud-sdk/./lib/googlecloudsdk/calliope/frontend.py", line 274, in _Execute
pre_run_hooks=pre_run_hooks, post_run_hooks=post_run_hooks)
File "/home/honeybooboo/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 928, in Run
result = command_instance.Run(args)
File "/home/honeybooboo/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/setup_managed_vms.py", line 39, in Run
args.image_version)
File "/home/honeybooboo/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/pull.py", line 54, in PullBaseDockerImages
util.PullSpecifiedImages(docker_client, image_names, version, bucket)
File "/home/honeybooboo/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/util.py", line 232, in PullSpecifiedImages
'Error pulling {image}: {e}'.format(image=image_name, e=e))
googlecloudsdk.appengine.lib.images.util.DockerPullError: Error pulling google/appengine-go: 404 Client Error: Not Found ("No such id: localhost:49156/google/appengine-go")
My docker version
Client version: 1.3.0
Client API version: 1.15
Go version (client): go1.3.3
Git commit (client): c78088f
OS/Arch (client): linux/amd64
Server version: 1.3.0
Server API version: 1.15
Go version (server): go1.3.3
Git commit (server): c78088f
My Gcloud version
Google Cloud SDK 0.9.37
app 2014.11.18
app-engine-go-linux-x86_64 1.9.15
app-engine-java 1.9.15a
app-engine-managed-vms 2014.11.03
app-engine-python 1.9.15a
app-engine-python-extras 1.9.6
bq 2.0.18
bq-nix 2.0.18
compute 2014.11.25
core 2014.11.25
core-nix 2014.10.20
dns 2014.11.06
gae-go 2014.11.25
gae-go-nix 2014.09.10
gae-python 2014.05.06
gcutil 1.16.5
gcutil-nix 1.16.5
gsutil 4.6
gsutil-nix 4.6
preview 2014.11.18
preview-extensions-linux-x86_64 4.1
sql 2014.11.18
Sorry that you're having problems. We're aware of this issue and it is already fixed in the next SDK release (coming out in a week). As a temporary workaround please try to run
gcloud --verbosity debug preview app setup-managed-vms
(and choose Go in the list of options)
several times (until success) to get the base image for go runtime.
Another options is to try pulling the base go image (google/appengine-go) from containers-prod
bucket using google/docker-registry https://registry.hub.docker.com/u/google/docker-registry/
Pull the google/docker-registry
docker pull google/docker-registry
Get your credentials
gcloud auth print-refresh-token
Store your refresh token and your bucket (containers prod in a registry-params.env file)
cat registry-params.env
GCP_OAUTH2_REFRESH_TOKEN=your-refresh-token
GCS_BUCKET=containers-prod
Run registry
docker run -d --env-file=registry-params.env -p 5000:5000 google/docker-registry
Pull the image
docker pull localhost:5000/google/appengine-go
Retag the image
docker tag localhost:5000/google/appengine-go google/appengine-go
Remove old tag containing registry name
docker rmi localhost:5000/google/appengine-go
Check your image is in there. You'll see something like
docker images | grep google
You'll see something like
google/appengine-go latest 35ef8e2a9c5e 13 days ago 206 MB
Don't forget to stop your registry container
docker ps
docker stop <CONTAINER ID>