Skip to content

Commit

Permalink
Fix repository runner vm potentially not deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Tereius committed Aug 5, 2024
1 parent 0f5642d commit 6e4d6f2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runner-autoscaler/pkg/srv.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,11 @@ func (s *Autoscaler) handleWebhook(ctx *gin.Context) {
log.Warnf("Webhook requested to start a runner that is missing the label(s) \"%s\" - ignoring", strings.Join(missingLabels, ", "))
}
} else if payload.Action == COMPLETED {
if payload.Job.RunnerGroupId == int64(s.conf.RunnerGroupId) {
runnerGroupId := s.conf.RunnerGroupId
if src.SourceType == TypeRepository {
runnerGroupId = 1
}
if payload.Job.RunnerGroupId == runnerGroupId {
if ok, missingLabels := payload.Job.hasAllLabels(s.conf.RunnerLabels); ok {
deleteUrl := createCallbackUrl(ctx, s.conf.RouteDeleteVm, s.conf.SourceQueryParam, src.Name)
if err := s.createCallbackTaskWithToken(ctx, deleteUrl, src.Secret, payload.Job.RunnerName); err != nil {
Expand Down

0 comments on commit 6e4d6f2

Please sign in to comment.