scheduler: fix changegroup names
run changegroup names are based on the run path but it will contain slashes and could be very long. So calculate the sha256 sum of the path and use it as the changegroup name.
This commit is contained in:
parent
2c3e6bf9e4
commit
340cc15268
|
@ -22,6 +22,7 @@ import (
|
||||||
slog "github.com/sorintlab/agola/internal/log"
|
slog "github.com/sorintlab/agola/internal/log"
|
||||||
"github.com/sorintlab/agola/internal/services/config"
|
"github.com/sorintlab/agola/internal/services/config"
|
||||||
rsapi "github.com/sorintlab/agola/internal/services/runservice/scheduler/api"
|
rsapi "github.com/sorintlab/agola/internal/services/runservice/scheduler/api"
|
||||||
|
"github.com/sorintlab/agola/internal/util"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -89,7 +90,8 @@ func (s *Scheduler) scheduleRun(ctx context.Context, groupID string) error {
|
||||||
//log.Infof("queued runs: %s", queuedRunsResponse.Runs)
|
//log.Infof("queued runs: %s", queuedRunsResponse.Runs)
|
||||||
run := queuedRunsResponse.Runs[0]
|
run := queuedRunsResponse.Runs[0]
|
||||||
|
|
||||||
runningRunsResponse, _, err := s.runserviceClient.GetGroupRunningRuns(ctx, groupID, 1, []string{fmt.Sprintf("changegroup-%s", groupID)})
|
changegroup := util.EncodeSha256Hex(fmt.Sprintf("changegroup-%s", groupID))
|
||||||
|
runningRunsResponse, _, err := s.runserviceClient.GetGroupRunningRuns(ctx, groupID, 1, []string{changegroup})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "failed to get running runs")
|
return errors.Wrapf(err, "failed to get running runs")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue