0
0
GCPcloud~30 mins

Workflows for orchestration in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Workflows for orchestration
📖 Scenario: You are building a simple workflow in Google Cloud Workflows to automate a daily task. This workflow will call two services in sequence: first, it will call a mock API to fetch data, then it will call another mock API to process that data.This project will guide you step-by-step to create the workflow definition in YAML format.
🎯 Goal: Create a Google Cloud Workflow YAML file that defines a sequence of two steps: fetchData and processData. Each step calls a mock HTTP endpoint. The workflow should be valid and deployable.
📋 What You'll Learn
Create a workflow named dailyTaskWorkflow with an initial step
Add a configuration variable for the base API URL
Define the fetchData step to call the /fetch endpoint
Define the processData step to call the /process endpoint using data from fetchData
💡 Why This Matters
🌍 Real World
Automating sequences of API calls is common in cloud environments to integrate services without manual intervention.
💼 Career
Understanding how to define and deploy workflows helps in roles like cloud engineer, DevOps, and site reliability engineering.
Progress0 / 4 steps
1
Create the initial workflow structure
Create a workflow YAML named dailyTaskWorkflow with a main sequence that starts with a step called fetchData. The fetchData step should be empty for now.
GCP
Need a hint?

Start by defining main with steps. Add a step named fetchData that calls http.get with empty arguments and stores the result in fetchResponse.

2
Add a configuration variable for the base API URL
Add a variable named baseUrl at the top level of the workflow and set it to "https://mockapi.example.com".
GCP
Need a hint?

Define baseUrl as a top-level variable with the exact URL string.

3
Configure the fetchData step to call the fetch endpoint
Modify the fetchData step to call the URL ${baseUrl}/fetch using http.get. Pass the URL in args.url and store the result in fetchResponse.
GCP
Need a hint?

Use args.url to specify the full URL using the baseUrl variable and the /fetch path.

4
Add the processData step to call the process endpoint with fetched data
Add a new step named processData after fetchData in main.steps. It should call http.post with args.url set to ${baseUrl}/process and args.body set to fetchResponse.body. Store the result in processResponse.
GCP
Need a hint?

Define processData step with call: http.post. Use args.url for the process endpoint and args.body to send the fetched data.