Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,24 @@ The goal is to produce a functional, production-ready CI/CD pipeline configurati
The extension exposes the following tools to Gemini CLI, enabling interaction with Google Cloud services:

#### CI/CD Service Tools
* `artifactregistry.setup_repository`: Creates a new Artifact Registry repository. Optionally grants Artifact Registry Writer permissions to a specified service account.
* `cloudbuild.create_trigger`: Creates a new Cloud Build trigger.
* `cloudbuild.list_triggers`: Lists all Cloud Build triggers in a given project and location.
* `cloudbuild.run_trigger`: Manually runs an existing Cloud Build trigger.
* `devconnect.add_git_repo_link`: Creates a Developer Connect Git repository link under an existing connection.
* `devconnect.setup_connection`: Sets up a new Developer Connect connection (e.g., to GitHub).
* `create_artifact_repository`: Creates a new Artifact Registry repository. Optionally grants Artifact Registry Writer permissions to a specified service account.
* `create_build_trigger`: Creates a new Cloud Build trigger.
* `list_build_triggers`: Lists all Cloud Build triggers in a given project and location.
* `run_build_trigger`: Manually runs an existing Cloud Build trigger.
* `create_git_repository_link`: Creates a Developer Connect Git repository link under an existing connection.
* `create_git_connection`: Sets up a new Developer Connect connection (e.g., to GitHub).

#### Deployment Tools
* `cloudrun.deploy_to_cloud_run_from_image`: Deploys a container image to Cloud Run, creating a new service or updating an existing one.
* `cloudrun.deploy_to_cloud_run_from_source`: Deploys to Cloud Run directly from source code, typically using Cloud Build and BuildPacks.
* `cloudrun.list_services`: Lists Cloud Run services in a specified project and location.
* `cloudstorage.list_buckets`: Lists Cloud Storage buckets in a specified project.
* `cloudstorage.upload_source`: Uploads files from the local workspace to a GCS bucket. Can create a new public bucket if specified.
* `osv.scan_secrets`: Scans a specified directory for potential secrets and keys using OSV-Scanner.
* `deploy_cloudrun_service_from_image`: Deploys a container image to Cloud Run, creating a new service or updating an existing one.
* `deploy_cloudrun_service_from_source`: Deploys to Cloud Run directly from source code, typically using Cloud Build and BuildPacks.
* `list_cloudrun_services`: Lists Cloud Run services in a specified project and location.
* `list_storage_buckets`: Lists Cloud Storage buckets in a specified project.
* `upload_storage_object`: Uploads files from the local workspace to a GCS bucket. Can create a new public bucket if specified.
* `scan_code_for_secrets`: Scans a specified directory for potential secrets and keys using OSV-Scanner.

#### Knowledge Retrieval Tools
* `bm25.query_knowledge`: Retrieves relevant snippets from the extension's knowledge base to answer questions.
* `bm25.search_common_cicd_patterns`: Finds common CI/CD pipeline patterns and best practices.
* `search_knowledge_base`: Retrieves relevant snippets from the extension's knowledge base to answer questions.
* `search_cicd_patterns`: Finds common CI/CD pipeline patterns and best practices.

## 📚 Resources

Expand Down
10 changes: 5 additions & 5 deletions commands/devops/deploy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Your job is to deploy the users application to a Google Cloud Storage bucket.

1. **Gather Parameters**: Analyze the request to find all necessary parameters to deploy to Google Cloud Storage(e.g., `project_ID: "my-project"`).
2. **Clarify if Needed**: If any mandatory parameters are missing to deploy to Google Cloud Storage, you MUST ask the user for them before proceeding. Do not guess or make assumptions.
3. **Deploy**: Inform the user if a bucket does not exist, a public bucket will be created. Deploy the users application to Google Cloud Storage using the `cloudstorage.upload_source` tool and return the URL of the deployed application.
3. **Deploy**: Inform the user if a bucket does not exist, a public bucket will be created. Deploy the users application to Google Cloud Storage using the `upload_storage_object` tool and return the URL of the deployed application.


