Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(worker,hatchery): model requirement check enforce group name #6209

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions engine/worker/internal/requirement.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ func checkModelRequirement(w *CurrentWorker, r sdk.Requirement) (bool, error) {
}

isSharedInfra := w.model.Group.Name == sdk.SharedInfraGroupName && modelName == w.model.Name
isSameName := modelName == w.model.Name // for backward compatibility with runs, if only the name match we considered that the model can be used, keep this condition until the workflow runs were not migrated.
return isSharedInfra || isSameName, nil

return isSharedInfra, nil
}

func checkServiceRequirement(w *CurrentWorker, r sdk.Requirement) (bool, error) {
Expand Down
3 changes: 1 addition & 2 deletions sdk/hatchery/hatchery.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ func canRunJobWithModel(ctx context.Context, h InterfaceWithModels, j workerStar
modelName := strings.Split(r.Value, " ")[0]
isGroupModel := modelName == fmt.Sprintf("%s/%s", model.Group.Name, model.Name)
isSharedInfraModel := model.Group.Name == sdk.SharedInfraGroupName && modelName == model.Name
isSameName := modelName == model.Name // for backward compatibility with runs, if only the name match we considered that the model can be used, keep this condition until the workflow runs were not migrated.
if !isGroupModel && !isSharedInfraModel && !isSameName {
if !isGroupModel && !isSharedInfraModel {
log.Debug(ctx, "canRunJobWithModel> %d - job %d - model requirement r.Value(%s) do not match model.Name(%s) and model.Group(%s)", j.timestamp, j.id, strings.Split(r.Value, " ")[0], model.Name, model.Group.Name)
next()
return false
Expand Down