-
Notifications
You must be signed in to change notification settings - Fork 476
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
Conversation
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). |
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.
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) { |
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.
func name should be the operation it is performing.
|
||
artifactIds := make([]int, 0, len(ciArtifacts)) | ||
for _, artifact := range ciArtifacts { | ||
artifactIds = append(artifactIds, artifact.Id) |
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 append on already initialized array with size n, is not efficient.
… emptyexclude artifacts ids
SonarCloud Quality Gate failed. 0 Bugs No Coverage information Catch issues before they fail your Quality Gate with our IDE extension SonarLint |
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:
Does this PR introduce a user-facing change?