Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
5abd33d5
Unverified
Commit
5abd33d5
authored
Feb 08, 2018
by
Sander van Harmelen
Committed by
GitHub
Feb 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make some small semantic changes (#318)
parent
b1cfdff1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
24 deletions
+22
-24
runners.go
runners.go
+16
-18
runners_test.go
runners_test.go
+6
-6
No files found.
runners.go
View file @
5abd33d5
...
...
@@ -43,10 +43,10 @@ type Runner struct {
Status
string
`json:"status"`
}
// Runner
sDetails represents a GitLab CI RunnerD
etails.
// Runner
Details represents the GitLab CI runner d
etails.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
type
Runner
s
Details
struct
{
type
RunnerDetails
struct
{
Active
bool
`json:"active"`
Architecture
string
`json:"architecture"`
Description
string
`json:"description"`
...
...
@@ -123,7 +123,7 @@ func (s *RunnersService) ListAllRunners(opt *ListRunnersOptions, options ...Opti
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#get-runner-39-s-details
func
(
s
*
RunnersService
)
GetRunnerDetails
(
rid
interface
{},
options
...
OptionFunc
)
(
*
Runner
s
Details
,
*
Response
,
error
)
{
func
(
s
*
RunnersService
)
GetRunnerDetails
(
rid
interface
{},
options
...
OptionFunc
)
(
*
RunnerDetails
,
*
Response
,
error
)
{
runner
,
err
:=
parseID
(
rid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
@@ -135,7 +135,7 @@ func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...OptionFunc
return
nil
,
nil
,
err
}
var
rs
*
Runner
s
Details
var
rs
*
RunnerDetails
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
rs
)
if
err
!=
nil
{
return
nil
,
resp
,
err
...
...
@@ -144,11 +144,11 @@ func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...OptionFunc
return
rs
,
resp
,
err
}
// UpdateRunner
sDetailsOptions represents the available UpdateRunners
Details() options.
// UpdateRunner
DetailsOptions represents the available UpdateRunner
Details() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details
type
UpdateRunner
s
DetailsOptions
struct
{
type
UpdateRunnerDetailsOptions
struct
{
Description
*
string
`url:"description,omitempty" json:"description,omitempty"`
Active
*
bool
`url:"active,omitempty" json:"active,omitempty"`
TagList
[]
string
`url:"tag_list[],omitempty" json:"tag_list,omitempty"`
...
...
@@ -157,11 +157,11 @@ type UpdateRunnersDetailsOptions struct {
AccessLevel
*
string
`url:"access_level,omitempty" json:"access_level,omitempty"`
}
// UpdateRunner
sDetails updates runners details
// UpdateRunner
Details updates details for a given runner.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details
func
(
s
*
RunnersService
)
UpdateRunner
sDetails
(
rid
interface
{},
opt
*
UpdateRunnersDetailsOptions
,
options
...
OptionFunc
)
(
*
Runners
Details
,
*
Response
,
error
)
{
func
(
s
*
RunnersService
)
UpdateRunner
Details
(
rid
interface
{},
opt
*
UpdateRunnerDetailsOptions
,
options
...
OptionFunc
)
(
*
Runner
Details
,
*
Response
,
error
)
{
runner
,
err
:=
parseID
(
rid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
@@ -173,7 +173,7 @@ func (s *RunnersService) UpdateRunnersDetails(rid interface{}, opt *UpdateRunner
return
nil
,
nil
,
err
}
var
rs
*
Runner
s
Details
var
rs
*
RunnerDetails
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
rs
)
if
err
!=
nil
{
return
nil
,
resp
,
err
...
...
@@ -182,11 +182,11 @@ func (s *RunnersService) UpdateRunnersDetails(rid interface{}, opt *UpdateRunner
return
rs
,
resp
,
err
}
// Remove
ARunner removes a runner
// Remove
Runner removes a runner.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#remove-a-runner
func
(
s
*
RunnersService
)
Remove
A
Runner
(
rid
interface
{},
options
...
OptionFunc
)
(
*
Response
,
error
)
{
func
(
s
*
RunnersService
)
RemoveRunner
(
rid
interface
{},
options
...
OptionFunc
)
(
*
Response
,
error
)
{
runner
,
err
:=
parseID
(
rid
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -201,21 +201,21 @@ func (s *RunnersService) RemoveARunner(rid interface{}, options ...OptionFunc) (
return
s
.
client
.
Do
(
req
,
nil
)
}
// ListRunner
sJobsOptions represents the available ListRunners
Jobs()
// options.
(one of running, success, failed, canceled)
// ListRunner
JobsOptions represents the available ListRunner
Jobs()
// options.
Status can be one of: running, success, failed, canceled.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#list-runner-39-s-jobs
type
ListRunner
s
JobsOptions
struct
{
type
ListRunnerJobsOptions
struct
{
ListOptions
Status
*
BuildState
`url:"status,omitempty" json:"status,omitempty"`
Status
*
string
`url:"status,omitempty" json:"status,omitempty"`
}
// ListRunnerJobs gets a list of jobs that are being processed or were processed by specified Runner.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#list-runner-39-s-jobs
func
(
s
*
RunnersService
)
ListRunnerJobs
(
rid
interface
{},
opt
*
ListRunner
s
JobsOptions
,
options
...
OptionFunc
)
([]
*
Job
,
*
Response
,
error
)
{
func
(
s
*
RunnersService
)
ListRunnerJobs
(
rid
interface
{},
opt
*
ListRunnerJobsOptions
,
options
...
OptionFunc
)
([]
*
Job
,
*
Response
,
error
)
{
runner
,
err
:=
parseID
(
rid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
...
...
@@ -311,12 +311,10 @@ func (s *RunnersService) DisableProjectRunner(pid interface{}, rid interface{},
if
err
!=
nil
{
return
nil
,
err
}
runner
,
err
:=
parseID
(
rid
)
if
err
!=
nil
{
return
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/runners/%s"
,
url
.
QueryEscape
(
project
),
url
.
QueryEscape
(
runner
))
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
...
...
runners_test.go
View file @
5abd33d5
...
...
@@ -48,7 +48,7 @@ func TestListRunnersJobs(t *testing.T) {
fmt
.
Fprint
(
w
,
`[{"id":1},{"id":2}]`
)
})
opt
:=
&
ListRunner
s
JobsOptions
{}
opt
:=
&
ListRunnerJobsOptions
{}
jobs
,
_
,
err
:=
client
.
Runners
.
ListRunnerJobs
(
1
,
opt
)
if
err
!=
nil
{
...
...
@@ -70,7 +70,7 @@ func TestRemoveRunner(t *testing.T) {
w
.
WriteHeader
(
http
.
StatusNoContent
)
})
_
,
err
:=
client
.
Runners
.
Remove
A
Runner
(
1
,
nil
)
_
,
err
:=
client
.
Runners
.
RemoveRunner
(
1
,
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"Runners.RemoveARunner returns an error: %v"
,
err
)
}
...
...
@@ -115,9 +115,9 @@ func TestUpdateRunnersDetails(t *testing.T) {
fmt
.
Fprint
(
w
,
exampleDetailRsp
)
})
opt
:=
&
UpdateRunner
s
DetailsOptions
{}
opt
:=
&
UpdateRunnerDetailsOptions
{}
details
,
_
,
err
:=
client
.
Runners
.
UpdateRunner
s
Details
(
6
,
opt
,
nil
)
details
,
_
,
err
:=
client
.
Runners
.
UpdateRunnerDetails
(
6
,
opt
,
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"Runners.UpdateRunnersDetails returns an error: %v"
,
err
)
}
...
...
@@ -149,7 +149,7 @@ func TestGetRunnerDetails(t *testing.T) {
}
// helper function returning expected result for string: &exampleDetailRsp
func
expectedParsedDetails
()
*
Runner
s
Details
{
func
expectedParsedDetails
()
*
RunnerDetails
{
proj
:=
struct
{
ID
int
`json:"id"`
Name
string
`json:"name"`
...
...
@@ -158,7 +158,7 @@ func expectedParsedDetails() *RunnersDetails {
PathWithNamespace
string
`json:"path_with_namespace"`
}{
ID
:
1
,
Name
:
"GitLab Community Edition"
,
NameWithNamespace
:
"GitLab.org / GitLab Community Edition"
,
Path
:
"gitlab-ce"
,
PathWithNamespace
:
"gitlab-org/gitlab-ce"
}
timestamp
,
_
:=
time
.
Parse
(
"2006-01-02T15:04:05.000Z"
,
"2016-01-25T16:39:48.066Z"
)
return
&
Runner
s
Details
{
Active
:
true
,
Description
:
"test-1-20150125-test"
,
ID
:
6
,
IsShared
:
false
,
ContactedAt
:
&
timestamp
,
Online
:
true
,
Status
:
"online"
,
Token
:
"205086a8e3b9a2b818ffac9b89d102"
,
TagList
:
[]
string
{
"ruby"
,
"mysql"
},
AccessLevel
:
"ref_protected"
,
Projects
:
[]
struct
{
return
&
RunnerDetails
{
Active
:
true
,
Description
:
"test-1-20150125-test"
,
ID
:
6
,
IsShared
:
false
,
ContactedAt
:
&
timestamp
,
Online
:
true
,
Status
:
"online"
,
Token
:
"205086a8e3b9a2b818ffac9b89d102"
,
TagList
:
[]
string
{
"ruby"
,
"mysql"
},
AccessLevel
:
"ref_protected"
,
Projects
:
[]
struct
{
ID
int
`json:"id"`
Name
string
`json:"name"`
NameWithNamespace
string
`json:"name_with_namespace"`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment