Skip to content

Conversation

@iamayushm
Copy link
Contributor

@iamayushm iamayushm commented Jun 3, 2025

Description

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

Adding tx in chart service and propertiesService

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 pull request refactors multiple components to improve transaction management by adding tx parameters to method signatures. The changes enhance database operation consistency across deployment configurations, chart services, and pipeline operations while implementing conditional connection assignment based on transaction availability, refining rollback logic, and fixing transaction passing in the pipeline orchestrator to resolve configuration migration issues.

@gitguardian
Copy link

gitguardian bot commented Jun 19, 2025

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
2763127 Triggered Generic High Entropy Secret 3c0f6c8 scripts/devtron-reference-helm-charts/cronjob-chart_1-6-0/secrets-test-values.yaml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@bito-code-review
Copy link

bito-code-review bot commented Jul 16, 2025

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted
Feature Improvement - Transaction Management Refactor

ChartService.go - Refactored chart service methods to integrate explicit transaction handling and enhance error logging.

ChartsRepository.go - Updated repository methods to accept transaction parameters, ensuring consistent database operations.

DevtronAppGitOpsConfigService.go - Modified configuration retrieval to use nil transaction where applicable for improved flexibility.

ChartReadService.go - Revised deployment config retrieval to optionally pass a transaction, aligning with overall refactoring.

deploymentConfigService.go - Enhanced deployment configuration services by adding tx parameters for better transaction management.

AppListingRestHandler.go - Updated deployment config function calls to pass nil transaction for improved flexibility.

EnvConfigOverrideRepository.go - Refactored method signatures to include tx parameters and use ORM connections for consistent database operations.

repository.go - Modified query logic to adopt transaction-based connection handling in deployment configuration retrieval.

AppListingService.go - Altered service calls to obtain the latest chart by passing nil for the transaction, ensuring uniform behavior.

AppService.go - Revised deployment config calls to include nil in place of direct transaction parameters for standardized handling.

PipelineStatusTimelineService.go - Updated function calls to use a nil tx parameter, aligning error handling across deployment config retrieval.

AppWorkflowService.go - Changed environment override service calls to pass nil transaction for consistent transaction management.

deploymentConfigReadService.go - Updated various deployment config methods to include a tx parameter for more robust and consistent database operations.

ManifestCreationService.go - Added transaction parameter to chart repository calls to facilitate robust chart retrieval and error handling.

DeploymentTemplateService.go - Modified chart update operations to utilize transaction parameters for reliable database updates.

chartEnvConfigOverride.go - Enhanced chart environment override methods to accept tx parameters, ensuring proper transaction propagation.

deployStageHandlerCode.go - Standardized deployment config retrieval by incorporating nil or explicit tx parameters for consistency.

postStageHandlerCode.go - Injected tx parameter in deployment config retrieval functions to improve consistency in error handling.

preStageHandlerCode.go - Refactored methods to pass transaction parameters when fetching deployment config data.

WorkflowEventProcessorService.go - Updated deployment config retrieval to use a nil transaction, promoting a uniform database access pattern.

AppDeploymentTypeChangeManager.go - Refactored multiple pipeline configuration methods to include transaction parameters for consistent operation.

CdHandler.go - Revised deployment config calls to include nil transaction, improving error handling and consistency.

CiCdPipelineOrchestrator.go - Adjusted deployment config retrieval during pipeline orchestration to properly use transaction parameters.

DeploymentConfigService.go - Updated chart repository calls to incorporate a nil transaction, standardizing method usage.

DeploymentPipelineConfigService.go - Implemented changes across deployment config retrieval and update functions to accept transaction parameters, ensuring consistency.

DevtronAppStrategyService.go - Updated chart repository query to pass a nil transaction for standardized behavior.

PropertiesConfig.go - Enhanced transaction handling with explicit tx initiation, commit, and error recovery in properties configuration.

