summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-11-10 21:28:12 +0000
committerStan Hu <stanhu@gmail.com>2015-11-10 21:28:12 +0000
commit83ec84946ca8b0b71ae201de65991635c50dd518 (patch)
treec0ef2d419c21b37f28fec8fa0d07cb687bddd3f5
parentca25289b78e1b49148438831ad6bf165fa0ce56e (diff)
parent91cbf9db0c5c95381e7d422fd684e623d58fadab (diff)
downloadgitlab-ce-83ec84946ca8b0b71ae201de65991635c50dd518.tar.gz
Merge branch 'add-allow-failure-status' into 'master'
Add allow_failure field to commit status API Closes #3196 See merge request !1685
-rw-r--r--CHANGELOG1
-rw-r--r--doc/api/commits.md6
-rw-r--r--lib/api/entities.rb2
-rw-r--r--spec/requests/api/commit_status_spec.rb4
4 files changed, 9 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 9cfcd23a9fc..74d94a8ce4a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@ v 8.2.0 (unreleased)
- Added a GitLab specific profiling tool called "Sherlock" (see GitLab CE merge request #1749)
- Upgrade gitlab_git to 7.2.20 and rugged to 0.23.3 (Stan Hu)
- Improved performance of finding users by one of their Email addresses
+ - Add allow_failure field to commit status API (Stan Hu)
- Improved performance of replacing references in comments
- Show last project commit to default branch on project home page
- Highlight comment based on anchor in URL
diff --git a/doc/api/commits.md b/doc/api/commits.md
index 9f72adc6ed9..8e4a0ee1b82 100644
--- a/doc/api/commits.md
+++ b/doc/api/commits.md
@@ -22,7 +22,8 @@ Parameters:
"author_name": "Dmitriy Zaporozhets",
"author_email": "dzaporozhets@sphereconsultinginc.com",
"created_at": "2012-09-20T11:50:22+03:00",
- "message": "Replace sanitize with escape once"
+ "message": "Replace sanitize with escape once",
+ "allow_failure": false
},
{
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
@@ -31,7 +32,8 @@ Parameters:
"author_name": "randx",
"author_email": "dmitriy.zaporozhets@gmail.com",
"created_at": "2012-09-20T09:06:12+03:00",
- "message": "Sanitize for network graph"
+ "message": "Sanitize for network graph",
+ "allow_failure": false
}
]
```
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 883a5e14b17..20cadae2291 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -231,7 +231,7 @@ module API
class CommitStatus < Grape::Entity
expose :id, :sha, :ref, :status, :name, :target_url, :description,
- :created_at, :started_at, :finished_at
+ :created_at, :started_at, :finished_at, :allow_failure
expose :author, using: Entities::UserBasic
end
diff --git a/spec/requests/api/commit_status_spec.rb b/spec/requests/api/commit_status_spec.rb
index b9e6dfc15a7..a28607bd240 100644
--- a/spec/requests/api/commit_status_spec.rb
+++ b/spec/requests/api/commit_status_spec.rb
@@ -18,7 +18,7 @@ describe API::API, api: true do
before do
@status1 = create(:commit_status, commit: ci_commit, status: 'running')
@status2 = create(:commit_status, commit: ci_commit, name: 'coverage', status: 'pending')
- @status3 = create(:commit_status, commit: ci_commit, name: 'coverage', ref: 'develop', status: 'running')
+ @status3 = create(:commit_status, commit: ci_commit, name: 'coverage', ref: 'develop', status: 'running', allow_failure: true)
@status4 = create(:commit_status, commit: ci_commit, name: 'coverage', status: 'success')
@status5 = create(:commit_status, commit: ci_commit, ref: 'develop', status: 'success')
@status6 = create(:commit_status, commit: ci_commit, status: 'success')
@@ -30,6 +30,8 @@ describe API::API, api: true do
expect(json_response).to be_an Array
expect(statuses_id).to contain_exactly(@status3.id, @status4.id, @status5.id, @status6.id)
+ json_response.sort_by!{ |status| status['id'] }
+ expect(json_response.map{ |status| status['allow_failure'] }).to eq([true, false, false, false])
end
it "should return all commit statuses" do