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
f774624c
Commit
f774624c
authored
Feb 15, 2021
by
lauraMon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makes merged_yaml return deep stringified keys
* Also updates specs
parent
cfe70265
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
9 deletions
+14
-9
changelogs/unreleased/lm-deep-stringify-merged-yaml.yml
changelogs/unreleased/lm-deep-stringify-merged-yaml.yml
+5
-0
lib/gitlab/ci/yaml_processor/result.rb
lib/gitlab/ci/yaml_processor/result.rb
+1
-1
spec/lib/gitlab/ci/lint_spec.rb
spec/lib/gitlab/ci/lint_spec.rb
+1
-1
spec/lib/gitlab/ci/yaml_processor/result_spec.rb
spec/lib/gitlab/ci/yaml_processor/result_spec.rb
+1
-1
spec/requests/api/lint_spec.rb
spec/requests/api/lint_spec.rb
+6
-6
No files found.
changelogs/unreleased/lm-deep-stringify-merged-yaml.yml
0 → 100644
View file @
f774624c
---
title
:
Returns deep stringified keys for merged_yaml in linting endpoint
merge_request
:
54336
author
:
type
:
changed
lib/gitlab/ci/yaml_processor/result.rb
View file @
f774624c
...
...
@@ -101,7 +101,7 @@ module Gitlab
end
def
merged_yaml
@ci_config
&
.
to_hash
&
.
to_yaml
@ci_config
&
.
to_hash
&
.
deep_stringify_keys
.
to_yaml
end
def
variables_with_data
...
...
spec/lib/gitlab/ci/lint_spec.rb
View file @
f774624c
...
...
@@ -92,7 +92,7 @@ RSpec.describe Gitlab::Ci::Lint do
it
'sets merged_config'
do
root_config
=
YAML
.
safe_load
(
content
,
[
Symbol
])
included_config
=
YAML
.
safe_load
(
included_content
,
[
Symbol
])
expected_config
=
included_config
.
merge
(
root_config
).
except
(
:include
)
expected_config
=
included_config
.
merge
(
root_config
).
except
(
:include
)
.
deep_stringify_keys
expect
(
subject
.
merged_yaml
).
to
eq
(
expected_config
.
to_yaml
)
end
...
...
spec/lib/gitlab/ci/yaml_processor/result_spec.rb
View file @
f774624c
...
...
@@ -24,7 +24,7 @@ module Gitlab
let
(
:included_yml
)
do
YAML
.
dump
(
another_test:
{
stage:
'test'
,
script:
'echo 2'
}
{
another_test:
{
stage:
'test'
,
script:
'echo 2'
}
}.
deep_stringify_keys
)
end
...
...
spec/requests/api/lint_spec.rb
View file @
f774624c
...
...
@@ -166,7 +166,7 @@ RSpec.describe API::Lint do
included_config
=
YAML
.
safe_load
(
included_content
,
[
Symbol
])
root_config
=
YAML
.
safe_load
(
yaml_content
,
[
Symbol
])
expected_yaml
=
included_config
.
merge
(
root_config
).
except
(
:include
).
to_yaml
expected_yaml
=
included_config
.
merge
(
root_config
).
except
(
:include
).
deep_stringify_keys
.
to_yaml
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_an
Hash
...
...
@@ -246,7 +246,7 @@ RSpec.describe API::Lint do
let
(
:dry_run
)
{
false
}
let
(
:included_content
)
do
{
another_test:
{
stage:
'test'
,
script:
'echo 1'
}
}.
to_yaml
{
another_test:
{
stage:
'test'
,
script:
'echo 1'
}
}.
deep_stringify_keys
.
to_yaml
end
before
do
...
...
@@ -299,7 +299,7 @@ RSpec.describe API::Lint do
end
let
(
:included_content
)
do
{
another_test:
{
stage:
'test'
,
script:
'echo 1'
}
}.
to_yaml
{
another_test:
{
stage:
'test'
,
script:
'echo 1'
}
}.
deep_stringify_keys
.
to_yaml
end
before
do
...
...
@@ -341,7 +341,7 @@ RSpec.describe API::Lint do
context
'with invalid .gitlab-ci.yml content'
do
let
(
:yaml_content
)
do
{
image:
'ruby:2.7'
,
services:
[
'postgres'
]
}.
to_yaml
{
image:
'ruby:2.7'
,
services:
[
'postgres'
]
}.
deep_stringify_keys
.
to_yaml
end
before
do
...
...
@@ -385,7 +385,7 @@ RSpec.describe API::Lint do
included_config
=
YAML
.
safe_load
(
included_content
,
[
Symbol
])
root_config
=
YAML
.
safe_load
(
yaml_content
,
[
Symbol
])
expected_yaml
=
included_config
.
merge
(
root_config
).
except
(
:include
).
to_yaml
expected_yaml
=
included_config
.
merge
(
root_config
).
except
(
:include
).
deep_stringify_keys
.
to_yaml
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
).
to
be_an
Hash
...
...
@@ -539,7 +539,7 @@ RSpec.describe API::Lint do
context
'with invalid .gitlab-ci.yml content'
do
let
(
:yaml_content
)
do
{
image:
'ruby:2.7'
,
services:
[
'postgres'
]
}.
to_yaml
{
image:
'ruby:2.7'
,
services:
[
'postgres'
]
}.
deep_stringify_keys
.
to_yaml
end
context
'when running as dry run'
do
...
...
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