summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarzyna Kobierska <kkobierska@gmail.com>2016-09-07 12:19:36 +0200
committerKatarzyna Kobierska <kkobierska@gmail.com>2016-09-07 12:19:36 +0200
commitdac4c5bb5389b123a046d0e861443e124dc0e059 (patch)
treec62e3d5ebfd6ce77bf4657f27962bf845d119977
parent99d7b3ea0c7b97820ee25f12c4b77acc676a72b7 (diff)
downloadgitlab-ce-dac4c5bb5389b123a046d0e861443e124dc0e059.tar.gz
Fix invalid curl command
-rw-r--r--doc/api/ci/lint.md41
-rw-r--r--lib/api/lint.rb9
-rw-r--r--spec/lib/ci/gitlab_ci_yaml_processor_spec.rb2
3 files changed, 8 insertions, 44 deletions
diff --git a/doc/api/ci/lint.md b/doc/api/ci/lint.md
index 89eafad740c..080bc2148f3 100644
--- a/doc/api/ci/lint.md
+++ b/doc/api/ci/lint.md
@@ -10,47 +10,10 @@ POST ci/lint
| Attribute | Type | Required | Description |
| ---------- | ------- | -------- | -------- |
-| `content` | hash | yes | the .gitlab-ci.yaml content|
+| `content` | string | yes | the .gitlab-ci.yaml content|
```bash
-curl --request POST "https://gitlab.example.com/api/v3/ci/lint?content={
- image: "ruby:2.1",
- services: ["postgres"],
- before_script: ["gem install bundler", "bundle install", "bundle exec rake db:create"],
- variables: {"DB_NAME": "postgres"},
- types: ["test", "deploy", "notify"],
- rspec: {
- script: "rake spec",
- tags: ["ruby", "postgres"],
- only: ["branches"]
- },
- spinach: {
- script: "rake spinach",
- allow_failure: true,
- tags: ["ruby", "mysql"],
- except: ["tags"]
- },
- staging: {
- variables: {KEY1: "value1", KEY2: "value2"},
- script: "cap deploy stating",
- type: "deploy",
- tags: ["ruby", "mysql"],
- except: ["stable"]
- },
- production: {
- variables: {DB_NAME: "mysql"},
- type: "deploy",
- script: ["cap deploy production", "cap notify"],
- tags: ["ruby", "mysql"],
- only: ["master", "/^deploy-.*$/"]
- },
- dockerhub: {
- type: "notify",
- script: "curl http://dockerhub/URL",
- tags: ["ruby", "postgres"],
- only: ["branches"]
- }
-}"
+curl -H "Content-Type: application/json" --request POST https://gitlab.example.com/api/v3/ci/lint -d '{"content": "{ \"image\": \"ruby:2.1\", \"services\": [\"postgres\"], \"before_script\": [\"gem install bundler\", \"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}"}'
```
Be sure to copy paste the exact contents of `.gitlab-ci.yml` as YAML is very picky about indentation and spaces.
diff --git a/lib/api/lint.rb b/lib/api/lint.rb
index 0af132803ba..8a7ced2d34d 100644
--- a/lib/api/lint.rb
+++ b/lib/api/lint.rb
@@ -1,11 +1,12 @@
module API
class Lint < Grape::API
- desc 'Validation of .gitlab-ci.yml content'
- params do
- requires :content, type: String, desc: 'Content of .gitlab-ci.yml'
- end
namespace :ci do
+ desc 'Validation of .gitlab-ci.yml content'
+ params do
+ requires :content, type: String, desc: 'Content of .gitlab-ci.yml'
+ end
+
post '/lint' do
error = Ci::GitlabCiYamlProcessor.validation_message(params[:content])
diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
index 43631070024..af192664b33 100644
--- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
@@ -1270,7 +1270,7 @@ EOT
end
end
- context "when YMAL content is empty" do
+ context "when YAML content is empty" do
it "returns an error about missing content" do
expect(GitlabCiYamlProcessor.validation_message(''))
.to eq "Please provide content of .gitlab-ci.yml"