-
Notifications
You must be signed in to change notification settings - Fork 13
fix(INT-6744): add debug log if timeout error #576
Conversation
if (err.code === 'ATTEMPT_TIMEOUT') { | ||
logger.warn( | ||
`${CloudBuildEntitiesSpec.BUILD_BITBUCKET_SERVER_CONFIG._type} - Unable to fetch BitBucket repositories. This might be caused by expired credentials in the GCP console (Cloud Build).`, | ||
); | ||
}, | ||
); | ||
} | ||
|
||
throw err; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to try/catch inside client.iterateBuildBitBucketRepositories()
. If we encounter ATTEMPT_TIMEOUT
here, let's not throw (but throw if encountering any other errors).
if (err.code === 'ATTEMPT_TIMEOUT') { | ||
context.logger.warn( | ||
{ err }, | ||
`${CloudBuildEntitiesSpec.BUILD_BITBUCKET_SERVER_CONFIG._type} - Unable to fetch BitBucket repositories. This might be caused by expired credentials in the GCP console (Cloud Build).`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the variable is CloudBuildEntitiesSpec
but actually comes from a constants file
src/steps/cloud-build/client.ts
Outdated
} | ||
|
||
throw err; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest the following so that the step does not fail if ATTEMPT_TIMEOUT
occurs.
} | |
throw err; | |
} else { | |
throw err; | |
} |
🚀 PR was released in |
Add debug log if timeout error
Context:
Google Cloud does not handle correctly errors when BitBucket credentials are expired. Added a log in order to make it more easy to debug in the future.