Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

fix(INT-6744): add debug log if timeout error #576

Merged
merged 3 commits into from
Feb 24, 2023

Conversation

gastonyelmini
Copy link
Contributor

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.

@gastonyelmini gastonyelmini requested a review from a team as a code owner February 20, 2023 15:00
Comment on lines 61 to 67
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;
Copy link
Contributor

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).`,
Copy link
Contributor Author

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

Comment on lines 164 to 166
}

throw err;
Copy link
Contributor

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.

Suggested change
}
throw err;
} else {
throw err;
}

@gastonyelmini gastonyelmini merged commit cf6b13d into main Feb 24, 2023
@gastonyelmini gastonyelmini deleted the INT-6744-cloud-build-bb-fix branch February 24, 2023 20:25
@j1-internal-automation
Copy link
Collaborator

🚀 PR was released in v2.21.0 🚀

@j1-internal-automation j1-internal-automation added the released This issue/pull request has been released. label Mar 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants