Skip to content

Commit

Permalink
updated stageTime-informer 24.0206.2045 for tag version v0.1.89
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-hermann-sva committed Feb 6, 2024
1 parent d90c981 commit bacd5a2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ func setStageStatus(pipelineRunLabels map[string]string) {

currentStageID := stageStatusFromRedis.StageID
nextStageIDBuilder := strings.LastIndex(currentStageID, "-")
nextStageID := stageStatusFromRedis.StageID[:nextStageIDBuilder] + "-" + sthingsBase.ConvertIntegerToString(countCurrentStage+1)

nextStageID := replaceLastOccurrenceInSubstring(stageStatusFromRedis.StageID[:nextStageIDBuilder]+"+"+sthingsBase.ConvertIntegerToString(countCurrentStage+1), "-", "+")

fmt.Println("NEXT STAGE!?", nextStageID)
server.SendStageToMessageQueue(nextStageID)

Expand All @@ -114,3 +116,11 @@ func setStageStatus(pipelineRunLabels map[string]string) {
// }

}

func replaceLastOccurrenceInSubstring(subString, searchFor, replaceWith string) (x2 string) {
i := strings.LastIndex(subString, searchFor)
if i == -1 {
return subString
}
return subString[:i] + replaceWith + subString[i+len(searchFor):]
}

0 comments on commit bacd5a2

Please sign in to comment.