## Workflow B: Google Cloud Run With Buildpacks
Expand All @@ -47,7 +47,7 @@ Your job is to deploy the user's applications to Cloud Run using buildpacks.
2. **Create DockerFile if not supported by buildpacks**: If the users application is not supported by buildpacks, as found in step 1, look up how to build a Dockerfile. Then create a multistage Dockerfile to containerize the application. Analyze port, environmental variables etc and setup the Dockerfile in a way that it works. After that, ensure the Dockerfile can be built locally using the Docker cli.
3. **Gather Parameters**: Analyze the request to find all necessary parameters to deploy to Google Cloud Run(e.g., `repo_name: "my-app-images"`).
4. **Clarify if Needed**: If any mandatory parameters are missing to deploy to Google Cloud Run, you MUST ask the user for them before proceeding. Do not guess or make assumptions. Ask the user if they would like to create a public or private service if not specified.
5. **Deploy**: Deploy the users application to Google Cloud Run using the `cloudrun.deploy_to_cloud_run_from_source` tool and return the URL of the deployed application.
5. **Deploy**: Deploy the users application to Google Cloud Run using the `deploy_cloudrun_service_from_source` tool and return the URL of the deployed application.


## Workflow C: Google Cloud Run From Image
Expand All @@ -57,18 +57,18 @@ Your job is to deploy the user's applications to Cloud Run from an image.

1. **Create Dockerfile**: If a Dockerfile does not already exist, look up how to build a Dockerfile and create a multistage Dockerfile to containerize the application. Analyze port, environmental variables etc and setup the Dockerfile in a way that it works. Ensure the Dockerfile can be built locally using the Docker cli.
2. **Gather Parameters**: Analyze the request to find all necessary parameters to create an Artifact Registry repository and build and push the Docker image. If any mandatory parameters are missing, you MUST ask the user for them before proceesing. Do not guess or make assumptions.
3. **Create Artifact Registry Repository** Create the Artifact Registry repository using the `artifactregistry.setup_repository` tool.
3. **Create Artifact Registry Repository** Create the Artifact Registry repository using the `create_artifact_repository` tool.
4. **Build and Push Image**: Using the Docker cli, build the Docker image locally using the created Dockerfile and push the image to the created Artifact Registry repository.
5. **Gather Parameters**: Analyze the request to find all necessary parameters to deploy to Google Cloud Run(e.g., `repo_name: "my-app-images"`).
6. **Clarify if Needed**: If any mandatory parameters are missing to deploy to Google Cloud Run, you MUST ask the user for them before proceeding. Do not guess or make assumptions. Ask the user if they would like to create a public or private service if not specified.
7. **Deploy**: Deploy the built application to Google Cloud Run using the `cloudrun.deploy_to_cloud_run_from_image` tool and return the URL of the deployed application.
7. **Deploy**: Deploy the built application to Google Cloud Run using the `deploy_cloudrun_service_from_image` tool and return the URL of the deployed application.


## Universal Protocols & Constraints

These rules apply to all workflows.

Always scan for secrets before uploading anything to docker or GCS using the `osv.scan_secrets` tool. Always ignore directories where scanning is not useful e.g. dependencies which the user has no control over e.g. .venv or go_modules etc. Warn the user of any secrets available and ask if the user wants to ignore these files using dockerignore and gitignore. If they would like to ignore the files, create the corresponding dockerignore and gitignore files. Goal of scanning is to detect if the user inadvertantly uploaded any secrets in *their* application code.
Always scan for secrets before uploading anything to docker or GCS using the `scan_code_for_secrets` tool. Always ignore directories where scanning is not useful e.g. dependencies which the user has no control over e.g. .venv or go_modules etc. Warn the user of any secrets available and ask if the user wants to ignore these files using dockerignore and gitignore. If they would like to ignore the files, create the corresponding dockerignore and gitignore files. Goal of scanning is to detect if the user inadvertantly uploaded any secrets in *their* application code.
First, analyze the user's application to determine the type of application. Proceed to the workflow only after analyzing the application.

