@@ -7,28 +7,88 @@ class Jobs extends BaseService {
7
7
return RequestHelper . get ( this , `projects/${ pId } /jobs` , options ) ;
8
8
}
9
9
10
+ cancel ( projectId , jobId ) {
11
+ const [ pId , jId ] = [ projectId , jobId ] . map ( encodeURIComponent ) ;
12
+
13
+ return RequestHelper . post ( this , `projects/${ pId } /jobs/${ jId } /cancel` ) ;
14
+ }
15
+
16
+ downloadSingleArtifactFile (
17
+ projectId ,
18
+ jobId ,
19
+ artifactPath ,
20
+ options = { stream : false } ,
21
+ ) {
22
+ const [ pId , jId ] = [ projectId , jobId ] . map ( encodeURIComponent ) ;
23
+
24
+ return RequestHelper . get (
25
+ this ,
26
+ `projects/${ pId } /jobs/${ jId } /artifacts/${ artifactPath } ` ,
27
+ options ,
28
+ { stream : options . stream } ,
29
+ ) ;
30
+ }
31
+
32
+ downloadLatestArtifactFile (
33
+ projectId ,
34
+ ref ,
35
+ name ,
36
+ options = { stream : false } ,
37
+ ) {
38
+ const [ pId , rId , jobName ] = [ projectId , ref , name ] . map ( encodeURIComponent ) ;
39
+
40
+ return RequestHelper . get (
41
+ this ,
42
+ `projects/${ pId } /jobs/artifacts/${ rId } /download?job=${ jobName } ` ,
43
+ options ,
44
+ { stream : options . stream } ,
45
+ ) ;
46
+ }
47
+
48
+ downloadTraceFile ( projectId , jobId ) {
49
+ const [ pId , jId ] = [ projectId , jobId ] . map ( encodeURIComponent ) ;
50
+
51
+ return RequestHelper . get ( this , `projects/${ pId } /jobs/${ jId } /trace` ) ;
52
+ }
53
+
54
+ erase ( projectId , jobId ) {
55
+ const [ pId , jId ] = [ projectId , jobId ] . map ( encodeURIComponent ) ;
56
+
57
+ return RequestHelper . post ( this , `projects/${ pId } /jobs/${ jId } /erase` ) ;
58
+ }
59
+
60
+ keepArtifacts ( projectId , jobId ) {
61
+ const [ pId , jId ] = [ projectId , jobId ] . map ( encodeURIComponent ) ;
62
+
63
+ return RequestHelper . post ( this , `projects/${ pId } /jobs/${ jId } /artifacts/keep` ) ;
64
+ }
65
+
10
66
play ( projectId , jobId ) {
11
- const pId = encodeURIComponent ( projectId ) ;
67
+ const [ pId , jId ] = [ projectId , jobId ] . map ( encodeURIComponent ) ;
12
68
13
- return RequestHelper . post ( this , `projects/${ pId } /jobs/${ jobId } /play` ) ;
69
+ return RequestHelper . post ( this , `projects/${ pId } /jobs/${ jId } /play` ) ;
14
70
}
15
71
16
- downloadSingleArtifactFile ( projectId , jobId , artifactPath , { stream } ) {
17
- const pId = encodeURIComponent ( projectId ) ;
72
+ retry ( projectId , jobId ) {
73
+ const [ pId , jId ] = [ projectId , jobId ] . map ( encodeURIComponent ) ;
18
74
19
- return RequestHelper . get ( this , `projects/${ pId } /jobs/${ jobId } /artifacts/ ${ artifactPath } ` , { } , { stream } ) ;
75
+ return RequestHelper . post ( this , `projects/${ pId } /jobs/${ jId } /retry` ) ;
20
76
}
21
77
22
78
show ( projectId , jobId ) {
23
- const pId = encodeURIComponent ( projectId ) ;
79
+ const [ pId , jId ] = [ projectId , jobId ] . map ( encodeURIComponent ) ;
24
80
25
- return RequestHelper . get ( this , `projects/${ pId } /jobs/${ jobId } ` ) ;
81
+ return RequestHelper . get ( this , `projects/${ pId } /jobs/${ jId } ` ) ;
26
82
}
27
83
28
84
showPipelineJobs ( projectId , pipelineId , options ) {
29
- const pId = encodeURIComponent ( projectId ) ;
85
+ const [ pId , ppId ] = [ projectId , pipelineId ] . map ( encodeURIComponent ) ;
30
86
31
- return RequestHelper . get ( this , `projects/${ pId } /pipelines/${ pipelineId } /jobs` , options ) ;
87
+ return RequestHelper . get (
88
+ this ,
89
+ `projects/${ pId } /pipelines/${ ppId } /jobs` ,
90
+ options ,
91
+ ) ;
32
92
}
33
93
}
34
94
0 commit comments