Skip to content

feat: optimize ci cd workflow #6744

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

Merged
merged 36 commits into from
Jul 30, 2025
Merged

feat: optimize ci cd workflow #6744

merged 36 commits into from
Jul 30, 2025

Conversation

prkhrkat
Copy link
Contributor

@prkhrkat prkhrkat commented Jul 21, 2025

Description

Fixes https://github.com/devtron-labs/sprint-tasks/issues/2435

Checklist:

  • The title of the PR states what changed and the related issues number (used for the release note).
  • Does this PR requires documentation updates?
  • I've updated documentation as required by this PR.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have tested it for all user roles.
  • I have added all the required unit/api test cases.

Does this PR introduce a user-facing change?


Summary by Bito

This PR optimizes the CI/CD workflow by improving workflow status management, enhancing cluster management, and refining error handling. It standardizes unique constraints in SQL tables, refactors repository interfaces and service layers, and introduces new methods for retrieving clusters. The changes ensure consistent use of 'pipeline_id', enhance transaction support and error logging, and improve overall performance and maintainability.

…ow runner tables and remove redundant `status` parameters. Integrate CI status optimization fallback in `CiHandlerImpl`.
…iHandlerImpl`. Streamline CI status fetching through existing repository methods.
…e` package, integrate optimized CI status fetching and fallback logic in `CiHandlerImpl`.
…ndLastTriggeredWorkflowByCiIdsOptimized`. Add fallback to legacy method for error handling. Update repository with the optimized query method.
Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

Copy link

bito-code-review bot commented Jul 21, 2025

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Other Improvements - Dependency & Config Update

go.sum - Added new dependency for github.com/google/subcommands to support feature enhancements.

Feature Improvement - Service and Transaction Enhancements

CiWorkflowRepository.go - Added new methods for CI workflows and pipeline ID querying.

HandlerService.go - Integrated workflowStatusLatest service for improved audit logging.

deployStageHandlerCode.go - Enhanced deployment stage transaction handling and workflow status update.

preStageHandlerCode.go - Corrected service call parameters for pre-stage workflow runner.

CdHandler.go - Refactored CD Handler to support workflowStatusLatest and better stage status fetching.

CiHandler.go - Refactored to incorporate new CI workflow fetching with fallback and workflowStatusLatest integration.

CiService.go - Integrated workflowStatusLatest in CI service and updated transaction handling.

New Feature - Workflow Status Latest Feature

WorkflowStatusLatestRepository.go - Implemented new repository for managing the latest CI/CD workflow status.

WorkflowStatusLatestService.go - Introduced service interface and implementation for handling the latest workflow statuses.

34203900_workflow_status_latest_tables.down.sql - SQL script to drop workflow status latest tables and sequences if they exist.

34203900_workflow_status_latest_tables.up.sql - SQL script to create workflow status latest tables and sequences for CI/CD.

New Feature - Adapter Method Addition

adapter.go - Added helper function GetCiWorkflowStatusFromCiWorkflow to convert CI workflow to status.

Feature Improvement - CD Workflow Service Enhancements

CdWorkflowRunnerService.go - Updated CD workflow runner service with enhanced transaction and workflowStatusLatest support.

CdWorkflowRunnerReadService.go - Introduced GetWfrStatusForLatestRunners for improved CD workflow status retrieval.

Other Improvements - Workflow Executor and Wire Updates

WorkflowDagExecutor.go - Refined workflow executor by removing redundant imports and improving logging.

wire_workflow.go - Updated workflow wiring to include workflowStatusLatest integration.

wire_workflow_status_latest.go - Integrated workflowStatusLatest service wiring for dependency injection.

wire_gen.go - Multiple updates in dependency injection wiring for workflowStatusLatest integration and import refinements.

Copy link

@bito-code-review bito-code-review 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 Agent Run #9e94a6

Actionable Suggestions - 1
  • internal/sql/repository/pipelineConfig/CiWorkflowRepository.go - 1
    • Incorrect error handling in fallback logic · Line 305-305
Review Details
  • Files reviewed - 10 · Commit Range: 87521d5..cb6ce49
    • internal/sql/repository/pipelineConfig/CiWorkflowRepository.go
    • internal/sql/repository/pipelineConfig/WorkflowStatusLatestRepository.go
    • pkg/pipeline/CiHandler.go
    • pkg/workflow/status/workflowStatusLatest/WorkflowStatusLatestService.go
    • pkg/workflow/status/workflowStatusLatest/WorkflowStatusUpdateService.go
    • pkg/workflow/status/workflowStatusLatest/wire_workflow_status_latest.go
    • pkg/workflow/wire_workflow.go
    • scripts/sql/34203900_workflow_status_latest_tables.down.sql
    • scripts/sql/34203900_workflow_status_latest_tables.up.sql
    • wire_gen.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at shivam@devtron.ai.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

…services to handle it.

Integrate `BlobStorageEnabled` from the data model and replace default hardcoded value in `WorkflowStatusUpdateServiceImpl`.
Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

Copy link

bito-code-review bot commented Jul 22, 2025

Code Review Agent Run #bf339d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: cb6ce49..96815d3
    • pkg/workflow/status/workflowStatusLatest/WorkflowStatusLatestService.go
    • pkg/workflow/status/workflowStatusLatest/WorkflowStatusUpdateService.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at shivam@devtron.ai.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

iamayushm and others added 2 commits July 22, 2025 18:03
… `ci_workflow_status_latest` table with fallback to legacy query methods. Update repositories with new helper methods to support this approach.
Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

Copy link

bito-code-review bot commented Jul 22, 2025

Code Review Agent Run #291051

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: 96815d3..fc4c6aa
    • internal/sql/repository/pipelineConfig/CiWorkflowRepository.go
    • internal/sql/repository/pipelineConfig/WorkflowStatusLatestRepository.go
    • pkg/pipeline/CiHandler.go
    • wire_gen.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at shivam@devtron.ai.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

iamayushm and others added 2 commits July 23, 2025 11:16
…sLatestRepository` and update references in `CiHandlerImpl` for clarity.
Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

