Continuous deployment of Endpoints

42 views
Skip to first unread message

Daniel Johns

unread,
Mar 16, 2021, 8:09:41 AM3/16/21
to Google Cloud Endpoints
Is anyone able to point me in the direction of automated deployments for Endpoints and Appengine?

Appengine seems quite feasible but deploying the OpenAPI docs I can't see any examples of in my searches.

For reference I'm using Cloud endpoints Java Framework with Maven.

Josh Einhorn

unread,
Mar 16, 2021, 10:24:48 AM3/16/21
to Daniel Johns, Google Cloud Endpoints
Assuming by "automated deployments" you're referring to a Continuous Integration and Delivery pipeline (CI/CD), I'd take a look at automating builds combining Terraform with your code version control system (e.g. git) containing both your application code and OpenAPI docs. Basically each release in your code repository should trigger a build that results in a set of deployment artifacts (Appengine bundle, OpenAPI doc, Terraform configuration, etc.) that are passed to terraform, which then actuates your infrastructure to match the state described by those artifacts.

I'd imagine there are plenty of examples floating around the internet doing this with Appengine alone; I'm not sure about examples with the Endpoints framework, but it's definitely possible (apologies if you were looking for actual real-life examples). Perhaps someone else in this group might have something like this. Good luck!

--
You received this message because you are subscribed to the Google Groups "Google Cloud Endpoints" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-endp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-endpoints/780bd447-1baa-416b-b7e8-34d25fe751f2n%40googlegroups.com.


--
Josh Einhorn | Software Engineer | joshe...@google.com | 1-215-837-1102

Daniel Johns

unread,
Mar 17, 2021, 8:59:54 AM3/17/21
to Google Cloud Endpoints
Thanks Josh.

I got it working with Bitbucket Pipelines using a custom docker image with cloudsdk and mvn installed. 

For others, this is the script which worked for me.

image: danieljohns/cloudsdk-java-mvn

pipelines:
  default:
      - parallel:
        - step:
            name: Build & Deploy API Docs
            caches:
              - maven
            script:
              - echo $KEY_FILE | base64 -d >> /tmp/key-file.json
              - gcloud auth activate-service-account --key-file /tmp/key-file.json
              - gcloud config set project $GCLOUD_PROJECT
              - mvn endpoints-framework:openApiDocs -DskipTests=true --batch-mode 
              - gcloud endpoints services deploy target/openapi-docs/openapi.json
        - step:
            name: Deploy to Appengine
            caches:
              - maven
            script:
              - echo $KEY_FILE | base64 -d >> /tmp/key-file.json
              - gcloud auth activate-service-account --key-file /tmp/key-file.json
              - gcloud config set project $GCLOUD_PROJECT
              - mvn appengine:deploy -Dapp.deploy.version=$BITBUCKET_BUILD_NUMBER -DskipTests=true --batch-mode   
Reply all
Reply to author
Forward
0 new messages