0

How to deploy from Gitlab CI to AppEngine Standard environment?

1

AFAIK there are only 2 ways of deploying GAE apps:

gcloud app deploy - deploy the local code and/or configuration of your app to App Engine

To deploy a version of your app with the Admin API:

  1. Upload your app's resources to Cloud Storage.
  2. Create a configuration file that defines your deployment.
  3. Create and send the HTTP request for deploying your app.

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, 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 (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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.