How Postman and Google Cloud Build helps you ship Cloud Functions faster!

Google Cloud Platform

Postman

Google Cloud Build

Create your first project in GCP

Let's define our API

# install dependencies
> npm i
# run the local server to host the backend
> npm start

Create unit tests

npm run test:unit

Create a collection using Postman

  • First of all, I created an Environment and store the localhost asurl
  • I created a Collection
  • Added a Get request in the Collection and used the url param defined in the Environment
  • Defined a few tests using intuitive pm helper provide by Postman Runtime
  • Finally, hit the request and verify the run results

Deploy the Cloud Function from the local machine

gcloud functions deploy myWebsiteBackend --trigger-http --runtime nodejs10

Create the Cloud Build configuration

Setup the Trigger for Cloud Build

  • Go to your GCP console and select the Cloud Build Trigger from the side menu.
  • Create a New Trigger
  • Select the Github Repository and explicitly select the Cloud Build configuration
  • Now, provide the user substitution variable value. Provide the hosted URL as :
https://YOUR_GCF_REGION-YOUR_GCP_PROJECT_ID.cloudfunctions.net/FUNCTION-NAME
  • Save the trigger

You are all set now

Send the Build notification to Slack

Last-minute talk

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store