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
08a83fa5
Commit
08a83fa5
authored
Mar 19, 2019
by
aha
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding DeletePipeline API call and test
parent
eca1beae
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
pipelines.go
pipelines.go
+20
-0
pipelines_test.go
pipelines_test.go
+16
-0
No files found.
pipelines.go
View file @
08a83fa5
...
...
@@ -229,3 +229,23 @@ func (s *PipelinesService) CancelPipelineBuild(pid interface{}, pipelineID int,
return
p
,
resp
,
err
}
// DeletePipeline deletes an existing pipeline.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/pipelines.html#delete-a-pipeline
func
(
s
*
PipelinesService
)
DeletePipeline
(
pid
interface
{},
pipelineID
int
,
options
...
OptionFunc
)
(
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/pipelines/%d"
,
url
.
QueryEscape
(
project
),
pipelineID
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
err
}
return
s
.
client
.
Do
(
req
,
nil
)
}
pipelines_test.go
View file @
08a83fa5
...
...
@@ -109,3 +109,19 @@ func TestCancelPipelineBuild(t *testing.T) {
t
.
Errorf
(
"Pipelines.CancelPipelineBuild returned %+v, want %+v"
,
pipeline
,
want
)
}
}
func
TestDeletePipeline
(
t
*
testing
.
T
)
{
mux
,
server
,
client
:=
setup
()
defer
teardown
(
server
)
mux
.
HandleFunc
(
"/api/v4/projects/1/pipelines/5949167"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
testMethod
(
t
,
r
,
"DELETE"
)
})
_
,
err
:=
client
.
Pipelines
.
DeletePipeline
(
"1"
,
5949167
)
if
err
!=
nil
{
t
.
Errorf
(
"Pipelines.DeletePipeline returned error: %v"
,
err
)
}
}
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