diff --git a/docs/blog/.authors.yml b/docs/blog/.authors.yml index 2d016a44..5c4f70ba 100644 --- a/docs/blog/.authors.yml +++ b/docs/blog/.authors.yml @@ -11,6 +11,10 @@ authors: name: Adewale Abati description: Staff Developer Advocate avatar: https://avatars.githubusercontent.com/u/4003538?v=4 + dalton: + name: Dalton Turner + description: Software Engineer + avatar: https://avatars.githubusercontent.com/u/78099245?v=4 tania: name: Tania Chakraborty description: Senior Technical Community Manager @@ -18,4 +22,4 @@ authors: angie: name: Angie Jones description: Head of Developer Relations - avatar: https://avatars.githubusercontent.com/u/15972783?v=4 \ No newline at end of file + avatar: https://avatars.githubusercontent.com/u/15972783?v=4 diff --git a/docs/blog/images/resolving-ci-issues/goose-github-ci.png b/docs/blog/images/resolving-ci-issues/goose-github-ci.png new file mode 100644 index 00000000..176e8b01 Binary files /dev/null and b/docs/blog/images/resolving-ci-issues/goose-github-ci.png differ diff --git a/docs/blog/posts/2024-12-10-resolving-ci-issues.md b/docs/blog/posts/2024-12-10-resolving-ci-issues.md new file mode 100644 index 00000000..2c7f3c7a --- /dev/null +++ b/docs/blog/posts/2024-12-10-resolving-ci-issues.md @@ -0,0 +1,169 @@ +--- +draft: false +title: "Resolving CI Issues with Goose: A Practical Walkthrough" +description: "Leverage Goose to simplify your CI debugging process, fetch detailed information about failed CI runs & annotations directly from GitHub, and even apply fixes directly." +date: 2024-12-11 +authors: + - dalton +--- + +![CI](../images/resolving-ci-issues/goose-github-ci.png) + +Running into Continuous Integration (CI) failures in pull requests can be quite frustrating but they happen very often. In this post, we leverage the GitHub CLI (`gh`) using Goose to simplify your CI debugging process, fetch detailed information about failed CI runs & annotations directly from GitHub, and even apply fixes directly. + + + + +## Getting Started + +Before diving in, ensure you have the necessary tools set up. + +### 1. Install and Authenticate GitHub CLI (`gh`) + +You'll need the [GitHub CLI](https://cli.github.com/) `gh` to enable Goose's access to CI check run details. + +```bash +brew install gh +gh auth login +``` + +Follow the prompts to authenticate your account. + + +### 2. Configure Goose +Ensure Goose is configured and ready to interact with your repository and local tools. Specifically, you will need to configure a goose profile with the GitHub toolkit. + +Update your `profiles.yaml` file in `~/.config/goose` with the necessary toolkits: + +```yaml +my-profile: + provider: anthropic + processor: claude-3-5-sonnet + accelerator: claude-3-5-sonnet + moderator: truncate + toolkits: + - name: developer + requires: {} + - name: github + requires: {} +``` +Start a session with the profile: + +```bash +goose session start --profile my-profile +``` +If the profile’s toolkits are not correctly configured, Goose might fail to access `gh` commands. + +## Resolving CI Failures with Goose +Once everything is set up, we can now use Goose to tackle CI issues with the following steps: + +### Step 1: Fetch CI Failure Details +Ask Goose to retrieve information about the CI failures for a specific PR. + +**Example Request:** + +``` + +Can you tell me about the CI failures on PR #11111 in the organization/repo repository? The check run ID is 123456. +``` + +You can access a check run ID by clicking on a PR’s checks tab and selecting a failure. The ID will be available in the URL. + +**Goose's Workflow:** + +Goose will use the `gh` CLI to check run information and provide a detailed summary of the issues. Goose uses the GitHub CLI to: + +- Fetch details about failed CI runs, including logs and annotations. +- Provide a clear and actionable summary of issues. + +**Example Command Goose Runs:** + +```curl +gh api -H "Accept: application/vnd.github+json" /repos///check-runs//annotations +``` + +**Example Goose Output:** +```mathematica +Here are the details for Check Run ID 123456: + +**Name**: CI-Build-All +**Status**: completed +**Conclusion**: failure + +**Annotations Summary:** +1. **ModuleA Test Failure** + File: `ModuleATests` + Line: 35 + Error: Mismatched parameter order in function call. + +2. **ModuleB Test Failure** + File: `ModuleBTests` + Line: 64 + Error: Unexpected nil value encountered during initialization. + +3. **ModuleC Test Failure** + File: `ModuleCTests` + Line: 98 + Error: Type mismatch in returned value. Expected 'String', found 'Int'. +``` +### Step 2: Request Fixes from Goose +Once Goose provides the failure details, ask it to resolve the issues directly. + +Example Request: + +``` +Can you fix these issues and stage the changes so I can review them? Do not add unnecessary code comments. +``` + +**What Goose Does:** + +- Applies fixes based on error messages. +- Stages changes for review. + + +**Example Goose Response:** +```markdown +I have fixed the following files and staged them: + +- `ModuleATests`: Corrected the order of parameters in the function call. +- `ModuleBTests`: Resolved the unexpected nil value encountered during initialization. +- `ModuleCTests`: Adjusted the type mismatch in the returned value. + +You can now review the staged changes. +``` + + +### Step 3: Review the Changes +Carefully review the staged changes to ensure they address the issues correctly and avoid unintended modifications. + +**Things to Check:** + +- No unnecessary comments (e.g., // Fix xyz). +- No alterations to unrelated parts of the code. + + +If needed, clean up or re-stage the changes before committing. + +## Benefits of Using Goose +Using Goose to resolve CI issues streamlines your workflow by: + +- identifying issues and applying fixes with minimal manual effort. +- integrating with tools like the GitHub CLI to validate changes. +- handling repetitive CI debugging tasks while you focus on code quality. + +Goose allows you to resolve CI failures efficiently, ensuring confidence in your workflow while reducing the effort required for debugging and testing. + +Try it out, and let Goose handle the heavy lifting of CI debugging for you! + + + + + + + + + + + + + diff --git a/mkdocs.yml b/mkdocs.yml index 48da530f..45fd26e0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -140,3 +140,4 @@ nav: - "API Docs": reference/index.md - Blog: - "Blog Home": blog/index.md +