Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
fix(shipyard-controller): Remove log noise (#5096)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
  • Loading branch information
bacherfl committed Sep 1, 2021
1 parent 4890846 commit bc956ef
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions shipyard-controller/handler/sequence_migrator.go
Expand Up @@ -47,7 +47,8 @@ func (sm *SequenceMigrator) MigrateSequences() {
for _, project := range projects {
// migrate sequences of projects in parallel
log.Infof("migrating sequences of project %s", project.ProjectName)
go sm.migrateSequencesOfProject(project.ProjectName, wg)
sm.migrateSequencesOfProject(project.ProjectName, wg)
log.Infof("finished migration of sequences of project %s", project.ProjectName)
}
wg.Wait()
}
Expand All @@ -56,7 +57,6 @@ func (sm *SequenceMigrator) migrateSequencesOfProject(projectName string, wg *sy
pageSize := int64(50)

for {
log.Infof("getting root events of project %s", projectName)
rootEvents, err := sm.eventRepo.GetRootEvents(models.GetRootEventParams{
Project: projectName,
PageSize: pageSize,
Expand All @@ -81,8 +81,12 @@ func (sm *SequenceMigrator) migrateSequencesOfProject(projectName string, wg *sy
}

func (sm *SequenceMigrator) migrateSequence(projectName string, rootEvent models.Event) error {
eventScope, err := models.NewEventScope(rootEvent)
if err != nil {
// if no event scope can be determined, there is no need to try to migrate it as a sequence
return nil
}
// first, check if there is already a task sequence for this context
log.Infof("checking if root event for shkeptncontext %s already has a task sequence state in the collection", rootEvent.Shkeptncontext)
sequence, err := sm.taskSequenceRepo.FindSequenceStates(models.StateFilter{
GetSequenceStateParams: models.GetSequenceStateParams{
Project: projectName,
Expand All @@ -94,15 +98,10 @@ func (sm *SequenceMigrator) migrateSequence(projectName string, rootEvent models
}
if len(sequence.States) > 0 {
// sequence exists already, no need to migrate it anymore
log.Infof("sequence with shkeptncontext %s already present", rootEvent.Shkeptncontext)
return nil
}

log.Infof("sequence of shkeptncontext %s not stored in collection yet. starting migration", rootEvent.Shkeptncontext)
eventScope, err := models.NewEventScope(rootEvent)
if err != nil {
return fmt.Errorf("could not determine scope of task sequence: %s", err.Error())
}

_, taskSequenceName, _, err := keptnv2.ParseSequenceEventType(*rootEvent.Type)
if err != nil {
Expand Down

0 comments on commit bc956ef

Please sign in to comment.