…r clarity, introducing `GetCiWorkflowStatusFromCiWorkflow` in `adapter`, and improving log consistency.
Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

…improved clarity and consistency. Update logging and fallback logic in CI status and workflow fetching.
Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

…ntegration with `WorkflowStatusLatestService`. Update `CiHandlerImpl` references and clean up unused code.
Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

Copy link

bito-code-review bot commented Jul 24, 2025

Code Review Agent Run #d1fe17

Actionable Suggestions - 0
Review Details
  • Files reviewed - 12 · Commit Range: 4443e57..aae32f6
    • pkg/pipeline/CiHandler.go
    • pkg/pipeline/CiService.go
    • pkg/workflow/cd/CdWorkflowRunnerService.go
    • pkg/workflow/workflowStatusLatest/WorkflowStatusLatestService.go
    • pkg/workflow/workflowStatusLatest/WorkflowStatusUpdateService.go
    • wire_gen.go
    • internal/sql/repository/pipelineConfig/CdWorfkflowRepository.go
    • pkg/workflow/cd/read/CdWorkflowRunnerReadService.go
    • pkg/deployment/trigger/devtronApps/HandlerService.go
    • pkg/deployment/trigger/devtronApps/deployStageHandlerCode.go
    • pkg/workflow/workflowStatusLatest/wire_workflow_status_latest.go
    • internal/sql/repository/pipelineConfig/WorkflowStatusLatestRepository.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at shivam@devtron.ai.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

… for CI/CD workflow statuses, refactor repository methods, and modify unique constraints in workflow status tables.
Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

Copy link

bito-code-review bot commented Jul 24, 2025

Code Review Agent Run #8f078a

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: aae32f6..b86f98f
    • scripts/sql/34203900_workflow_status_latest_tables.up.sql
    • internal/sql/repository/pipelineConfig/WorkflowStatusLatestRepository.go
    • pkg/workflow/workflowStatusLatest/WorkflowStatusLatestService.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at shivam@devtron.ai.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link

Some linked issues are invalid. Please update the issue links:\nIssue # in is not found or invalid (HTTP 404).\n

vikramdevtron
vikramdevtron previously approved these changes Jul 29, 2025
vikramdevtron
vikramdevtron previously approved these changes Jul 29, 2025
Copy link

@iamayushm iamayushm changed the title Optimize ci cd workflow enhancement: optimize ci cd workflow Jul 30, 2025
@iamayushm iamayushm changed the title enhancement: optimize ci cd workflow feat: optimize ci cd workflow Jul 30, 2025
@iamayushm
Copy link
Contributor

/resolve

@iamayushm iamayushm merged commit 716b841 into develop Jul 30, 2025
14 checks passed
@iamayushm iamayushm deleted the optimize-ci-cd-workflow branch July 30, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants