oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package planning
2
3import (
4 "strconv"
5
6 "amadan.net/oficina/equipo/internal/equipo/team"
7 "amadan.net/oficina/equipo/internal/taskplan"
8)
9
10// ExecutionSpec accepts a validated target from the application boundary.
11func ExecutionSpec(t Task, p taskplan.Plan, target team.TargetBinding, policy team.Policy, grant string) (team.JobSpec, error) {
12 if t.ID == "" || p.TaskID != t.ID || p.ProjectID != t.ProjectID || p.Revision != t.PlanRevision || p.Revision < 1 || policy.Validate() != nil {
13 return team.JobSpec{}, taskplan.ErrInvalid
14 }
15 steps, err := ExecutionSteps(p)
16 if err != nil {
17 return team.JobSpec{}, err
18 }
19 e := team.EvidenceRequirement{Predicate: team.PredicateSoftwareFix, ExpectedSymptom: t.Description, CheckDefinitionHash: t.CheckDefinitionHash, BaselineTestSetHash: t.BaselineTestSetHash, RequireBugFreeze: true}
20 if p.Kind != taskplan.Bug {
21 e, err = EvidenceForPlan(p, t.CheckDefinitionHash, t.BaselineTestSetHash)
22 }
23 if err != nil {
24 return team.JobSpec{}, err
25 }
26 if p.Kind == taskplan.RenderedChange {
27 e.RequireBugFreeze = true
28 }
29 return team.JobSpec{Account: team.AccountID(t.TeamID), Project: team.ProjectID(t.ProjectID), Requester: t.Requester, RequestKey: t.ID + "/plan/" + strconv.FormatInt(p.Revision, 10), GrantRef: grant, Target: target, Evidence: e, Policy: policy, Steps: steps}, nil
30}
31