summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-06-10 14:13:12 +0300
committerValery Sizov <vsv2711@gmail.com>2015-06-10 14:13:12 +0300
commit3d417bca57656f4eae53f951a0ce14a66b1f179a (patch)
tree74bf75ed6eb2eac1195f151a7d7c4d5ee742f4e4
parent794fbd353ed99ba512e230cb824a7170bc5a25d2 (diff)
downloadgitlab-ci-3d417bca57656f4eae53f951a0ce14a66b1f179a.tar.gz
add links to lint, improve test coverage
-rw-r--r--app/controllers/lints_controller.rb2
-rw-r--r--app/views/lints/show.html.haml2
-rw-r--r--app/views/projects/_form.html.haml4
-rw-r--r--app/views/shared/_guide.html.haml2
-rw-r--r--doc/builds_configuration/README.md10
-rw-r--r--spec/features/lint_spec.rb12
6 files changed, 27 insertions, 5 deletions
diff --git a/app/controllers/lints_controller.rb b/app/controllers/lints_controller.rb
index 2752954..d1b42f6 100644
--- a/app/controllers/lints_controller.rb
+++ b/app/controllers/lints_controller.rb
@@ -1,4 +1,6 @@
class LintsController < ApplicationController
+ before_filter :authenticate_user!
+
def show
end
diff --git a/app/views/lints/show.html.haml b/app/views/lints/show.html.haml
index a3172b3..d105495 100644
--- a/app/views/lints/show.html.haml
+++ b/app/views/lints/show.html.haml
@@ -3,7 +3,7 @@
= form_tag '/lint', method: :post, remote: true do
.control-group
- = label_tag "Content of .gitlab-ci.yml", :content, class: 'control-label'
+ = label_tag :content, "Content of .gitlab-ci.yml", class: 'control-label'
.controls
= text_area_tag :content, nil, class: 'form-control span1', rows: 7, require: true
diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml
index 7f3cc56..e7c1bad 100644
--- a/app/views/projects/_form.html.haml
+++ b/app/views/projects/_form.html.haml
@@ -1,3 +1,7 @@
+.bs-callout.help-callout
+ %p
+ If you want to test your .gitlab-ci.yml, you can use special tool - #{link_to "Lint", lint_path}
+
= nested_form_for @project, html: { class: 'form-horizontal' } do |f|
- if @project.errors.any?
#error_explanation
diff --git a/app/views/shared/_guide.html.haml b/app/views/shared/_guide.html.haml
index a1709dd..8a3f663 100644
--- a/app/views/shared/_guide.html.haml
+++ b/app/views/shared/_guide.html.haml
@@ -6,7 +6,7 @@
Add at least one runner to the project.
Go to #{link_to 'Runners page', project_runners_path(@project), target: :blank} for instructions.
%li
- Put the .gitlab-ci.yml in the root of your repository. Examples can be found in #{link_to "Configuraton of your builds with .gitlab-ci.yml", "http://doc.gitlab.com/ci/builds_configuration/README.html", target: :blank}
+ Put the .gitlab-ci.yml in the root of your repository. Examples can be found in #{link_to "Configuraton of your builds with .gitlab-ci.yml", "http://doc.gitlab.com/ci/builds_configuration/README.html", target: :blank}. You can also test your .gitlab-ci.yml in the #{link_to "Lint", lint_path}
%li
Visit #{link_to 'GitLab project settings', @project.gitlab_url + "/services/gitlab_ci/edit", target: :blank}
and press the "Test settings" button.
diff --git a/doc/builds_configuration/README.md b/doc/builds_configuration/README.md
index 2fca14b..06c2c8e 100644
--- a/doc/builds_configuration/README.md
+++ b/doc/builds_configuration/README.md
@@ -58,7 +58,7 @@ jobs:
```
In this way, the name of the build will be taken from command line.
-## deploy_jobs
+### deploy_jobs
Deploy Jobs that will be run when all other jobs have succeeded. Define them using a hash:
```yaml
@@ -80,5 +80,9 @@ deploy_jobs:
- "bundle exec cap deploy"
```
-## before_script
-`before_script` is used to define the command that should be ran before all builds, including deploy builds. This can be an array or a multiline string. \ No newline at end of file
+### before_script
+`before_script` is used to define the command that should be ran before all builds, including deploy builds. This can be an array or a multiline string.
+
+## Debugging of your builds with .gitlab-ci.yml
+
+Each instance of GitLab CI has an embeded debug tool Lint. You can find link to the Lint in the projects settings page or use short url `/lint`.
diff --git a/spec/features/lint_spec.rb b/spec/features/lint_spec.rb
index 9e68d9e..4a1ea26 100644
--- a/spec/features/lint_spec.rb
+++ b/spec/features/lint_spec.rb
@@ -1,6 +1,10 @@
require 'spec_helper'
describe "Lint" do
+ before do
+ login_as :user
+ end
+
it "Yaml parsing", js: true do
content = File.read(Rails.root.join('spec/support/gitlab_stubs/gitlab_ci.yml'))
visit lint_path
@@ -14,4 +18,12 @@ describe "Lint" do
page.should have_content("Deploy Job - Deploy to staging")
end
end
+
+ it "Yaml parsing with error", js: true do
+ visit lint_path
+ fill_in "content", with: ""
+ click_on "Validate"
+ page.should have_content("Status: syntax is incorrect")
+ page.should have_content("Error: Please provide content of your file")
+ end
end