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

fix: add canary_id to job_history and cleanup sync canary function #1169

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

yashmehrotra
Copy link
Member

Fixes: flanksource/duty#229

@moshloop @adityathebe
Removed some dead logic and redundant conditions which I don't think was necessary. Please do a double check on this

Comment on lines -348 to -353
canary, err := c.ToV1()
if err != nil {
logger.Errorf("Error parsing canary[%s]: %v", c.ID, err)
jobHistory.AddError(err.Error())
continue
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Not required, we are doing this in the SyncCanary func

Comment on lines -355 to -362
if len(canary.Status.Checks) == 0 && len(canary.Spec.GetAllChecks()) > 0 {
logger.Infof("Persisting %s as it has no checks", canary.Name)
pkgCanary, _, _, err := db.PersistCanary(*canary, canary.Annotations["source"])
if err != nil {
logger.Errorf("Failed to persist canary %s: %v", canary.Name, err)
jobHistory.AddError(err.Error())
continue
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Since these canaries are always fetched from database, no persistence logic is needed

Copy link
Member

Choose a reason for hiding this comment

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

@yashmehrotra we were also saving checks from the canary spec in here. Now, checks aren't being saved.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@yashmehrotra I'm not talking about component checks. If you create a canary from the UI then the checks are never saved.

Comment on lines -364 to -369
v1canary, err := pkgCanary.ToV1()
if err != nil {
logger.Errorf("Failed to convert canary to V1 %s: %v", canary.Name, err)
jobHistory.AddError(err.Error())
continue
}
Copy link
Member Author

Choose a reason for hiding this comment

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

redundant conversion

@moshloop moshloop merged commit ac227af into master Jul 24, 2023
11 checks passed
@yashmehrotra yashmehrotra deleted the add-canary-id-to-job-history branch July 24, 2023 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Canary job history missing resource_id
3 participants