CdWorkflowCommonService.go - Standardized deployment config retrieval by incorporating explicit nil transaction parameter.

WorkflowDagExecutor.go - Modified deployment config fetch calls to integrate transaction management for improved error handling.

WorkflowStatusService.go - Refactored workflow status methods to use transaction parameters consistently.

Other Improvements - Code Generation Command Update

wire_gen.go - Modified the go generate command to include the '-mod=mod' flag, ensuring proper module resolution during code generation.

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 #dfb855

Actionable Suggestions - 4
  • pkg/chart/ChartService.go - 1
  • pkg/pipeline/CiCdPipelineOrchestrator.go - 1
  • internal/sql/repository/deploymentConfig/repository.go - 2
    • Nil pointer dereference in connection assignment · Line 149-151
    • Duplicate nil pointer dereference in connection assignment · Line 149-151
Review Details
  • Files reviewed - 34 · Commit Range: 3041db5..9a0d46d
    • api/restHandler/app/appList/AppListingRestHandler.go
    • cmd/external-app/wire_gen.go
    • internal/sql/repository/chartConfig/EnvConfigOverrideRepository.go
    • internal/sql/repository/deploymentConfig/repository.go
    • pkg/app/AppListingService.go
    • pkg/app/AppService.go
    • pkg/app/status/PipelineStatusTimelineService.go
    • pkg/appWorkflow/AppWorkflowService.go
    • pkg/chart/ChartService.go
    • pkg/chart/gitOpsConfig/DevtronAppGitOpsConfigService.go
    • pkg/chart/read/ChartReadService.go
    • pkg/chartRepo/repository/ChartRepoRepository_test.go
    • pkg/chartRepo/repository/ChartsRepository.go
    • pkg/commonService/CommonService.go
    • pkg/config/configDiff/DeploymentConfigurationService.go
    • pkg/deployment/common/deploymentConfigService.go
    • pkg/deployment/common/read/deploymentConfigReadService.go
    • pkg/deployment/manifest/ManifestCreationService.go
    • pkg/deployment/manifest/deploymentTemplate/DeploymentTemplateService.go
    • pkg/deployment/manifest/deploymentTemplate/read/chartEnvConfigOverride.go
    • pkg/deployment/trigger/devtronApps/deployStageHandlerCode.go
    • pkg/deployment/trigger/devtronApps/postStageHandlerCode.go
    • pkg/deployment/trigger/devtronApps/preStageHandlerCode.go
    • pkg/eventProcessor/in/WorkflowEventProcessorService.go
    • pkg/pipeline/AppDeploymentTypeChangeManager.go
    • pkg/pipeline/CdHandler.go
    • pkg/pipeline/CiCdPipelineOrchestrator.go
    • pkg/pipeline/DeploymentConfigService.go
    • pkg/pipeline/DeploymentPipelineConfigService.go
    • pkg/pipeline/DevtronAppStrategyService.go
    • pkg/pipeline/PropertiesConfig.go
    • pkg/workflow/cd/CdWorkflowCommonService.go
    • pkg/workflow/dag/WorkflowDagExecutor.go
    • pkg/workflow/status/WorkflowStatusService.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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review
Copy link

bito-code-review bot commented Jul 16, 2025

Code Review Agent Run #3529a2

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 9a0d46d..40b7a83
    • internal/sql/repository/deploymentConfig/repository.go
    • pkg/chart/ChartService.go
    • pkg/pipeline/CiCdPipelineOrchestrator.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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@sonarqubecloud
Copy link

@bito-code-review
Copy link

bito-code-review bot commented Jul 17, 2025

Bito Review Skipped - No Changes Detected

Bito didn't review this pull request because we did not detect any changes in the pull request to review.

@iamayushm iamayushm merged commit 4b8d72f into develop Jul 17, 2025
6 checks passed
@iamayushm iamayushm deleted the chart-service-refactoring branch July 17, 2025 10:29
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