2015-09-25 12:07:36 +05:30
|
|
|
module Ci
|
|
|
|
module API
|
|
|
|
module Entities
|
|
|
|
class Commit < Grape::Entity
|
2015-10-24 18:46:33 +05:30
|
|
|
expose :id, :sha, :project_id, :created_at
|
2015-09-25 12:07:36 +05:30
|
|
|
expose :status, :finished_at, :duration
|
|
|
|
expose :git_commit_message, :git_author_name, :git_author_email
|
|
|
|
end
|
|
|
|
|
|
|
|
class CommitWithBuilds < Commit
|
|
|
|
expose :builds
|
|
|
|
end
|
|
|
|
|
2015-11-26 14:37:03 +05:30
|
|
|
class ArtifactFile < Grape::Entity
|
|
|
|
expose :filename, :size
|
|
|
|
end
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
class BuildOptions < Grape::Entity
|
|
|
|
expose :image
|
|
|
|
expose :services
|
|
|
|
expose :artifacts
|
|
|
|
expose :cache
|
|
|
|
expose :dependencies
|
|
|
|
expose :after_script
|
|
|
|
end
|
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
class Build < Grape::Entity
|
2016-01-19 16:12:03 +05:30
|
|
|
expose :id, :ref, :tag, :sha, :status
|
2015-11-26 14:37:03 +05:30
|
|
|
expose :name, :token, :stage
|
2016-01-19 16:12:03 +05:30
|
|
|
expose :project_id
|
|
|
|
expose :project_name
|
2016-06-16 23:09:34 +05:30
|
|
|
expose :artifacts_file, using: ArtifactFile, if: ->(build, _) { build.artifacts? }
|
2016-01-19 16:12:03 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
class BuildCredentials < Grape::Entity
|
|
|
|
expose :type, :url, :username, :password
|
|
|
|
end
|
|
|
|
|
2016-01-19 16:12:03 +05:30
|
|
|
class BuildDetails < Build
|
|
|
|
expose :commands
|
|
|
|
expose :repo_url
|
|
|
|
expose :before_sha
|
|
|
|
expose :allow_git_fetch
|
|
|
|
expose :token
|
2016-06-16 23:09:34 +05:30
|
|
|
expose :artifacts_expire_at, if: ->(build, _) { build.artifacts? }
|
2015-11-26 14:37:03 +05:30
|
|
|
|
2015-09-25 12:07:36 +05:30
|
|
|
expose :options do |model|
|
|
|
|
model.options
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :timeout do |model|
|
|
|
|
model.timeout
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :variables
|
2016-01-19 16:12:03 +05:30
|
|
|
expose :depends_on_builds, using: Build
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
expose :credentials, using: BuildCredentials
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
class Runner < Grape::Entity
|
|
|
|
expose :id, :token
|
|
|
|
end
|
|
|
|
|
|
|
|
class RunnerProject < Grape::Entity
|
|
|
|
expose :id, :project_id, :runner_id
|
|
|
|
end
|
|
|
|
|
|
|
|
class WebHook < Grape::Entity
|
|
|
|
expose :id, :project_id, :url
|
|
|
|
end
|
|
|
|
|
|
|
|
class TriggerRequest < Grape::Entity
|
|
|
|
expose :id, :variables
|
2016-06-16 23:09:34 +05:30
|
|
|
expose :pipeline, using: Commit, as: :commit
|
2015-09-25 12:07:36 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|