►
From YouTube: Code Owners architecture
Description
Code Owners architecture walkthrough
A
Yep,
okay,
so
I'm
gonna
give
a
walk
through
of
the
architecture
of
code
owners,
I
recently
added
this
documentation
page.
A
That
gives
a
overview
of
how
the
how
the
logic
works
and
the
entry
points
into
that
logic
and
stuff.
So
you
can
see
this
page.
It's
already
live
on
the
on
the
doc
site,
so
it's
already
linked
to
you
from
the
feature
page
as
well.
So
from
this
feature
page,
you
can
see
in
the
Technical
Resources
or
of
course
you
can
search
for
it.
A
So
in
here
we've
got
a
few
things:
we've
got
them
a
bit
of
details
about
business
logic,
details
about
the
related
models
and
the
controllers
and
services
which
interact
with
that
business
logic
and
some
diagrams
here
that
show
the
flow
of
how
we
enter
different
pieces
of
the
code
owners,
business
logic.
So
I
go
over
the
business
logic,
so
we
have
a
few
files
code.
Owners
is
an
Enterprise
only
feature.
So
all
of
this
lives
in
the
ee
directory
It's
all
under
lib
gitlab.
A
There
is
a
class
in
the
gitlab
folder
code
owners
and
then
all
of
the
rest
are
names
based
within
the
code
owner's
namespace.
So
we
have
the
main
module
which
is
used
to
interact
with
code
owners
in
the
lib
gitlab
directory,
and
we
have
a
file
called
code
owners
loader,
which
will
load
the
correct
file
from
the
repo.
So
we
can
request
a
code
owner's
file
from
the
default
Branch
or
we
can
pass
in
a
reference
and
we
can
fetch
the
file
from
you
know
different
branch
or
tag.
A
We
also
have
some
say,
maybe
easier
to
use
the
it
out
of
order.
So
we
have
the
file,
which
is
a
class
which
wraps
the
code
owner's
file
and
exposes
some
useful
public
methods
and
within
that
we
also
have
entries
which
are
not
sure
if
you're
all
familiar
with
how
code
owners
Works,
maybe
I,
should
actually
open
your
stocks.
So
you
can
see
the
example
so.
B
A
Yes,
so
encode
owners,
you
know
we
have,
you,
don't
actually
have
to
use
sections.
You
can
do
if
you
want
to
group
rules
logically,
but
the
these
rows
are
the
entries.
So
the
entry
is
a
path
followed
by
a
list
of
group,
subgroups
or
users
that
own
the
file,
and
by
specifying
this
it
essentially
means
that
you
have
to
get
approval
from
this.
A
This
one
looks
like
a
group,
so
if
you
modify
a
file
within
the
ee
slash
docs
directory,
then
you
need
to
request
a
approval
from
the
docs
group,
some
from
a
member
of
the
docs
group,
so
those
are
entries
where
have
I
just
lost
and
faced
it.
Okay.
So
here
we
go
so
yeah,
so
we
have
the
file
and
entries
that
wrap
those.
A
There
has
actually
been
another
class
introduced
since
I've
added
this
documentation,
which
hasn't
hasn't
been
included
in
here
yet,
which
is
a
section
so
the
sections
are,
you
know
we
have
the
section
name
here,
there's
also
some
other
stuff.
You
can
do
sections.
One
of
them
is
documented
here,
which
is
a
default
owner,
so
this
would
mean
the
development
section
is
by
default.
It's
owned
by
the
dev
team.
So
if
you
don't
add
any
owners
after
the
path,
then
it
will
be
assigned
to
the
dev
team.
A
However,
if
you
add
an
owner,
then
it's
a
rise
of
evil,
so
there's
also
a
section
class
to
to
wrap
around
that
logic
now
as
well,
which
which
will
extract
you
know
the
name
and
whether
the
section
is
optional,
how
many
approvals
it
needs
and
stuff
like
that
right.
A
So
we
also
have
so
part
of
the
low
level,
so
the
loader
class
will
first
load
the
file
and
wrap
it
and
then
it'll
wrap
it
in
this
this
file
class
and
then
it
will
extract
all
of
the
entries
and
it
will
also
load
all
of
the
owners.
So
if
we
have
any
users
or
groups
specified
as
owners
it'll
do
that
in
a
single
database
query
or
a.
A
Database
queries
but
it'll
try
to
optimize
it
as
as
well
as
it
can.
So
we
have
these
two
classes,
the
user
loader
and
the
groups
loader,
and
we
also
have
a
reference
extractor.
So
this
reference
extractor
is
responsible
for
figuring
out
kind
of
find
a
good
example
here.
So
when
you
have
multiple
so
like
this
one
right,
so
you
have
multiple
references
here.
So
we
have
a
reference
to
group
the
group
with
nested
subgroups
so
that
the
second
one
here
is
a
subgroup
within
group,
so
the
reference
extractor
will
will
basically
just
pass
it.
A
A
A
Right
so
and
then
one
last
piece
is
validator,
so
I
can
only
feel
like
this
is
potentially
in
the
wrong
place.
Validator
is
actually
used
when
we,
let
me
show
you
the
flowchart,
so
this
is
easier
to
understand.
So
there
are
two
different
entry
points
for
doing
code
owner
checks.
A
So
the
first
one
happens
when
somebody
pushes
code
to
gitlab
and
we
have
a
class
called
get
access
and
within
that
we
do
some
checks
based
on
if
you're,
pushing
or
pulling
if
you're
pushing
it
performs
checks
on
the
changes
that
are
being
pushed,
and
one
of
those
checks
is
a
diff
check,
so
it
finds
all
of
the
files
that
have
been
changed
and
it
it
validates
a
few
things.
So
this
is
the
diff
check
class,
so
we
can
see
here.
Let
me
just
enlarge
that
maybe
easier
to
see.
A
So
this
is
the
ee
version
in
the
in
the
non-ee
version.
There's
some
other
checks
as
well,
I
think,
but
in
here
we
validate
the
code
owners.
So
we
basically
just
call
the
code
owner
validator
with
the
the
project,
the
graph
Branch
name
and
the
paths
that
have
been
changed
and
the
validator
class
will.
Then
it's
going
to
check
if
brands
the
branch
requires
code
owner
approval,
so
this
is
actually
part
of
the
protected
branches
feature.
A
So
when
you
protect
a
branch,
you
can
select
a
checkbox
that
says
require
code
owner
approval
for
any
of
the
files
in
here,
and
then
it's
going
to
use
the
code
owner
loader
to
find
all
the
entries
for
the
div
and
it's
going
to
check.
If,
if
any
of
the
files
in
the
code
owner
file
has
been
pushed
without
being
approved
so
being
pushed
directly
to
a
protected
Branch,
it's
then
going
to
return
an
error,
so
this
is
actually
from
your
command
line
interface
right.
A
A
So
currently
I
I
do
think
this
validator
should
potentially
be
moved
out
of
the
decode
owner
namespace
and
maybe
into
the
diff
the
the
checks
namespace.
Let's
get
log
checks,
dish,
diff,
checked,
I
think
it
should
maybe
maybe
belonging
this
name
first,
because
we're
going
to
be
introducing
other
validators
as
well
to
ensure
that
the
code
owner
file
itself
is
actually
valid
and
I
think
that
that
logic,
you
know,
belongs
in
the
code
and
namespace
rather
than
this
okay.
So
let's
go
back
to
this
flow
chart.
A
So
that's
the
the
first
way
that
we
access
code
owners.
So
when
you're
pushing
you
know,
we
check
if
any
of
the
files
are
changed,
that
you're
not
supposed
to
the
second
way
that
we
use
code
owners
is
on
merge
requests.
So
when
you
create
a
motorquest,
you
update
a
match,
request
or
there's
some
other
other
stuff.
A
So
if
you
create
protected
branches,
there's
a
create
service
which
is
going
to
go
through
all
of
the
most
requests
that
are
already
open
and
make
sure
the
rules
are
applied
and
there's
a
merge
request,
refresh
service
and
a
Reload
merge
request
head
diff
service.
On
top
of
my
head,
I'm
not
exactly
sure
what
they
do,
but
they're
related
they're
all
related
to
merge,
requests
right.
So
when
an
action
happens
within
a
merge
request
or
you
create
a
new
new
protected
Branch
we're
going
to
trigger
the
merge
request.
A
A
So
the
target
branch
is
feature,
slash,
something
and
I've
I've
branched
off
that
and
I'm,
adding
a
small
change
to
that,
so
that
the
first
thing
it's
going
to
do
is
load
the
code
owners
file
from
the
target
branch
and
we're
going
to
find
all
of
the
entries
that
are
related
to
the
merge
request
itself.
So
here
we've
got
code
owner
entries,
so
this
is
going
to
call
the
the
main
code
owners
file
and
it's
going
to
call
entries
for
merge,
request
we're
going
to
pass
in
the
merge
request
and
then
the
merge
request.
A
Diff
is
the
previous
div,
so
what
that's
going
to
do
is
find
all
of
the
entries
in
the
code
owner
file
that
apply
to
files
that
have
been
changed
within
the
the
merge
request
itself
and
we're
going
to
first
try
to
delete
any
rules
that
might
be
outdated.
So
if
this
merge
request
is
not
new,
this
code
would
have
been
processed
once
already.
So
the
first
thing
we're
going
to
do
is
delete
any
rules
that
no
longer
apply.
A
So,
for
example,
if
I
have
a
code
learner
entry
that
protects
the
readme
file
and
I
create
a
merge
request
and
I
change
the
readme,
and
then
somebody
reviews
it,
and
it
says
that
you
don't
need
to
add
this
to
the
readme.
I
might
go
back
in
and
remove
that
change,
sort
of
readme
and
then
the
second
time
I
push,
because
the
readme
file
is
no
longer
in
the
merge
request.
We're
gonna
we're
gonna
need
to
delete
that
that
approval
rule
or
we're
going
to
have
an
approval
rule
that's
invalid.
A
So
that's
the
first
thing
we're
doing
here,
which
so
we're
going
to
call
motorquest
approval
rules
and
then
on
the
approval
rules
model.
We
have
a
method,
not
matching
pattern
and
we're
going
to
pass
in
patterns.
So
patterns
is
taken
from
the
code
owner
entries,
so
we're
just
going
to
take
all
of
the
code
entries
so
remembering
these
are
only
the
entries
that
are
specific
to
the
files
in
the
major
ghost
and
we're
going
to
map
the
patterns.
C
A
A
So
you
see
here
we're
getting
the
rules
by
pattern
by
section,
so
it's
taking
a
rule
from
each
section
and
then
we're
going
to
go
over
each
codon
entry
and
create
a
merge
request,
approval
rule
for
that
for
that
entry.
So
that
means
that
when
you're
approving
a
merger
question
not
actually
interacting
directly
with
the
code
owner
file,
you
are
actually
you
know,
interacting
with
merge,
request
approval
rules
that
mimic
what's
been
defined
in
the
code
owners
file.
A
I
got
the
files
open
here,
but
so
yeah
I
recommend
poking
around
in
this.
It's
quite
interesting
how
the
code
Works
we
can
see
the
file
here.
This
is
the
class
that
wraps
the
actual
code
owner
file
and
we
have
a
loader.
So
the
loader
you
pass
in
you
call
the
entries
it's
going
to
burst
it's
going
to.
Where
is
it
load
in
this
file?
So
it
does
it
here.
So
we're
going
to
wrap
the
file
in
the
code.
A
The
code
is
blob
in
a
file
class
and
then
we're
going
to
pass
that
file
and
load
the
entries
for
the
paths,
so
the
paths
we
we
passed
in
ourselves
like
when
we
have
a
merge
request.
We
pass
in
order
password
from
the
merge
request,
so
we
just
load
what
we
need
to
load
and
once
we've
loaded
those
entries,
we
then
load
the
users
and
groups
that
are
required.
A
And
yeah,
then
this
is
the
reference
extractation.
You
see
it's
also
fairly
simple
yeah,
so
I
think
that's
that's
probably
all
of
it.
So
if
anyone
has
any
questions,
look
at
that
time.
A
B
Okay,
so
with
the,
if
you
go
back
to
where
it's
doing
the
merge
request,
approval
rules
so
there's
a
couple
of
there
was
a
couple
of
things.
One
is
so
for
just
to
completely
understand
this.
So
for
every
merge
request.
B
We
have
entries
in
the
database
that
are
effectively
the
the
calculation
of
of
the
code
owner
rules
against
this
particular
depending
on
what
files
are
in
that
merge
request
all.
B
A
B
B
Oh
okay,
so
just
mix
it's
interming
with
other
approvals.
Okay,
so
I
just
it
just
it
I
mean
I'm,
not
obviously
that
close
to
how
that
looks,
but
it
does
seem,
is
it
effective?
Is
it
inefficient
to
to
be
creating?
You
know
millions
of
rows.
Well,
let
me
ask
the
question
another
way:
had
we
designed
code
owners
in
a
different
way,
would
it
be
possible
to
to
just
create
a
simple
set
of
rows
in
in
tables
that
could
be
then
joined
by
whatever
merger
quests
are
coming
along.
A
I
mean
one
way
to
do.
It
would
obviously
be
reading
directly
from
the
code
owners
file.
That
would
obviously
be
quite
inefficient
because
you'll
be
calling
guestley
quite
regularly
yeah
it's
possible.
We
may
have
been
able
to
do
it
in
a
different
way,
where
and
so
I
think.
A
Yeah
that
was
yeah
to
store
the
actual
phone,
so
I
think
we.
So
we
spoke
recently
about
potentially
removing
at
the
moment
when
you
create
a
merge
request
where
you
load
the
code
owners
file
from
the
target
branch,
which
means
that
there
are
at
one
point
in
time.
There
are
multiple
code
owners
files
that
live
in
every
rebound,
because
each
branch
technically
has
its
own
codons
file,
whether
that
change
they
changed
or
not.
That's
not
really
relevant
right,
but
it
would
mean
we'd
need
to
keep
track
of
them.
A
A
However,
if
we
remove
that
we
only
use
the
one
from
the
default,
Branch
I
think
it
there
would
be
a
possibility
for
only
having
you
know
for
having
a
record
of
the
rules
in
the
default
Branch
at
this
present
time,
and
then
you
could
use,
join,
joins
and
queries
to
check
those
on
merge
requests
which
may
be
more
efficient,
but
I
think
you
know.
We
we've
discussed
this
and
looked
at
this
recently
and
I.
A
B
B
And
yeah
and
so
I
guess
the
other
kind
of
related
question
is
so
you
said
something
earlier
on.
At
least
sorry,
unless
someone
else
has
a
question:
does
anyone
else
have
a
question.
A
B
Answer
so
in
that
case,
I'll
ask
a
second
question,
which
is
code
owners
you
mentioned
earlier
on
that
on
the
branch
protection
rule
we
say
it's
protected
by
code
owners,
so
this
codeone
is
only
coming
to
effect.
If
we
have
that
turned
on
because
I
thought
it
was,
you
know
Branch.
A
Rules,
no
so
there's
two
there's
two
separate
ways
that
it's
used,
so
the
the
one
that
you're
you're
mentioning
now
is
when
you
create
a
protected
Branch,
say:
I
protect,
feature,
slash
star,
so
that
would
say
any
branch
that
starts
with
feature
slash
protector
and
when
you
create
that
protected
Branch,
you
can
turn
the
checkbox
on
that
says,
require
code
owner
approval
so
that
what
that
means
is
you
can't
push
files
directly
to
that
branch
that
are
defined
in
the
code
owners
file?
A
So
if
I
created
a
branch
code,
feature
slash
my
feature
and
I
try
to
push
the
readme,
it
would
give
me
an
error,
and
the
only
way
for
me
to
actually
change
that
file
in
that
Branch
would
be
to
First
create
a
different
branch
that
was
not
named
feature
slash,
my
feature
so
maybe
call
it
addition
to
my
feature
and
I'd
have
to
do
a
merge
request
into
my
Branch.
So
that's
the
first
way
that
we
use
code
owners
and
that's
specifically
related
to
protected
branches.
A
A
If
you
have
a
code
ends
file,
all
most
requests
get
these
approval
rules
and,
additionally,
you
can
actually
turn
on
another
type
of
approval
rule
which
says
allow
any
eligible
approval
to
approve
this
and
code
people
that
are
defined
within
code
owners
also
pastors
eligible
approvers,
so
that
that
means,
if
you
you
know,
if
you
just
Define,
if
you
said,
read
me
as
owned
by
the
doc
team,
then
you
push
a
change
to
read
me
and
you
have
the
all
that
all
eligible
approvers
approval
all
turned
on.
That
means.
B
So
yeah,
so
with
those
approvals,
then
again,
if
anyone's
got
a
question,
just
jump
in
or
comment,
they
turn
into
a
required
approval
in
the.
A
A
Where
it's
it's
not
possible
to
make
a
file,
approval
requires
like
it.
If
a
if
a
group
is
inherited
rather
than
a
direct
member
of
a
project
at
the
moment,
I
think
it's
not
possible
to
make
that.
Let
me
just
check
your
documentation
because
I
know
there's
some
well.
B
B
B
A
A
A
However,
we've
been
discussing
this
and
you
know
potentially
in
the
future.
We
may
change
that
so
that
yeah,
that's
an
interesting
creature,
yeah
exactly
yeah.
Well,
this
there's
a
thing
like
I
think
originally.
When
we
wrote
this,
we
were
saying
we
don't
want
it
to
block.
You
know
if
there's.
A
To
prevent
approvals
from
happening,
but
I
think
now
we're
you
know
we're
switching
more
into
okay.
This
is
like
a
security
feature,
so
now
we're
looking
at
this,
like.
Maybe
it
shouldn't
be
approved,
and
you
know
somebody
that
is
responsible
for
the
code
and
as
far
as
really
go
and
fix
that
problem.
C
A
B
C
B
A
C
C
Because
the
the
tech
writing
team
is
an
exception
to
the
the
auditor
rules
where
or
approval
and
merge
because
they
realized
what
we
do
for
a
living.
We
make
changes
to
other
people's
merge
requests
and
not
allowing
someone
who
edits
like
me
to
make
my
edits
and
then
merge.
The
word
means
we
have
to
bring
in
yet
another
person.
C
A
So
so,
just
as
we
clear
the
loophole
is
docs
don't
need
a
the
approval
is
optional.
Is
that.
C
A
B
C
A
B
It
is,
it
is
an
interesting
approach,
because
yeah
so
I
understand
the
reasoning
behind
that,
but
at
the
same
time,
yeah
we've
created
a
rule,
okay,
so
the
rules
invalid.
But
then
we
automatically
improve
it.
That's
it
seems
well,
I,
guess
that's
what
we're
doing
so.
I
haven't
seen
any
issues
around
that
actually,
no.
A
B
B
B
A
Yeah
I
mean
it's
pretty
good,
I
think
that
actually
not
100
related
to
code
owners,
but
the
diff
checks.
Logic
is
a
little
bit
messy
I
think
it
could
be
improved
a
bit
but
code
like
code
owners
is
fairly
small
and
self-contained
at
the
moment.
So
I
think
the
the
co-pilot
is
pretty
good
there
and
we
had
quite
good
test
coverage
as
well.
B
It's
interesting
what
you
mentioned
about
the
validation
step
being
where
it
is.
We
are
actually
a
time,
but
because
you
know,
one
of
the
upcoming
features
is
to
have
a
way
of
validating
code
owners,
potentially
On
Demand
by
a
user.
So
that
would
require
us,
on
top
of
internal
re-architecture,
to
make
that
possible.
A
Would
this
would
get
a
specific?
This
is
different
logic
right.
So
this
is,
this
validator
I
think
is
kind
of
like
a
is
named
slightly
wrong
like
so
it's
actually
it's
not
validating
the
code
owners
itself
right.
So
it's
actually
validating
changes
that
have
been
pushed
against
the
code:
okay,
okay,
it's
approving
or
yeah
kind
of
yeah,
something
like
that.
B
I
have
added
two
points
to
the
agenda,
but
those
are
just
read-only.