Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a6715533
Commit
a6715533
authored
Jan 19, 2022
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add deprecation information to type entry
parent
9d9b78d4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
9 deletions
+22
-9
lib/gitlab/ci/config/entry/job.rb
lib/gitlab/ci/config/entry/job.rb
+5
-1
lib/gitlab/ci/config/entry/root.rb
lib/gitlab/ci/config/entry/root.rb
+3
-1
spec/lib/gitlab/ci/config/entry/root_spec.rb
spec/lib/gitlab/ci/config/entry/root_spec.rb
+8
-4
spec/requests/api/graphql/ci/config_spec.rb
spec/requests/api/graphql/ci/config_spec.rb
+5
-2
spec/requests/api/lint_spec.rb
spec/requests/api/lint_spec.rb
+1
-1
No files found.
lib/gitlab/ci/config/entry/job.rb
View file @
a6715533
...
...
@@ -55,7 +55,8 @@ module Gitlab
entry
:type
,
Entry
::
Stage
,
description:
'Deprecated: stage this job will be executed into.'
,
inherit:
false
inherit:
false
,
deprecation:
{
deprecated:
'9.0'
,
warning:
'14.8'
,
removed:
'15.0'
}
entry
:after_script
,
Entry
::
Script
,
description:
'Commands that will be executed when finishing job.'
,
...
...
@@ -134,8 +135,11 @@ module Gitlab
def
compose!
(
deps
=
nil
)
super
do
# The type keyword will be removed in 15.0:
# https://gitlab.com/gitlab-org/gitlab/-/issues/346823
if
type_defined?
&&
!
stage_defined?
@entries
[
:stage
]
=
@entries
[
:type
]
log_and_warn_deprecated_entry
(
@entries
[
:type
])
end
@entries
.
delete
(
:type
)
...
...
lib/gitlab/ci/config/entry/root.rb
View file @
a6715533
...
...
@@ -60,7 +60,7 @@ module Gitlab
entry
:types
,
Entry
::
Stages
,
description:
'Deprecated: stages for this pipeline.'
,
reserved:
true
,
deprecation:
{
deprecated:
'9.0'
,
warning:
'14.8'
,
removed:
'15.0'
,
documentation:
'https://docs.gitlab.com/ee/ci/yaml/#deprecated-keywords'
}
deprecation:
{
deprecated:
'9.0'
,
warning:
'14.8'
,
removed:
'15.0'
}
entry
:cache
,
Entry
::
Caches
,
description:
'Configure caching between build jobs.'
,
...
...
@@ -122,6 +122,8 @@ module Gitlab
##
# Deprecated `:types` key workaround - if types are defined and
# stages are not defined we use types definition as stages.
# This keyword will be removed in 15.0:
# https://gitlab.com/gitlab-org/gitlab/-/issues/346823
#
if
types_defined?
@entries
[
:stages
]
=
@entries
[
:types
]
unless
stages_defined?
...
...
spec/lib/gitlab/ci/config/entry/root_spec.rb
View file @
a6715533
...
...
@@ -55,13 +55,13 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
}
end
context
'when deprecated types
keyword is
defined'
do
context
'when deprecated types
/type keywords are
defined'
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:hash
)
do
{
types:
%w(test deploy)
,
rspec:
{
script:
'rspec'
}
}
rspec:
{
script:
'rspec'
,
type:
'test'
}
}
end
before
do
...
...
@@ -69,11 +69,15 @@ RSpec.describe Gitlab::Ci::Config::Entry::Root do
end
it
'returns array of types as stages with a warning'
do
expect
(
root
.
jobs_value
[
:rspec
][
:stage
]).
to
eq
'test'
expect
(
root
.
stages_value
).
to
eq
%w[test deploy]
expect
(
root
.
warnings
).
to
match_array
([
"root `types` is deprecated in 9.0 and will be removed in 15.0."
])
expect
(
root
.
warnings
).
to
match_array
([
"root `types` is deprecated in 9.0 and will be removed in 15.0."
,
"jobs:rspec `type` is deprecated in 9.0 and will be removed in 15.0."
])
end
it
'logs usage of
types keyword
'
do
it
'logs usage of
keywords
'
do
expect
(
Gitlab
::
AppJsonLogger
).
to
(
receive
(
:info
)
.
with
(
event:
'ci_used_deprecated_keyword'
,
...
...
spec/requests/api/graphql/ci/config_spec.rb
View file @
a6715533
...
...
@@ -225,7 +225,7 @@ RSpec.describe 'Query.ciConfig' do
context
'when using deprecated keywords'
do
let_it_be
(
:content
)
do
YAML
.
dump
(
rspec:
{
script:
'ls'
},
rspec:
{
script:
'ls'
,
type:
'test'
},
types:
[
'test'
]
)
end
...
...
@@ -233,7 +233,10 @@ RSpec.describe 'Query.ciConfig' do
it
'returns a warning'
do
post_graphql_query
expect
(
graphql_data
[
'ciConfig'
][
'warnings'
]).
to
include
(
'root `types` is deprecated in 9.0 and will be removed in 15.0.'
)
expect
(
graphql_data
[
'ciConfig'
][
'warnings'
]).
to
include
(
'root `types` is deprecated in 9.0 and will be removed in 15.0.'
,
'jobs:rspec `type` is deprecated in 9.0 and will be removed in 15.0.'
)
end
end
...
...
spec/requests/api/lint_spec.rb
View file @
a6715533
...
...
@@ -154,7 +154,7 @@ RSpec.describe API::Lint do
end
context
'with valid .gitlab-ci.yaml using deprecated keywords'
do
let
(
:yaml_content
)
{
{
job:
{
script:
'ls'
},
types:
[
'test'
]
}.
to_yaml
}
let
(
:yaml_content
)
{
{
job:
{
script:
'ls'
,
type:
'test'
},
types:
[
'test'
]
}.
to_yaml
}
it
'passes validation but returns warnings'
do
post
api
(
'/ci/lint'
,
api_user
),
params:
{
content:
yaml_content
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment