Skip to content
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

chore: artifact api refactoring #4137

Merged
merged 37 commits into from
Nov 15, 2023
Merged

Conversation

gireesh-devtron
Copy link
Member

@gireesh-devtron gireesh-devtron commented Oct 19, 2023

Description

Artifacts listing api refactoring.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

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?


var wfrList []CdWorkflowRunner
err := impl.dbConnection.
Model(&wfrList).
Column("cd_workflow_runner.*", "CdWorkflow", "CdWorkflow.Pipeline", "CdWorkflow.CiArtifact").
Where("cd_workflow.pipeline_id = ?", pipelineId).
Where("cd_workflow_runner.workflow_type = ?", runnerType).
Where("ci_artifact.image ILIKE %?%", searchString).
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be conditional, otherwise slows the query even if not required

@@ -278,6 +292,19 @@ func (impl *CiWorkflowRepositoryImpl) FindLastTriggeredWorkflowGitTriggersByArti
return workflow, err
}

func (impl *CiWorkflowRepositoryImpl) FindLastTriggeredWorkflowGitTriggersByArtifactIds(ciArtifactIds []int) ([]*CiWorkflow, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

func name should be the operation it is performing.


artifactIds := make([]int, 0, len(ciArtifacts))
for _, artifact := range ciArtifacts {
artifactIds = append(artifactIds, artifact.Id)
Copy link
Contributor

Choose a reason for hiding this comment

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

using append on already initialized array with size n, is not efficient.

@gireesh-devtron gireesh-devtron changed the title fix: artifact api refactoring chor: artifact api refactoring Nov 15, 2023
Copy link

sonarcloud bot commented Nov 15, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 2 Security Hotspots
Code Smell A 15 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@gireesh-devtron gireesh-devtron changed the title chor: artifact api refactoring chore: artifact api refactoring Nov 15, 2023
@gireesh-devtron gireesh-devtron merged commit a67365f into main Nov 15, 2023
6 of 8 checks passed
@gireesh-devtron gireesh-devtron deleted the artifact-api-refactoring branch November 15, 2023 10:45
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.

None yet

3 participants