title: Google App Engine, Google Cloud Console, Jenkins trigger builds remotely, gcloud command not found
body: <p>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 <a href="https://cloud.google.com/tools/cloud-repositories/docs/push-to-deploy#trigger_deployment" rel="nofollow noreferrer">Google Cloud Help</a>:</p>
  
  <pre><code>gcloud --project=&lt;project-id&gt; preview app deploy -q app.yaml
  </code></pre>
  
  <p>I get the follow error message:</p>
  
  <pre><code>[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
  </code></pre>
  
  <p>I have changed the project-id to mine, but i can't figure out why it's missing the gcloud command..</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I ran </p>
  
  <pre><code>/usr/local/bin/gcloud --project=&lt;project-id&gt; preview app deploy -q app.yaml
  </code></pre>
  
  <p>and now i got this error:</p>
  
  <pre><code>Traceback (most recent call last):
  File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 199, in &lt;module&gt;
  _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
  </code></pre>
  
  <h1>FINAL EDIT</h1>
  
  <p>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 <a href="https://cloud.google.com/tools/cloud-repositories/docs/push-to-deploy" rel="nofollow noreferrer">Push-to-Deploy with Jenkins</a>:</p>
  
  <pre><code>$ PASSWORD=&lt;password&gt;                # 12 or more chars, with letters and numbers
  $ PROJECT_ID=&lt;project-id&gt;
  $ BITNAMI_IMAGE=&lt;bitnami-image&gt;      # 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"
  </code></pre>
  
  <p>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: 
  <a href="https://stackoverflow.com/questions/33229133/gcloud-preview-app-cant-parse-my-yaml">Gcloud preview app can&#39;t parse my yaml</a></p>