### **Error Handling Protocol**
Expand Down
28 changes: 14 additions & 14 deletions devops-mcp-server/REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This document provides detailed information about the tools available in the Goo

## Artifact Registry

### `artifactregistry.setup_repository`
### `create_artifact_repository`
Sets up a new Artifact Registry repository. Optionally, it can grant Artifact Registry Writer permissions to a service account.

**Arguments:**
Expand All @@ -16,14 +16,14 @@ Sets up a new Artifact Registry repository. Optionally, it can grant Artifact Re

## Cloud Build

### `cloudbuild.list_triggers`
### `list_build_triggers`
Lists all Cloud Build triggers in a given location.

**Arguments:**
- `project_id` (string, required): The Google Cloud project ID.
- `location` (string, required): The Google Cloud location for the triggers.

### `cloudbuild.create_trigger`
### `create_build_trigger`
Creates a new Cloud Build trigger.

**Arguments:**
Expand All @@ -35,7 +35,7 @@ Creates a new Cloud Build trigger.
- `branch` (string, optional): Create builds on push to branch (regex, e.g., `^main$`).
- `tag` (string, optional): Create builds on new tag push (regex, e.g., `^nightly$`).

### `cloudbuild.run_trigger`
### `run_build_trigger`
Runs a Cloud Build trigger.

**Arguments:**
Expand All @@ -48,14 +48,14 @@ Runs a Cloud Build trigger.

## Cloud Run

### `cloudrun.list_services`
### `list_cloudrun_services`
Lists the Cloud Run services in a specified GCP project and location.

**Arguments:**
- `project_id` (string, required): The Google Cloud project ID.
- `location` (string, required): The Google Cloud location.

### `cloudrun.deploy_to_cloud_run_from_image`
### `deploy_cloudrun_service_from_image`
Creates a new Cloud Run service or updates an existing one from a container image.

**Arguments:**
Expand All @@ -67,7 +67,7 @@ Creates a new Cloud Run service or updates an existing one from a container imag
- `port` (integer, optional): The port the container listens on.
- `allow_public_access` (boolean, optional): If the service should be public. Default is `false`.

### `cloudrun.deploy_to_cloud_run_from_source`
### `deploy_cloudrun_service_from_source`
Creates a new Cloud Run service or updates an existing one from source.

**Arguments:**
Expand All @@ -80,13 +80,13 @@ Creates a new Cloud Run service or updates an existing one from source.

## Cloud Storage

### `cloudstorage.list_buckets`
### `list_storage_buckets`
Lists Cloud Storage buckets in a specified project.

**Arguments:**
- `project_id` (string, required): The Google Cloud project ID.

### `cloudstorage.upload_source`
### `upload_storage_object`
Uploads source to a GCS bucket. If a new bucket is created, it will be public.

**Arguments:**
Expand All @@ -97,15 +97,15 @@ Uploads source to a GCS bucket. If a new bucket is created, it will be public.

## Developer Connect

### `devconnect.setup_connection`
### `create_git_connection`
Sets up a Developer Connect connection.

**Arguments:**
- `project_id` (string, required): The Google Cloud project ID.
- `location` (string, required): The Google Cloud location.
- `git_repo_uri` (string, required): The URI of the git repository to connect to.

### `devconnect.add_git_repo_link`
### `create_git_repository_link`
Creates a Developer Connect git repository link when a connection already exists.

**Arguments:**
Expand All @@ -116,7 +116,7 @@ Creates a Developer Connect git repository link when a connection already exists

## OSV

### `osv.scan_secrets`
### `scan_code_for_secrets`
Scans the specified root directory for secrets using OSV.

