Skip to content
Snippets Groups Projects
Commit 82b51a5b authored by Martin Lowe's avatar Martin Lowe :flag_ca:
Browse files

Merge branch 'malowe/main/script-large-set-messages' into 'main'

Add message to the hook script to notify of potential validation delay

See merge request eclipsefdn/it/api/git-eca-rest-api!198
parents 16bd9b7b 5b028212
No related branches found
No related tags found
1 merge request!198Add message to the hook script to notify of potential validation delay
Pipeline #50951 passed
......@@ -7,6 +7,7 @@ require 'multi_json'
WIKI_REGEX_MATCH = /.*\.wiki$/
HOST_URL='https://gitlab.eclipse.org'
API_URL='https://api.eclipse.org'
LARGE_COMMIT_SET_THRESHOLD=15
# this should be removed as soon as Oniro is onside again
ALLOW_LIST_PROJECTS = ['/eclipse/oniro-core/meta-ts',
'/eclipse/oniro-core/meta-ledge-sesure',
......@@ -138,6 +139,8 @@ diff_git_commits = diff_git_commits_raw.split(/\n/)
if (diff_git_commits.empty?) then
puts "There are no commits to validate for current push, skipping validation step"
exit 0
elsif (diff_git_commits.length() > LARGE_COMMIT_SET_THRESHOLD) then
puts "The following push has a large number of commits (#{diff_git_commits.length()}), and may have a delay in response or timeout for very large sets"
end
processed_git_data = []
......@@ -165,6 +168,10 @@ begin
parsed_response = MultiJson.load(response.body)
rescue MultiJson::ParseError
puts "GL-HOOK-ERR: Unable to validate commit, server error encountered.\n\nPlease contact the administrator, and retry the commit at a later time.\n\n"
## If a large commit set, this could be a timeout, and may be resolved through a second attempt after a short delay
if (diff_git_commits.length() > LARGE_COMMIT_SET_THRESHOLD) then
puts "The following push had a large commit set and may have timed out in processing. In this case, after a short delay (~1 minute), a second attempt can be made which may resolve the issue. If the issue is still not resolved, see above message."
end
## Additional information for debugging - request will allow us to easily retest exact output and find errors in render
puts "Request body: #{MultiJson.dump(json_data)}\n\n"
exit 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment