1- const request = require ( 'request-promise ' ) ;
1+ const got = require ( 'got ' ) ;
22
33class Codefresh {
44 /**
55 *
6- * @return {{build: {trigger: *, initiator: *, id: *, timestamp: *, url: *}, repo: {owner: *, name: *}, commit: {author: *, url: *, message: *}, revision: *, branch: *, apiKey: *} }
6+ * @return {{
7+ * build: {trigger: *, initiator: *, id: *, timestamp: *, url: *},
8+ * repo: {owner: *, name: *},
9+ * commit: {author: *, url: *, message: *},
10+ * revision: *,
11+ * branch: *,
12+ * apiKey: *
13+ * }}
714 */
815 get info ( ) {
916 return {
@@ -26,20 +33,22 @@ class Codefresh {
2633 revision : process . env . CF_REVISION ,
2734 branch : process . env . CF_BRANCH_TAG_NORMALIZED ,
2835 apiKey : process . env . CF_API_KEY ,
29- cfUrl : process . env . CF_URL
36+ cfUrl : process . env . CF_URL ,
3037 } ;
3138 }
3239
3340 async buildFailureCauses ( buildId , token , cfUrl ) {
3441 console . log ( token , buildId ) ;
35- const data = await request ( {
36- uri : `${ cfUrl } /api/workflow/${ buildId } /context-revision` ,
37- method : 'GET' ,
38- headers : {
39- 'authorization' : token ,
42+
43+ const data = await got (
44+ {
45+ url : `${ cfUrl } /api/workflow/${ buildId } /context-revision` ,
46+ method : 'GET' ,
47+ headers : {
48+ authorization : token ,
49+ } ,
4050 } ,
41- json : true ,
42- } ) ;
51+ ) . json ( ) ;
4352
4453 return Object . entries ( data . pop ( ) . context . stepsMetadata )
4554 . filter ( ( [ , stepInfo ] ) => stepInfo . status === 'failure' )
0 commit comments