Commit 342cd36c authored by Pedro Pombeiro's avatar Pedro Pombeiro

Add is_shared and runner_type to hooks and API responses

Changelog: added
parent c9a19a21
......@@ -5,10 +5,10 @@ module Types
class RunnerTypeEnum < BaseEnum
graphql_name 'CiRunnerType'
::Ci::Runner.runner_types.keys.each do |type|
value type.upcase,
description: "A runner that is #{type.tr('_', ' ')}.",
value: type
::Ci::Runner::AVAILABLE_TYPES.each do |runner_type|
value runner_type.upcase,
description: "A runner that is #{runner_type.tr('_', ' ')}.",
value: runner_type
end
end
end
......
......@@ -62,8 +62,9 @@ Example response:
"active": true,
"description": "test-1-20150125",
"id": 6,
"is_shared": false,
"ip_address": "127.0.0.1",
"is_shared": false,
"runner_type": "project_type",
"name": null,
"online": true,
"status": "online"
......@@ -74,6 +75,7 @@ Example response:
"id": 8,
"ip_address": "127.0.0.1",
"is_shared": false,
"runner_type": "group_type",
"name": null,
"online": false,
"status": "offline"
......@@ -115,6 +117,7 @@ Example response:
"id": 1,
"ip_address": "127.0.0.1",
"is_shared": true,
"runner_type": "instance_type",
"name": null,
"online": true,
"status": "online"
......@@ -125,6 +128,7 @@ Example response:
"id": 3,
"ip_address": "127.0.0.1",
"is_shared": true,
"runner_type": "instance_type",
"name": null,
"online": false,
"status": "offline"
......@@ -135,6 +139,7 @@ Example response:
"id": 6,
"ip_address": "127.0.0.1",
"is_shared": false,
"runner_type": "project_type",
"name": null,
"online": true,
"status": "paused"
......@@ -145,6 +150,7 @@ Example response:
"id": 8,
"ip_address": "127.0.0.1",
"is_shared": false,
"runner_type": "group_type",
"name": null,
"online": false,
"status": "offline"
......@@ -187,6 +193,7 @@ Example response:
"id": 6,
"ip_address": "127.0.0.1",
"is_shared": false,
"runner_type": "project_type",
"contacted_at": "2016-01-25T16:39:48.066Z",
"name": null,
"online": true,
......@@ -250,6 +257,7 @@ Example response:
"id": 6,
"ip_address": "127.0.0.1",
"is_shared": false,
"runner_type": "group_type",
"contacted_at": "2016-01-25T16:39:48.066Z",
"name": null,
"online": true,
......@@ -420,6 +428,7 @@ Example response:
"id": 8,
"ip_address": "127.0.0.1",
"is_shared": false,
"runner_type": "project_type",
"name": null,
"online": false,
"status": "offline"
......@@ -430,6 +439,7 @@ Example response:
"id": 5,
"ip_address": "127.0.0.1",
"is_shared": true,
"runner_type": "instance_type",
"name": null,
"online": true,
"status": "paused"
......@@ -464,6 +474,7 @@ Example response:
"id": 9,
"ip_address": "127.0.0.1",
"is_shared": false,
"runner_type": "project_type",
"name": null,
"online": true,
"status": "online"
......@@ -522,6 +533,7 @@ Example response:
"ip_address": "127.0.0.1",
"active": true,
"is_shared": true,
"runner_type": "instance_type",
"name": "gitlab-runner",
"online": null,
"status": "not_connected"
......@@ -532,6 +544,7 @@ Example response:
"ip_address": "127.0.0.1",
"active": true,
"is_shared": true,
"runner_type": "instance_type",
"name": "gitlab-runner",
"online": false,
"status": "offline"
......@@ -542,6 +555,7 @@ Example response:
"ip_address": "127.0.0.1",
"active": true,
"is_shared": false,
"runner_type": "group_type",
"name": "gitlab-runner",
"online": null,
"status": "not_connected"
......
......@@ -1161,6 +1161,7 @@ X-Gitlab-Event: Pipeline Hook
"id": 380987,
"description": "shared-runners-manager-6.gitlab.com",
"active": true,
"runner_type": "instance_type",
"is_shared": true,
"tags": [
"linux",
......@@ -1196,7 +1197,8 @@ X-Gitlab-Event: Pipeline Hook
"id":380987,
"description":"shared-runners-manager-6.gitlab.com",
"active":true,
"is_shared":true,
"runner_type": "instance_type",
"is_shared": true,
"tags": [
"linux",
"docker"
......@@ -1230,6 +1232,7 @@ X-Gitlab-Event: Pipeline Hook
"id": 380987,
"description": "shared-runners-manager-6.gitlab.com",
"active": true,
"runner_type": "instance_type",
"is_shared": true,
"tags": [
"linux",
......@@ -1333,6 +1336,7 @@ X-Gitlab-Event: Job Hook
},
"runner": {
"active": true,
"runner_type": "project_type",
"is_shared": false,
"id": 380987,
"description": "shared-runners-manager-6.gitlab.com",
......
......@@ -8,6 +8,7 @@ module API
expose :ip_address
expose :active
expose :instance_type?, as: :is_shared
expose :runner_type
expose :name
expose :online?, as: :online
expose :status
......
......@@ -83,7 +83,9 @@ module Gitlab
{
id: runner.id,
description: runner.description,
runner_type: runner.runner_type,
active: runner.active?,
is_shared: runner.instance_type?,
tags: runner.tags&.map(&:name)
}
end
......
......@@ -79,7 +79,9 @@ module Gitlab
{
id: runner.id,
description: runner.description,
runner_type: runner.runner_type,
active: runner.active?,
is_shared: runner.instance_type?,
tags: runner.tags&.map(&:name)
}
end
......
......@@ -47,6 +47,8 @@ RSpec.describe Gitlab::DataBuilder::Build do
it { expect(data[:runner][:id]).to eq(build.runner.id) }
it { expect(data[:runner][:tags]).to match_array(tag_names) }
it { expect(data[:runner][:description]).to eq(build.runner.description) }
it { expect(data[:runner][:runner_type]).to eq(build.runner.runner_type) }
it { expect(data[:runner][:is_shared]).to eq(build.runner.instance_type?) }
it { expect(data[:environment]).to be_nil }
context 'commit author_url' do
......
......@@ -58,8 +58,10 @@ RSpec.describe Gitlab::DataBuilder::Pipeline do
it 'has runner attributes', :aggregate_failures do
expect(runner_data[:id]).to eq(ci_runner.id)
expect(runner_data[:description]).to eq(ci_runner.description)
expect(runner_data[:runner_type]).to eq(ci_runner.runner_type)
expect(runner_data[:active]).to eq(ci_runner.active)
expect(runner_data[:tags]).to match_array(tag_names)
expect(runner_data[:is_shared]).to eq(ci_runner.instance_type?)
end
end
......
......@@ -137,11 +137,11 @@ RSpec.describe API::Ci::Runners do
get api('/runners/all', admin)
expect(json_response).to match_array [
a_hash_including('description' => 'Project runner'),
a_hash_including('description' => 'Two projects runner'),
a_hash_including('description' => 'Group runner A'),
a_hash_including('description' => 'Group runner B'),
a_hash_including('description' => 'Shared runner')
a_hash_including('description' => 'Project runner', 'is_shared' => false, 'runner_type' => 'project_type'),
a_hash_including('description' => 'Two projects runner', 'is_shared' => false, 'runner_type' => 'project_type'),
a_hash_including('description' => 'Group runner A', 'is_shared' => false, 'runner_type' => 'group_type'),
a_hash_including('description' => 'Group runner B', 'is_shared' => false, 'runner_type' => 'group_type'),
a_hash_including('description' => 'Shared runner', 'is_shared' => true, 'runner_type' => 'instance_type')
]
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment