-
Notifications
You must be signed in to change notification settings - Fork 549
feat: Add pipeline-level build infrastructure profile support #6838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Bito Automatic Review Skipped - Draft PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot wasn't able to review any files in this pull request.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: abhibhaw <39991296+abhibhaw@users.noreply.github.com>
Co-authored-by: abhibhaw <39991296+abhibhaw@users.noreply.github.com>
Co-authored-by: abhibhaw <39991296+abhibhaw@users.noreply.github.com>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
// Query the ci_pipeline table directly for the infra_profile_id | ||
var infraProfileId *int | ||
query := `SELECT infra_profile_id FROM ci_pipeline WHERE id = ? AND deleted = false` | ||
_, err := impl.infraProfileRepo.GetDbConnection().Query(&infraProfileId, query, pipelineId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using raw SQL query instead of the repository pattern breaks the established abstraction. Consider using the CiPipelineRepository.GetInfraProfileIdByPipelineId method that's already implemented in the same PR.
// Query the ci_pipeline table directly for the infra_profile_id | |
var infraProfileId *int | |
query := `SELECT infra_profile_id FROM ci_pipeline WHERE id = ? AND deleted = false` | |
_, err := impl.infraProfileRepo.GetDbConnection().Query(&infraProfileId, query, pipelineId) | |
// Use the repository method to fetch infra_profile_id for the pipeline | |
infraProfileId, err := impl.ciPipelineRepository.GetInfraProfileIdByPipelineId(pipelineId) |
Copilot uses AI. Check for mistakes.
_, err := impl.infraProfileRepo.GetDbConnection().Query(&infraProfileId, query, pipelineId) | ||
if err != nil { | ||
if errors.Is(err, pg.ErrNoRows) { | ||
return nil, nil // Pipeline not found, fall back to app-level profile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment suggests fallback to app-level profile, but returning nil here doesn't trigger the fallback - it just returns nil. The actual fallback logic happens in the calling function when pipelineInfraProfileId is nil.
return nil, nil // Pipeline not found, fall back to app-level profile | |
return nil, nil // Pipeline not found; returning nil signals caller to handle fallback to app-level profile |
Copilot uses AI. Check for mistakes.
Bito Automatic Review Skipped - Draft PR |
This PR implements support for selecting build infrastructure profiles at the individual CI pipeline level, addressing the feature request for more granular control over build resources.
Problem
Previously, build infrastructure profiles could only be assigned at the application level, meaning all CI pipelines within an application shared the same build resources. This limited flexibility for scenarios where:
Solution
Added pipeline-level build infrastructure profile selection with the following priority hierarchy:
Key Changes
Database Schema
infra_profile_id
column toci_pipeline
table with foreign key constraintAPI Extensions
infraProfileId
fieldResolution Logic
PipelineId
Repository Layer
GetInfraProfileIdByPipelineId()
method for pipeline-specific lookupsUsage Examples
Creating a pipeline with specific infra profile:
Updating a pipeline's infra profile:
Benefits
Testing
The implementation maintains full backward compatibility and includes:
Closes #[issue_number]
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.