1. Introduction
In this codelab, you will experience the "zero-to-hero" workflow for platform engineering using the Gemini CLI and the CI/CD extension. You will take on the role of an enterprise developer who has built an application (like the Spring Petclinic demo or a Python Flask app) and now wants to deploy it to Google Cloud to share it.
Instead of manually configuring complex pipelines, you will use natural language to guide Gemini. The agent will analyze your project, suggest small-scale target runtimes like Google Cloud Run, perform security scans for leaked secrets, and handle the deployment, providing you with a working URL.
What you'll do
- Clone a repository (you can use your own or a demo app like Spring Petclinic).
- Install and configure the Gemini CLI and the CI/CD extension.
- Use a prompt like
deploy my applicationto trigger the deployment skill. - Witness Gemini analyze the project, suggest Cloud Run, run security checks, and deploy the application.
- Verify the running application.
What you'll need
- A web browser such as Chrome.
- A Google Cloud project with billing enabled.
This codelab is for developers of all levels, including beginners.
2. Before you begin
Billing Setup
Create or select a Google Cloud project
Create a Google Cloud Project
- In the Google Cloud Console, on the project selector page, select or create a Google Cloud project.
- Make sure that billing is enabled for your Cloud project. Learn how to check if billing is enabled on a project.
Start Cloud Shell
Cloud Shell is a command-line environment running in Google Cloud that comes preloaded with necessary tools.
- Click Activate Cloud Shell at the top of the Google Cloud console.
- Once connected to Cloud Shell, verify your authentication:
gcloud auth list - Confirm your project is configured:
gcloud config get project - If your project is not set as expected, set it:
export PROJECT_ID=<YOUR_PROJECT_ID> gcloud config set project $PROJECT_ID
Enable APIs
Run this command in Cloud Shell to enable all the required APIs for this lab:
gcloud services enable \ cloudbuild.googleapis.com \ run.googleapis.com \ artifactregistry.googleapis.com
3. Setup Gemini CLI
In this step, you will install and configure the Gemini CLI and the CI/CD extension.
- Ensure Gemini CLI is installed. If you haven't installed it yet, follow the instructions in the Gemini CLI Getting Started Guide.
- Sign in: We recommend signing in with your Google account. See the Authentication Guide for details.
- Install the CI/CD extension: Run the following command to install the extension from GitHub:
You can validate extension installation by listing installed extensions:gemini extensions install https://github.com/gemini-cli-extensions/cicd
gemini extensions list
- Configure Application Default Credentials (ADC): The CI/CD extension requires ADC to be configured. Run:
gcloud auth login gcloud auth application-default login
- Set default project and region: It helps to have configured
gcloudwith a default project and quota project for ADC. Replacewith your actual values (e.g.,my-project):gcloud config set project <PROJECT_ID> gcloud auth application-default set-quota-project <PROJECT_ID>
4. Deploy the Application
Now you are ready to use the Gemini CLI and CI/CD extension to deploy the application.
Clone the repository
In this lab, we will use the popular Spring Petclinic sample application. You can also use your own application if you have one ready that uses a supported runtime (like Python/Flask, Java/Spring Boot, etc.).
- Clone the repository and navigate into the directory:
git clone https://github.com/spring-projects/spring-petclinic.git cd spring-petclinic
Prompt Gemini to deploy
- Launch the Gemini CLI from the project directory:
gemini
- Once inside the Gemini CLI shell, use the CI/CD extension to deploy your application. You can use a simple natural language prompt:
deploy my application
What happens next
Gemini will activate the google-cicd-deploy skill and perform several actions:
- Analyze the project: It will identify the application type (e.g., Spring Boot).
- Suggest runtime: It will suggest a suitable runtime, such as Google Cloud Run.
- Security Scan: It will scan for leaked secrets using the MCP tools. You should allow the tools to run if prompted.
- Extract configuration: It will use
gcloudto read your current project environment. - Propose parameters: It will present sane defaults for deployment parameters and ask for your confirmation.
Review the proposed configuration and confirm the deployment.
Once completed, Gemini will provide you with the URL of your running application.
5. Clean up
To avoid ongoing charges to your Google Cloud account, delete the resources created during this codelab.
If you deployed to Cloud Run, you can delete the service using the following command (replace with your compute region e.g., us-central1):
gcloud run services delete spring-petclinic --region <REGION>
Alternatively, if you created a dedicated project for this codelab, you can delete the entire project:
gcloud projects delete <YOUR_PROJECT_ID>
6. Congratulations
Congratulations! You have successfully used the Gemini CLI and CI/CD extension to deploy an application to Google Cloud Run using natural language prompts.
What you've learned
- How to install and configure the Gemini CLI and the CI/CD extension.
- How to use natural language to trigger a deployment flow.
- How Gemini analyzes your project, handles security scans, and suggests runtimes.
Next steps
- Explore more advanced prompts with the CI/CD extension, such as designing full pipelines or generating Terraform.
- Check out the CI/CD extension.
- Learn more about Developer Connect.