Make data/team.yml eventually consistent
To support users who edit the team directory through the web interface, here we change the pipeline so that:
-
verify_team only runs on merge requests
- if the team directory has changed from master, we only check the changes in the team directory
- otherwise we verify full consistency
-
on master we run update-team
- here we check that the team.yml file reflects the contents of the team directory
- if it does not, then we update it so that it does, and push the resulting file to master.
For this to work, data/team.yml must never be updated in merge requests, and we must only run verify_team on merge requests.
We use ci.skip to avoid creating a subsequent pipeline.
See:
- !73835 (closed) which prevents changes to data/team.yml in MRs
- !73798 (closed) which adds extra verification (needs to be merged first)
- !73139 (merged) which implements the split, after which this becomes necessary
This can be merged first
Data Flow
The data flow is:
flowchart TB
subgraph mrpl [Phase One]
UserEditsTeam[/User edits data/team.yml\] -->|triggers| MRPL_a(MR pipeline)
StartBad[/User edits data/team_members/person/x/ab.yml\] -->|triggers| MRPL_c(MR pipeline)
Start[/User edits data/team_members/person/a/ab.yml\] -->|triggers| MRPL_b(MR pipeline)
BotStart[/gitlab-bot edits data/team.yml\] -->|triggers| MRPL_b(MR pipeline)
MRPL_a -->|runs| DJ_a{danger}
MRPL_b -->|runs| DJ_b{danger}
DJ_a -->|MR touches team.yml| MRAbort
DJ_b -->|ok| VT_a{validate_team}
MRPL_c -->|MR changes team members| VT_c{validate_team}
VT_c -->|invalid?| MRAbort(Merge prevented)
VT_a -->|ok| Merge(Added to merge train)
end
Merge-->MergeTrain[(Merge Train)]
MergeTrain -->|triggers| MasterPL[Pipeline on master]
subgraph Phase Two
MasterPL -->|runs| UT(bundle exec rake build:team_yml)
UT -->|produces| YAML(team.yml)
YAML -->|changed?| NeedsUpdate[\create MR editing team.yml/]
YAML -->|up to date?| Done[\DONE/]
end
NeedsUpdate -->BotStart
classDef pipeline fill:#f96;
class MasterPL,MRPL_a,MRPL_b,MRPL_c pipeline;
classDef terminal fill:#000000,stroke:#fff,color:#fff;
class Start,StartBad,UserEditsTeam,Done,Merge,MRAbort terminal;
Edited by Alex Kalderimis