►
A
Hi
everyone-
this
will
be
a
short
demo
for
the
new
environment,
prepared
keywords
in
gitlab
ci.
So,
let's
start
with
the
ci
file.
I
just
created
this
project
from
scratch.
A
couple
minutes
ago.
A
It
basically
uses
a
very
familiar
pattern
to
everyone
today.
We
only
have
three
stages:
test,
build
and
deploy,
and
what
we
want
to
do
is
we
want
to
use
some
environment
variables
inside
gitlab,
so
environment
variables
is
variables
only
available
to
jobs,
deploy
into
certain
environment,
but,
let's
say
for
some
reason:
we
want
to
use
environment
variable
not
only
for
deploying
jobs,
but
only
for
or
but
also
for
building
jobs
for
the
job
which,
let's
say,
builds
a
docker
image,
or
something
like
that.
So
all
these
three
jobs
are
very
similar.
A
They
are
showing
this
secret
variable
and
just
saying
what
they
do
right
and
also
in
order
to
make
this
variable
do
so
like
be
present
in
the
job
we
use
environment
keyboard
inside
the
build
and
inside
deploy
jobs.
A
So
let's
see
how
it
actually
works
right.
I
will
duplicate
this.
A
Since
this
project
just
was
created,
the
pipeline
also
was
run
a
couple
of
minutes
ago
right.
So
the
first
stage
is
test
and
as
we
see,
our
staging
secret
is
empty
here
and
if
we
go
to
the
building
and
deploying
jobs,
I
will
just
go
to
only
to
build
job
to
demonstrate.
This
secret
station
is
present
and
it
looks
like
we
achieved
what
we
wanted
to.
A
But
there
is
a
problem:
let's
go
to
the
environments
yeah
and
if
we
go
to
the
environment
view,
we
see
that
gitlab
thinks
that
we
actually
deployed
to
the
this
environment
twice
in
the
pipeline
over
the
a
few
seconds.
A
So
why
is
that?
Basically,
every
time
you
specify
the
environment
keyboard
inside
the
gitlab
ti
gitlab
thinks
that
this
job
deploys
to
environment
and
yeah.
This
is
just
a
little
annoying
to
have
a
couple
jobs
here,
but
it
also
actually
breaks
the
workflow.
Gitlab
has
a
feature
which
allows
you
to
stop
old
deployment,
jobs
from
executing
and
overriding
your
newly
deployed
deployed
environment.
A
A
If
you
set
the
settings
right
and
in
this
particular
case,
if
you
held,
have
a
build
job,
it
can
actually
cancel
the
older
deployment
job
and
nothing
will
be
deployed
until
the
newer
deployment
will
run,
which
is
far
from
ideal
right
and
also,
if
you
have
multiple
jobs
and
accessing
environment
variables,
they
also
they
all
can
cancel
each
other
in
weird
ways.
So
obviously
you
don't
want
to
do.
A
Don't
want
this
right,
so
what
you
can
do
in
the
newer
version
of
the
gitlab,
you
can
say
that
this
environment
is
not
deploying
something
it's
just
preparing
environment
right
and
if
I
commit
this,
let's
commit
directly
to
master
just
to
speed
up
things.
Let's
go
to
the
pipeline.
A
So,
let's
look
at
the
testing
job,
as
you
see,
nothing
printed
still
bill.
Job
still
have
has
access
to
the
station
secret
as
well
as
sorry,
new,
second,
okay,
yeah
and
also
the
deployment
job
also
has
this
access
to
this
secret.
I
will
just
briefly
open
it
yeah.
So
let's
go
to
the
environment
one
more
time.
A
So
this
is
our
staging
environment.
It
was
updated
25
seconds
ago
and,
as
you
see
now,
we
only
have
one
successful
deployment
to
the
environment
and
also
since
deployment
isn't
created.
Gitlab
will
not
prevent
this
build
job.
A
They
will
not
be
cancelled
by
a
newer
deployment
job
and
they
will
not
cancel
any
other
jobs,
so
they
just
prepare
preparing
environments,
they
have
access
to
environment
variables,
but
they
are
not
subject
to
this
conciliation
behavior,
and
this
way
you
can
just
annotate
that
this
job
is
preparing
something
but
not
actually
deploying
anywhere
and
your
environment
view
will
be
better
shorter
and
actually
more
true,
right,
yeah,
and
if
you
have
any
notifications
about
deployments,
they
also
will
not
be
duplicated.