►
From YouTube: CI Minutes - architectural overview
Description
Fabio Pitino (Backend Engineer) gives an overview of the CI minutes feature.
A
Hi
everybody
in
this
video
I'm
going
to
give
an
overview
of
the
ci
minutes
feature
on
gitlab,
and
so
the
ci
minutes
feature
is
a
way
of
measuring
the
consumption
of
shared
running
resources
for
specific
namespaces.
A
So
they
are
only
applied
to
shared
runners
on
the
gitlab.com
and
if,
for
example,
you
are
using
private
runners
or
specific
runners
for
at
project
level,
for
example
those
consume,
this
consumption
is
not
tracked
against
the
ci
minutes.
So
the
same
means
are
initially
assigned
when
a
user
signs
up
for
an
account
on
gitlab.com
at
the
name
space
level.
A
So
as
part
of
the
subscription
plan-
and
there
is
a
monthly
allowance
that
is
given
to
a
specific
namespace
and
starts
with
400
minutes
on
the
free
plan
as
of
today
and
then
progressively
increases
for
a
higher
paid
tiers
and
and
then
on
top
of
that,
a
user
can
decide
to
buy
additional
minutes
if
the
monthly
allowance
is
not
sufficient
for
specific
for
a
specific
month.
And
so
these
two
values
of
the
monthly
allowance
and
the
any
additional
minutes
are
stored
on
on
gitlab.com
sent
from
the
customer
portal.
A
And-
and
we
started
to
do
that-
it's
two
separate
tables
so
for
for
two
different
tracking,
so
we
started
with
additional
purchase
minutes
at
zero
and
then,
if
the
customer
purchased
additional
minutes,
we
we
saw
on
the
same
column
for
for
the
specific
namespace.
A
We
see
that
when
shared
runners
request
a
new
job
and
we
check
whether
for
the
potential
list
of
jobs
that
could
be
assigned
to
the
shared
runner,
whether
there
is
any
jobs
that
don't
have
ci
minutes
available.
So
we
take
the
namespace
of
the
specific
job.
But
we
see
whether
the
consumption
of
the
current
consumption
of
minutes
is
higher
than
the
limit
and
with
the
limit
given
by
the
sum
of
the
monthly
subscription
allowance,
plus
any
additional
purchase
minutes.
A
So
if
the
namespace
doesn't
have
any
emails
available,
we
don't
assign
the
job
to
the
runner
and
that
the
job
remains
pending,
eventually
shows
as
stock
and
the
pipeline.
And-
and
this
is
like
as
a
signal
to
say-
you
don't
have
any
more
minutes,
so
we
can't
process
any
more
jobs,
and
but
if
the
there
are
minutes
available,
then
the
job
is
assigned
to
the
runner
and
the
runner
proceeds
with
it
with
a
normal
execution
of
the
job.
A
When
the
job
is
completed
and
then
the
an
event
is
submitted,
and
then
we
update
the
ci
minutes,
consumption
based
on
the
job
duration,
which
is
the
the
amount
of
seconds
that
the
job
remained
in
a
running
state
which
is
being
executed
on
the
runner
machine.
So
we
don't
consider
as
part
of
the
minutes
consumption
and
when
the
job
is
in
a
pending
state
or
it's
been
or
is
in
a
created
state
waiting
for
previous
jobs
in
the
pipeline
to
be
executed.
A
So
when
the
job
is
idle,
for
example,
we
don't
account
cm
and
it's
only
when
the
shared
runner
is
actually
been
actively
executing
the
job.
So
we
we
multiply
the
consume.
The
duration
of
the
job
per
cost
factor
that
is
associated
to
the
shared
render
so
shared
runner
can
have
two
different
cost
factors
at
the
same
time
can
have
like
a
one
cost
factor
associated
to
private
projects
and
a
cost
factor
associated
to
public
projects.
A
Just
if
we
do
have
more
flexibility,
if
we
want
to
track
public
and
versus
private
projects
differently,
but
then
the
cost
factor
is
like
a
floating
point.
A
Number
could
be
from
1.0
to
from
0.0
to
two
or
three,
even
and
basically
the
multiplying
factor
that
more
like
a
weight
for
the
shared
runners
and
could
be
higher
for
more
costly
runners
like
mac
or
windows,
shared
runners,
it
could
be
cheaper
for
linux,
shared
runners,
for
example,
and
so
we
multiply
this
cost
factor
by
the
duration,
and
that
makes
the
consumption
for
this
job
and
we
add
that
up
to
in
a
specific
ci,
ci
table
and
and
all
the
time.
A
So
if
the
quota
drops
below
30
percent,
then
we
send
a
notification
to
the
to
the
owner
of
the
namespace
saying
that
you
are
running
low
one
minute,
so
you
might
want
to
either
reduce
the
the
consumption
or
purchase
additional
minutes
or
wait
for
the
next
month
until
new
minutes
are
available
or
if,
if
we
have
used
up
all
the
minutes,
we
also
sent
another
notification
saying
that
no
more
jobs
will
be
processed
and
and
then
finally,
that
brings
us
to
the
final
point
of
of
resetting
the
cm
minutes.
A
So
every
month
we
reset
the
consumption
of
cm
minutes
so
that
the
user
can
have
reviews
again
the
the
minutes
associated
to
the
monthly
allowance.
A
But
before
doing
that,
we
actually
recalculate
any
additional
minutes
remaining,
and
for
that,
what
we
do
is
we
if
the
namespace
has
been
using
more
minutes
than
the
monthly
subscription,
but
it
has
also
additional
minutes.
In
that
case,
we
subtract
the
difference
from
the
additional
minutes.
So
to
make
a
quick
example,
if
we
have
an
plan
that
gives
us
1000
minutes
per
month,
and
but
on
top
of
that,
the
customer
has
purchased
400
minutes.
Additionally,
so
we
have
1400
minutes
in
total,
but
the
monthly
consumption
right
before
the
reset
is
1200
minutes.
A
So
we
are
200
minutes
higher
than
the
sub
subscription
plan.
So
we
have
to
reduce
by
200
the
additional
minutes
that
we
have
in
the
upcoming
month.
So
we
reduce
from
400
to
200
so
the
next
month
we
have
200
remaining
additional
minutes.
If
the
consumption
is
lower
than
the
subscription
plan,
then
we
just
leave
and
touch
the
additional
minutes
because
we
haven't
used
those
and
and
just
we
carry
over
as
is
in
the
upcoming
month,
but
then
after
doing
that,
we
reset
the
consumption
to
zero.
A
So
I
hope
that
clarifies
a
lot
of
of
details
about
the
ci
minutes
and
in
an
upcoming
video,
I'm
going
to
go
into
details
about
all
keeping
this
map
as
a
reference
and
go
into
the
code
to
see
where
all
these
parts
are
and
and
we
can
type
more
details
there.
Thank.