Skip to content

Conversation

@zakisk
Copy link
Contributor

@zakisk zakisk commented Nov 7, 2025

This release contains:

3725c38 chore(goreleaser): use binaries field in homebrew
ac8e45c refactor: Migrate build tags from +build to //go:build directives
5fbebdf fix: prevent nil pointer panic in EventEmitter

Add nil check for Kubernetes client in EmitMessage to prevent panic when
client is uninitialized. This fixes a crash that occurs during error
handling in GitLab provider when 401 errors are encountered.

The EventEmitter now gracefully handles three nil scenarios:
- nil repo: skips event creation, continues logging
- nil logger: skips logging, continues event creation
- nil client: skips event creation, continues logging

Added comprehensive test coverage for nil client scenario to match
existing tests for nil repo and nil logger cases.

Fixes crash: runtime error: invalid memory address or nil pointer
dereference at pkg/events/emit.go:36

Jira: https://issues.redhat.com/browse/SRVKP-8910
Assisted-by: Claude-Sonnet-4.5 (via Claude Code)
Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
@gemini-code-assist
Copy link

Summary of Changes

Hello @zakisk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a critical fix to prevent a nil pointer panic within the EventEmitter component. By adding a safeguard to check for a nil Kubernetes client before attempting to use it, the change significantly improves the stability and resilience of event emission, particularly in scenarios where the client might not be fully initialized.

Highlights

  • Nil Pointer Panic Fix: Implemented a check to prevent a nil pointer panic in the EventEmitter when the Kubernetes client is not initialized.
  • Improved Robustness: Enhanced the EmitMessage function to safely handle cases where the Kubernetes client (e.client) might be nil, ensuring application stability.
  • New Test Case: Added a dedicated test case to EventEmitter to explicitly verify that no panic occurs when the client is nil.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a fix to prevent a nil pointer panic in EventEmitter when its client is not initialized. The change adds a nil check for the client before attempting to emit a Kubernetes event. The accompanying test changes are well-structured, adding a new test case to ensure the fix works as expected and doesn't cause a panic. I've suggested a small improvement to the new test case to also verify the logging behavior, which would make the test more comprehensive. Overall, this is a good fix that improves the robustness of the event emitter.

Comment on lines +87 to +101
{
name: "nil client doesn't cause panic",
repo: &v1alpha1.Repository{
ObjectMeta: metav1.ObjectMeta{
Name: "test-repo",
Namespace: "test-ns",
},
Spec: v1alpha1.RepositorySpec{},
},
message: "info-message",
logLevel: zap.InfoLevel,
expectEvent: false,
expectedType: v1.EventTypeNormal,
useNilClient: true,
},

Choose a reason for hiding this comment

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

medium

This test case correctly verifies that a nil client doesn't cause a panic and that no Kubernetes event is emitted. However, the EmitMessage function is also expected to log the message regardless of whether an event is emitted. To make this test more comprehensive, consider asserting that the message is indeed logged using the zapobserver.

chmouel and others added 2 commits November 7, 2025 17:25
Converted deprecated `// +build` directives to the modern `//go:build` format
across several files. This standardized the build constraint declarations.

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
Replace deprecated binary field with binaries array syntax in
homebrew_casks configuration to resolve GoReleaser deprecation
warning.

Signed-off-by: Akshay Pant <akshay.akshaypant@gmail.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 7, 2025

Deploying pipelines-as-code with  Cloudflare Pages  Cloudflare Pages

Latest commit: 8195b9d
Status: ✅  Deploy successful!
Preview URL: https://b35b7b0b.pipelines-as-code.pages.dev
Branch Preview URL: https://release-v0-37-2.pipelines-as-code.pages.dev

View logs

@zakisk
Copy link
Contributor Author

zakisk commented Nov 7, 2025

/retest linters

Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
@zakisk
Copy link
Contributor Author

zakisk commented Nov 7, 2025

/retest linters

@zakisk zakisk merged commit c6b5791 into release-v0.37.x Nov 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants