Answers: <p>AFAIK there are only 2 ways of deploying GAE apps:</p>
  
  <ul>
  <li>using the <a href="https://cloud.google.com/sdk/gcloud/reference/app/deploy" rel="nofollow noreferrer"><code>gcloud app deploy</code></a> command:</li>
  </ul>
  
  <blockquote>
    <p>gcloud app deploy - deploy the local code and/or configuration of your
    app to App Engine</p>
  </blockquote>
  
  <ul>
  <li>using the Admin API. From <a href="https://cloud.google.com/appengine/docs/admin-api/deploying-overview" rel="nofollow noreferrer">Deploying Your Apps with the Admin API</a>:</li>
  </ul>
  
  <blockquote>
    <p>To deploy a version of your app with the Admin API:</p>
    
    <ol>
    <li><a href="https://cloud.google.com/appengine/docs/admin-api/uploading-resources" rel="nofollow noreferrer">Upload your app's resources to Cloud Storage</a>.</li>
    <li><a href="https://cloud.google.com/appengine/docs/admin-api/creating-config-files" rel="nofollow noreferrer">Create a configuration file that defines your deployment</a>.</li>
    <li><a href="https://cloud.google.com/appengine/docs/admin-api/deploying-apps" rel="nofollow noreferrer">Create and send the HTTP request for deploying your app</a>.</li>
    </ol>
  </blockquote>
  
  <p>Both <code>gcloud</code> (used in the 1st method) as well as <code>gsutil</code> (used in the 1st step of the 2nd method) are part of the <a href="https://cloud.google.com/sdk/docs/" rel="nofollow noreferrer">Google Cloud SDK</a>, so you'll need to have the SDK installed on your runner.</p>
  
  <p>Summarizing the required steps from a GAE deployment example using the 1st approach that I found in <a href="https://revs.runtime-revolution.com/getting-started-with-angular-6-gitlab-ci-cd-and-google-app-engine-b1118efcdf69" rel="nofollow noreferrer">Getting started with Angular 6, GitLab CI/CD and Google App Engine</a> (probably a good read for details):</p>
  
  <ul>
  <li>in gitlab set env vars with your GAE service account and project ID info</li>
  <li>in your <code>.gitlab-ci.yml</code> file's deployment section add a <code>before_script</code> section for installing the SDK (update for current SDK version)</li>
  </ul>
  
  <blockquote>
  <pre><code>        before_script:
            - wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-218.0.0-linux-x86.tar.gz
            - tar -xzf  google-cloud-sdk-218.0.0-linux-x86.tar.gz
            - ./google-cloud-sdk/install.sh
  </code></pre>
  </blockquote>
  
  <p>and a <code>script</code> section for the actual deployment, referencing those env vars:</p>
  
  <blockquote>
  <pre><code>        script:
            - echo $GAE_KEY_FILE &gt; gae_auth.json
            - ./google-cloud-sdk/bin/gcloud auth activate-service-account --key-file gae_auth.json
            - ./google-cloud-sdk/bin/gcloud app deploy --project=$GAE_PROJECT_ID
  </code></pre>
  </blockquote>
  
Answers: CC BY-SA 4.0
Answers: 2019-01-17T17:29:08.053Z
Answers: 2019-01-17T17:29:08.053Z
Answers: Dan Cornilescu
Body: <p>How to deploy from Gitlab CI to AppEngine Standard environment?</p>
  
Tags: <cicd><gitlab-ci-runner>
Title: How to deploy to Appengine standard from gitlab CI?
UserDisplayName: saif
ThreadText: # How to deploy to Appengine standard from gitlab CI?
  
  (Asked by: username_0 on 2019-01-17)
  
  How to deploy from Gitlab CI to AppEngine Standard environment?
  
  **Tags:** cicd, gitlab-ci-runner
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-01-17. Score: 1 | Accepted answer
  
  AFAIK there are only 2 ways of deploying GAE apps:
  
  * using the [`gcloud app deploy`](https://cloud.google.com/sdk/gcloud/reference/app/deploy) command:
  
  > gcloud app deploy - deploy the local code and/or configuration of your
  > app to App Engine
  
  * using the Admin API. From [Deploying Your Apps with the Admin API](https://cloud.google.com/appengine/docs/admin-api/deploying-overview):
  
  > To deploy a version of your app with the Admin API:
  >
  > 1. [Upload your app's resources to Cloud Storage](https://cloud.google.com/appengine/docs/admin-api/uploading-resources).
  > 2. [Create a configuration file that defines your deployment](https://cloud.google.com/appengine/docs/admin-api/creating-config-files).
  > 3. [Create and send the HTTP request for deploying your app](https://cloud.google.com/appengine/docs/admin-api/deploying-apps).
  
  Both `gcloud` (used in the 1st method) as well as `gsutil` (used in the 1st step of the 2nd method) are part of the [Google Cloud SDK](https://cloud.google.com/sdk/docs/), so you'll need to have the SDK installed on your runner.
  
  Summarizing the required steps from a GAE deployment example using the 1st approach that I found in [Getting started with Angular 6, GitLab CI/CD and Google App Engine](https://revs.runtime-revolution.com/getting-started-with-angular-6-gitlab-ci-cd-and-google-app-engine-b1118efcdf69) (probably a good read for details):
  
  * in gitlab set env vars with your GAE service account and project ID info
  * in your `.gitlab-ci.yml` file's deployment section add a `before_script` section for installing the SDK (update for current SDK version)
  
  > ```
  >         before_script:
  >           - wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-218.0.0-linux-x86.tar.gz
  >           - tar -xzf  google-cloud-sdk-218.0.0-linux-x86.tar.gz
  >           - ./google-cloud-sdk/install.sh
  >
  > ```
  
  and a `script` section for the actual deployment, referencing those env vars:
  
  > ```
  >         script:
  >           - echo $GAE_KEY_FILE > gae_auth.json
  >           - ./google-cloud-sdk/bin/gcloud auth activate-service-account --key-file gae_auth.json
  >           - ./google-cloud-sdk/bin/gcloud app deploy --project=$GAE_PROJECT_ID
  >
  > ```
  
  
  ---
  
  