From 1f83f0f19833b2e13f767b2b1097728c1265b1c7 Mon Sep 17 00:00:00 2001 From: Laszlo Fogas Date: Tue, 23 Jul 2019 14:10:44 +0200 Subject: [PATCH] After filterItemsWithMissingDependencies introduced, the next id can be higher than the length of procs --- server/procBuilder.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/server/procBuilder.go b/server/procBuilder.go index a31a2f711..45858847c 100644 --- a/server/procBuilder.go +++ b/server/procBuilder.go @@ -248,23 +248,26 @@ func (b *procBuilder) toInternalRepresentation(parsed *yaml.Config, environ map[ } func setBuildStepsOnBuild(build *model.Build, buildItems []*buildItem) *model.Build { + var pidSequence int for _, item := range buildItems { build.Procs = append(build.Procs, item.Proc) + if pidSequence < item.Proc.PID { + pidSequence = item.Proc.PID + } } - pcounter := len(build.Procs) for _, item := range buildItems { for _, stage := range item.Config.Stages { var gid int for _, step := range stage.Steps { - pcounter++ + pidSequence++ if gid == 0 { - gid = pcounter + gid = pidSequence } proc := &model.Proc{ BuildID: build.ID, Name: step.Alias, - PID: pcounter, + PID: pidSequence, PPID: item.Proc.PID, PGID: gid, State: model.StatusPending,