Skip to content
Snippets Groups Projects
Commit 13aef532 authored by Tomasz Maczukin's avatar Tomasz Maczukin
Browse files

Modify commits API CI data, add CI data to merge_request API

parent 69bffa16
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -10,6 +10,8 @@ class Commit
attr_mentionable :safe_message, pipeline: :single_line
participant :author, :committer, :notes
 
delegate :duration, :started_at, :finished_at, :coverage, to: :ci_commit
attr_accessor :project
 
# Safe amount of changes (files and lines) in one commit to render
Loading
Loading
@@ -211,12 +213,6 @@ class Commit
project.ci_commit(sha) if project
end
 
def last_build
commit = ci_commit
return unless commit
commit.builds.order('id DESC').first
end
def status
ci_commit.try(:status) || :not_found
end
Loading
Loading
Loading
Loading
@@ -23,21 +23,7 @@ Parameters:
"author_email": "dzaporozhets@sphereconsultinginc.com",
"created_at": "2012-09-20T11:50:22+03:00",
"message": "Replace sanitize with escape once",
"allow_failure": false,
"last_build": {
"allow_failure": false,
"coverage": null,
"created_at": "2016-01-05T15:33:25.936Z",
"deploy": false,
"description": null,
"finished_at": "2016-01-05T15:33:47.553Z",
"id": 66,
"name": "rubocop",
"stage": "test",
"started_at": null,
"status": "canceled",
"target_url": "http://gitlab.dev/root/gitlab-ce/builds/66"
}
"allow_failure": false
},
{
"id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
Loading
Loading
@@ -47,8 +33,7 @@ Parameters:
"author_email": "dmitriy.zaporozhets@gmail.com",
"created_at": "2012-09-20T09:06:12+03:00",
"message": "Sanitize for network graph",
"allow_failure": false,
"last_build": null
"allow_failure": false
}
]
```
Loading
Loading
@@ -81,21 +66,10 @@ Parameters:
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"status": "running",
last_build: {
"allow_failure": false,
"commands": "./scripts/prepare_build.sh\nruby -v\nwhich ruby\ngem install bundler --no-ri --no-rdoc\ncp config/gitlab.yml.example config/gitlab.yml\ntouch log/application.log\ntouch log/test.log\nbundle install --without postgres production --jobs $(nproc) \"${FLAGS[@]}\"\nbundle exec rake db:create RAILS_ENV=test\nbundle exec rubocop",
"coverage": null,
"created_at": "2016-01-05T15:33:25.936Z",
"deploy": false,
"description": null,
"finished_at": "2016-01-05T15:33:47.553Z",
"id": 66,
"name": "rubocop",
"stage": "test",
"started_at": null,
"status": "canceled",
"target_url": "http://gitlab.dev/root/gitlab-ce/builds/66"
}
"coverage": null,
"duration": 2,
"started_at": "2015-12-24T17:54:09.744Z",
"finished_at": "2016-01-11T10:14:09.526Z"
}
```
 
Loading
Loading
Loading
Loading
@@ -50,7 +50,8 @@ Parameters:
"created_at": "2012-04-29T08:46:00Z"
},
"description":"fixed login page css paddings",
"work_in_progress": false
"work_in_progress": false,
"status": "pending"
}
]
```
Loading
Loading
@@ -96,7 +97,8 @@ Parameters:
"created_at": "2012-04-29T08:46:00Z"
},
"description":"fixed login page css paddings",
"work_in_progress": false
"work_in_progress": false,
"status": "pending"
}
```
 
Loading
Loading
@@ -204,7 +206,8 @@ Parameters:
"renamed_file": false,
"deleted_file": false
}
]
],
"status": "pending"
}
```
 
Loading
Loading
@@ -252,7 +255,8 @@ Parameters:
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
},
"description":"fixed login page css paddings"
"description":"fixed login page css paddings",
"status": "pending"
}
```
 
Loading
Loading
@@ -303,7 +307,8 @@ Parameters:
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
}
},
"status": "pending"
}
```
 
Loading
Loading
@@ -359,7 +364,8 @@ Parameters:
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
}
},
"status": "pending"
}
```
 
Loading
Loading
Loading
Loading
@@ -126,35 +126,15 @@ module API
end
end
 
class RepoCommitBuild < Grape::Entity
expose :id
expose :name
expose :description
expose :stage
expose :coverage
expose :status
expose :allow_failure
expose :deploy
expose :created_at
expose :started_at
expose :finished_at
expose :target_url
end
class RepoCommitDetailBuild < RepoCommitBuild
expose :commands
end
class RepoCommit < Grape::Entity
expose :id, :short_id, :title, :author_name, :author_email, :created_at
expose :safe_message, as: :message
expose :last_build, with: Entities::RepoCommitBuild
end
 
class RepoCommitDetail < RepoCommit
expose :parent_ids, :committed_date, :authored_date
expose :status
expose :last_build, with: Entities::RepoCommitDetailBuild
expose :started_at, :finished_at, :duration, :coverage
end
 
class ProjectSnippet < Grape::Entity
Loading
Loading
@@ -185,6 +165,12 @@ module API
expose :assignee, :author, using: Entities::UserBasic
end
 
class CommitStatus < Grape::Entity
expose :id, :sha, :ref, :status, :name, :target_url, :description,
:created_at, :started_at, :finished_at, :allow_failure
expose :author, using: Entities::UserBasic
end
class MergeRequest < ProjectEntity
expose :target_branch, :source_branch
expose :upvotes, :downvotes
Loading
Loading
@@ -195,6 +181,11 @@ module API
expose :work_in_progress?, as: :work_in_progress
expose :milestone, using: Entities::Milestone
expose :merge_when_build_succeeds
expose :status do |repo_obj, _options|
if repo_obj.respond_to?(:ci_commit)
repo_obj.ci_commit.status if repo_obj.ci_commit
end
end
end
 
class MergeRequestChanges < MergeRequest
Loading
Loading
@@ -238,12 +229,6 @@ module API
expose :created_at
end
 
class CommitStatus < Grape::Entity
expose :id, :sha, :ref, :status, :name, :target_url, :description,
:created_at, :started_at, :finished_at, :allow_failure
expose :author, using: Entities::UserBasic
end
class Event < Grape::Entity
expose :title, :project_id, :action_name
expose :target_id, :target_type, :author_id
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment