File tree Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Expand file tree Collapse file tree 4 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ class Config {
109
109
branchNormalized : process . env . CF_BRANCH_TAG_NORMALIZED ,
110
110
storageIntegration : process . env . CF_STORAGE_INTEGRATION ,
111
111
logLevel : logLevelsMap [ process . env . REPORT_LOGGING_LEVEL ] || INFO ,
112
+ retriesForCodefreshAPI : Number ( process . env . CF_API_RETRIES ) || 0 ,
112
113
sourceReportFolderName : ( allureDir || 'allure-results' ) . trim ( ) ,
113
114
reportDir : ( ( reportDir || '' ) . trim ( ) ) || undefined ,
114
115
reportPath : ( ( reportPath || '' ) . trim ( ) ) . replace ( / \/ $ / , '' ) ,
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " cf-docker-test-reporting" ,
3
- "version" : " 1.0.4 " ,
3
+ "version" : " 1.0.5 " ,
4
4
"description" : " Generate test report" ,
5
5
"repository" : {
6
6
"type" : " git" ,
Original file line number Diff line number Diff line change 1
1
const rp = require ( 'request-promise' ) ;
2
2
3
3
class CodefreshAPI {
4
+
5
+ static async sendRequest ( config , opts ) {
6
+ if ( config . env . retriesForCodefreshAPI ) {
7
+ let error ;
8
+ for ( let i = 0 ; i < config . env . retriesForCodefreshAPI ; i += 1 ) {
9
+ try {
10
+ // eslint-disable-next-line no-await-in-loop
11
+ const result = await rp ( opts ) ;
12
+ return result ;
13
+ } catch ( e ) {
14
+ error = e ;
15
+ }
16
+ }
17
+ throw error ;
18
+ }
19
+ return rp ( opts ) ;
20
+ }
21
+
4
22
static async createAnnotation ( { config, value } ) {
5
23
// this query use proxy ability to replace :account_id to currentAccountID
6
24
// this ability use because we don`t know accountId
@@ -19,7 +37,7 @@ class CodefreshAPI {
19
37
json : true ,
20
38
} ;
21
39
22
- return rp ( createAnnotationOpts ) ;
40
+ return this . sendRequest ( config , createAnnotationOpts ) ;
23
41
}
24
42
25
43
static async getProcessById ( { id, config } ) {
@@ -33,7 +51,7 @@ class CodefreshAPI {
33
51
let process ;
34
52
35
53
try {
36
- const processRes = await rp ( opts ) ;
54
+ const processRes = await this . sendRequest ( config , opts ) ;
37
55
process = JSON . parse ( processRes ) ;
38
56
} catch ( e ) {
39
57
throw new Error ( 'Error during getting process info' ) ;
Original file line number Diff line number Diff line change 1
1
const _ = require ( 'lodash' ) ;
2
- const rp = require ( 'request-promise' ) ;
3
2
const VariableResolver = require ( '../ variableResolver/VariableResolver' ) ;
4
3
const storageTypesMap = require ( './types' ) ;
5
4
const storageTypes = require ( './storageTypes' ) ;
6
5
const fs = require ( 'fs' ) ;
6
+ const CodefreshAPI = require ( '../api' ) ;
7
7
8
8
class StorageConfigProvider {
9
9
constructor ( { config } ) {
@@ -29,7 +29,7 @@ class StorageConfigProvider {
29
29
} ;
30
30
31
31
try {
32
- return await rp ( opts ) ;
32
+ return await CodefreshAPI . sendRequest ( config , opts ) ;
33
33
} catch ( e ) {
34
34
const infoErrMsg = `Can't get storage integration: ${ this . integrationName } ` ;
35
35
if ( config . env . logLevel === config . logLevels . DEBUG ) {
You can’t perform that action at this time.
0 commit comments