**Arguments:**
Expand All @@ -125,13 +125,13 @@ Scans the specified root directory for secrets using OSV.

## BM25 (Search)

### `bm25.search_common_cicd_patterns`
### `search_cicd_patterns`
Finds common CI/CD patterns in the database.

**Arguments:**
- `query` (string, required): The query to search for.

### `bm25.query_knowledge`
### `search_knowledge_base`
Finds knowledge snippets in the knowledge database.

**Arguments:**
Expand Down
2 changes: 1 addition & 1 deletion devops-mcp-server/artifactregistry/artifactregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ func addSetupRepositoryTool(server *mcp.Server, arClient artifactregistryclient.

return &mcp.CallToolResult{}, res, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "artifactregistry.setup_repository", Description: "Sets up a new Artifact Registry repository. Optionally, it can grant Artifact Registry Writer permissions to a service account."}, setupRepositoryToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "create_artifact_repository", Description: "Sets up a new Artifact Registry repository. Optionally, it can grant Artifact Registry Writer permissions to a service account."}, setupRepositoryToolFunc)
}
4 changes: 2 additions & 2 deletions devops-mcp-server/bm25/bm25.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func addQueryPatternTool(server *mcp.Server, bm25Client bm25client.BM25Client) {
}
return &mcp.CallToolResult{}, map[string]any{"cicd-patterns": res}, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "bm25.search_common_cicd_patterns", Description: "Find common CICD patterns in the database."}, queryPatternToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "search_cicd_patterns", Description: "Find common CICD patterns in the database."}, queryPatternToolFunc)
}

func addQueryKnowledgeTool(server *mcp.Server, bm25Client bm25client.BM25Client) {
Expand All @@ -60,5 +60,5 @@ func addQueryKnowledgeTool(server *mcp.Server, bm25Client bm25client.BM25Client)
}
return &mcp.CallToolResult{}, map[string]any{"knowledge": res}, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "bm25.query_knowledge", Description: "Find knowledge snippets in the knowledge database."}, queryKnowledgeToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "search_knowledge_base", Description: "Find knowledge snippets in the knowledge database."}, queryKnowledgeToolFunc)
}
12 changes: 6 additions & 6 deletions devops-mcp-server/cloudbuild/cloudbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func addRunTriggerTool(server *mcp.Server, cbClient cloudbuildclient.CloudBuildC
}
return &mcp.CallToolResult{}, res, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "cloudbuild.run_trigger", Description: "Runs a Cloud Build trigger."}, runTriggerToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "run_build_trigger", Description: "Runs a Cloud Build trigger."}, runTriggerToolFunc)
}

type ListTriggersArgs struct {
Expand All @@ -83,7 +83,7 @@ func addListTriggersTool(server *mcp.Server, cbClient cloudbuildclient.CloudBuil
}
return &mcp.CallToolResult{}, map[string]any{"triggers": res}, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "cloudbuild.list_triggers", Description: "Lists all Cloud Build triggers in a given location."}, listTriggersToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "list_build_triggers", Description: "Lists all Cloud Build triggers in a given location."}, listTriggersToolFunc)
}

type CreateTriggerArgs struct {
Expand Down Expand Up @@ -116,7 +116,7 @@ func addCreateTriggerTool(server *mcp.Server, cbClient cloudbuildclient.CloudBui
}
return &mcp.CallToolResult{}, res, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "cloudbuild.create_trigger", Description: "Creates a new Cloud Build trigger."}, createTriggerToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "create_build_trigger", Description: "Creates a new Cloud Build trigger."}, createTriggerToolFunc)
}

