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
5bba07f4
Commit
5bba07f4
authored
Sep 15, 2020
by
pburdette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setup boilerplate for ci lint
Setup feature flag and basic boilerplate for moving ci lint to vue.
parent
20687d4c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
97 additions
and
28 deletions
+97
-28
app/assets/javascripts/ci_lint/components/ci_lint.vue
app/assets/javascripts/ci_lint/components/ci_lint.vue
+14
-0
app/assets/javascripts/ci_lint/components/ci_lint_results.vue
...assets/javascripts/ci_lint/components/ci_lint_results.vue
+9
-0
app/assets/javascripts/ci_lint/index.js
app/assets/javascripts/ci_lint/index.js
+18
-0
app/assets/javascripts/pages/projects/ci/lints/new/index.js
app/assets/javascripts/pages/projects/ci/lints/new/index.js
+9
-1
app/controllers/projects/ci/lints_controller.rb
app/controllers/projects/ci/lints_controller.rb
+3
-0
app/views/projects/ci/lints/show.html.haml
app/views/projects/ci/lints/show.html.haml
+31
-27
config/feature_flags/development/ci_lint_vue.yml
config/feature_flags/development/ci_lint_vue.yml
+7
-0
spec/features/projects/ci/lint_spec.rb
spec/features/projects/ci/lint_spec.rb
+3
-0
spec/views/projects/ci/lints/show.html.haml_spec.rb
spec/views/projects/ci/lints/show.html.haml_spec.rb
+3
-0
No files found.
app/assets/javascripts/ci_lint/components/ci_lint.vue
0 → 100644
View file @
5bba07f4
<
script
>
export
default
{
props
:
{
endpoint
:
{
type
:
String
,
required
:
true
,
},
},
};
</
script
>
<
template
><div></div
></
template
>
app/assets/javascripts/ci_lint/components/ci_lint_results.vue
0 → 100644
View file @
5bba07f4
<
script
>
export
default
{
props
:
{},
};
</
script
>
<
template
><div></div
></
template
>
app/assets/javascripts/ci_lint/index.js
0 → 100644
View file @
5bba07f4
import
Vue
from
'
vue
'
;
import
CILint
from
'
./components/ci_lint.vue
'
;
export
default
(
containerId
=
'
#js-ci-lint
'
)
=>
{
const
containerEl
=
document
.
querySelector
(
containerId
);
const
{
endpoint
}
=
containerEl
.
dataset
;
return
new
Vue
({
el
:
containerEl
,
render
(
createElement
)
{
return
createElement
(
CILint
,
{
props
:
{
endpoint
,
},
});
},
});
};
app/assets/javascripts/pages/projects/ci/lints/new/index.js
View file @
5bba07f4
import
CILintEditor
from
'
../ci_lint_editor
'
;
import
initCILint
from
'
~/ci_lint/index
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
new
CILintEditor
());
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
if
(
gon
?.
features
?.
ciLintVue
)
{
initCILint
();
}
else
{
// eslint-disable-next-line no-new
new
CILintEditor
();
}
});
app/controllers/projects/ci/lints_controller.rb
View file @
5bba07f4
...
...
@@ -2,6 +2,9 @@
class
Projects::Ci::LintsController
<
Projects
::
ApplicationController
before_action
:authorize_create_pipeline!
before_action
do
push_frontend_feature_flag
(
:ci_lint_vue
,
project
)
end
def
show
end
...
...
app/views/projects/ci/lints/show.html.haml
View file @
5bba07f4
...
...
@@ -6,31 +6,35 @@
%h2
.pt-3.pb-3
=
_
(
"Validate your GitLab CI configuration"
)
.project-ci-linter
=
form_tag
project_ci_lint_path
(
@project
),
method: :post
,
class:
'js-ci-lint-form'
do
.row
.col-sm-12
.file-holder
.js-file-title.file-title.clearfix
=
_
(
"Contents of .gitlab-ci.yml"
)
-
if
Feature
.
enabled?
(
:monaco_ci
)
.file-editor.code
.js-edit-mode-pane.qa-editor
#editor
{
data:
{
'editor-loading'
:
true
}
}
<
%pre
.editor-loading-content
=
params
[
:content
]
-
else
#ci-editor
.ci-editor
=
@content
=
text_area_tag
(
:content
,
@content
,
class:
'hidden form-control span1'
,
rows:
7
,
require:
true
)
.col-sm-12
.float-left.gl-mt-3
=
submit_tag
(
_
(
'Validate'
),
class:
'btn btn-success submit-yml'
)
-
if
Gitlab
::
Ci
::
Features
.
lint_creates_pipeline_with_dry_run?
(
@project
)
=
check_box_tag
(
:dry_run
,
'true'
,
params
[
:dry_run
])
=
label_tag
(
:dry_run
,
_
(
'Simulate a pipeline created for the default branch'
))
=
link_to
sprite_icon
(
'question-o'
),
help_page_path
(
'ci/lint'
,
anchor:
'pipeline-simulation'
),
target:
'_blank'
,
rel:
'noopener noreferrer'
.float-right.prepend-top-10
=
button_tag
(
_
(
'Clear'
),
type:
'button'
,
class:
'btn btn-default clear-yml'
)
-
if
Feature
.
enabled?
(
:ci_lint_vue
,
@project
)
#js-ci-lint
{
data:
{
endpoint:
project_ci_lint_path
(
@project
)
}
}
.row.prepend-top-20
.col-sm-12
.results.project-ci-template
=
render
partial:
'create'
if
defined?
(
@result
)
-
else
.project-ci-linter
=
form_tag
project_ci_lint_path
(
@project
),
method: :post
,
class:
'js-ci-lint-form'
do
.row
.col-sm-12
.file-holder
.js-file-title.file-title.clearfix
=
_
(
"Contents of .gitlab-ci.yml"
)
-
if
Feature
.
enabled?
(
:monaco_ci
)
.file-editor.code
.js-edit-mode-pane.qa-editor
#editor
{
data:
{
'editor-loading'
:
true
}
}
<
%pre
.editor-loading-content
=
params
[
:content
]
-
else
#ci-editor
.ci-editor
=
@content
=
text_area_tag
(
:content
,
@content
,
class:
'hidden form-control span1'
,
rows:
7
,
require:
true
)
.col-sm-12
.float-left.gl-mt-3
=
submit_tag
(
_
(
'Validate'
),
class:
'btn btn-success submit-yml'
)
-
if
Gitlab
::
Ci
::
Features
.
lint_creates_pipeline_with_dry_run?
(
@project
)
=
check_box_tag
(
:dry_run
,
'true'
,
params
[
:dry_run
])
=
label_tag
(
:dry_run
,
_
(
'Simulate a pipeline created for the default branch'
))
=
link_to
sprite_icon
(
'question-o'
),
help_page_path
(
'ci/lint'
,
anchor:
'pipeline-simulation'
),
target:
'_blank'
,
rel:
'noopener noreferrer'
.float-right.prepend-top-10
=
button_tag
(
_
(
'Clear'
),
type:
'button'
,
class:
'btn btn-default clear-yml'
)
.row.prepend-top-20
.col-sm-12
.results.project-ci-template
=
render
partial:
'create'
if
defined?
(
@result
)
config/feature_flags/development/ci_lint_vue.yml
0 → 100644
View file @
5bba07f4
---
name
:
ci_lint_vue
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/42401
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/249661
group
:
group::continuous intergration
type
:
development
default_enabled
:
false
\ No newline at end of file
spec/features/projects/ci/lint_spec.rb
View file @
5bba07f4
...
...
@@ -12,6 +12,7 @@ RSpec.describe 'CI Lint', :js do
describe
'YAML parsing'
do
shared_examples
'validates the YAML'
do
before
do
stub_feature_flags
(
ci_lint_vue:
false
)
click_on
'Validate'
end
...
...
@@ -86,6 +87,7 @@ RSpec.describe 'CI Lint', :js do
before
do
stub_feature_flags
(
monaco_ci:
false
)
stub_feature_flags
(
ci_lint_vue:
false
)
project
.
add_developer
(
user
)
sign_in
(
user
)
...
...
@@ -107,6 +109,7 @@ RSpec.describe 'CI Lint', :js do
before
do
stub_feature_flags
(
monaco_ci:
true
)
stub_feature_flags
(
ci_lint_vue:
false
)
project
.
add_developer
(
user
)
sign_in
(
user
)
...
...
spec/views/projects/ci/lints/show.html.haml_spec.rb
View file @
5bba07f4
...
...
@@ -13,6 +13,7 @@ RSpec.describe 'projects/ci/lints/show' do
before
do
assign
(
:project
,
project
)
assign
(
:result
,
result
)
stub_feature_flags
(
ci_lint_vue:
false
)
end
context
'when builds attrbiutes contain HTML nodes'
do
...
...
@@ -66,6 +67,7 @@ RSpec.describe 'projects/ci/lints/show' do
before
do
assign
(
:project
,
project
)
assign
(
:result
,
result
)
stub_feature_flags
(
ci_lint_vue:
false
)
end
it
'shows the correct values'
do
...
...
@@ -103,6 +105,7 @@ RSpec.describe 'projects/ci/lints/show' do
assign
(
:project
,
project
)
assign
(
:result
,
result
)
stub_feature_flags
(
ci_lint_vue:
false
)
end
it
'shows error message'
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