// setPermissionsForSA resolves the SA (if default) and grants it a role.
Expand Down Expand Up @@ -178,7 +178,7 @@ func addListBuildsTool(server *mcp.Server, cbClient cloudbuildclient.CloudBuildC
}
return &mcp.CallToolResult{}, map[string]any{"builds": res}, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "cloudbuild.list_builds", Description: "Lists all Cloud Builds in a given location and project."}, listBuildsToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "list_builds", Description: "Lists all Cloud Builds in a given location and project."}, listBuildsToolFunc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with other renamed tools like list_build_triggers and list_cloudrun_services, consider renaming this tool to list_cloud_builds. The current name list_builds is a bit generic and could lead to naming conflicts in the future. A more specific name improves clarity and maintainability.

Suggested change
mcp.AddTool(server, &mcp.Tool{Name: "list_builds", Description: "Lists all Cloud Builds in a given location and project."}, listBuildsToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "list_cloud_builds", Description: "Lists all Cloud Builds in a given location and project."}, listBuildsToolFunc)

}

func addGetBuildInfoTool(server *mcp.Server, cbClient cloudbuildclient.CloudBuildClient) {
Expand All @@ -189,7 +189,7 @@ func addGetBuildInfoTool(server *mcp.Server, cbClient cloudbuildclient.CloudBuil
}
return &mcp.CallToolResult{}, res, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "cloudbuild.get_build_info", Description: "Gets information about a specific Cloud Build."}, getBuildInfoToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "get_build_details", Description: "Gets information about a specific Cloud Build."}, getBuildInfoToolFunc)
}

func addStartBuildTool(server *mcp.Server, cbClient cloudbuildclient.CloudBuildClient) {
Expand All @@ -208,5 +208,5 @@ func addStartBuildTool(server *mcp.Server, cbClient cloudbuildclient.CloudBuildC
}
return &mcp.CallToolResult{}, res, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "cloudbuild.start_build", Description: "Starts a new Cloud Build from a source in Google Cloud Storage."}, startBuildToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "start_build", Description: "Starts a new Cloud Build from a source in Google Cloud Storage."}, startBuildToolFunc)
}
6 changes: 3 additions & 3 deletions devops-mcp-server/cloudrun/cloudrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func addListServicesTool(server *mcp.Server, crClient cloudrunclient.CloudRunCli
}
return &mcp.CallToolResult{}, map[string]any{"services": services}, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "cloudrun.list_services", Description: "Lists the Cloud Run service in a specified GCP project and location."}, listServicesToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "list_cloudrun_services", Description: "Lists the Cloud Run service in a specified GCP project and location."}, listServicesToolFunc)

}

Expand Down Expand Up @@ -106,7 +106,7 @@ func addDeployToCloudRunFromImageTool(server *mcp.Server, crClient cloudrunclien
}
return &mcp.CallToolResult{}, revision, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "cloudrun.deploy_to_cloud_run_from_image", Description: "Creates a new Cloud Run service or updates an existing one from a container image. This tool may take a couple minutes to finish running."}, deployToCloudRunFromImageToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "deploy_cloudrun_service_from_image", Description: "Creates a new Cloud Run service or updates an existing one from a container image. This tool may take a couple minutes to finish running."}, deployToCloudRunFromImageToolFunc)
}

type DeployToCloudRunFromSourceArgs struct {
Expand All @@ -132,5 +132,5 @@ func addDeployToCloudRunFromSourceTool(server *mcp.Server, crClient cloudrunclie
}
return &mcp.CallToolResult{}, service, nil
}
mcp.AddTool(server, &mcp.Tool{Name: "cloudrun.deploy_to_cloud_run_from_source", Description: "Creates a new Cloud Run service or updates an existing one from source. This tool may take a couple minutes to finish running."}, deployToCloudRunFromSourceToolFunc)
mcp.AddTool(server, &mcp.Tool{Name: "deploy_cloudrun_service_from_source", Description: "Creates a new Cloud Run service or updates an existing one from source. This tool may take a couple minutes to finish running."}, deployToCloudRunFromSourceToolFunc)
}
Loading
Loading