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

Merge branch 'malowe/master/84' into 'master'

Iss #84 - Update git hook to enable fork validation

Closes #84

See merge request !106
parents c276e092 2874cc0c
No related branches found
No related tags found
1 merge request!106Iss #84 - Update git hook to enable fork validation
Pipeline #12141 passed
......@@ -22,6 +22,9 @@ ALLOW_LIST_PROJECTS = ['/eclipse/oniro-core/meta-ts',
'/eclipse/oniro-core/meta-zephyr'
]
## Track whether forked project for error reporting (failing vs non-failing)
is_forked_project = false
## Process the commit into a hash object that will be posted to the ECA validation service
def process_commit(sha)
commit_parents_raw = `git show -s --format='%P' #{sha}`
......@@ -94,8 +97,9 @@ if (nil_or_empty(project_json_data) || project_json_data.class.name == 'Array')
end
## Get the web URL, checking if project is a fork to get original project URL
if (!nil_or_empty(project_json_data['forked_from_project'])) then
puts "Non-Eclipse project repository detected: ECA validation will be skipped.\n\nNote that any issues with sign off or committer access will be flagged upon merging into the main project repository."
exit 0
puts "Fork detected, using forked from project's URL for better commit validation."
project_url = project_json_data['forked_from_project']['web_url']
is_forked_project = true
else
project_url = project_json_data['web_url']
end
......@@ -209,6 +213,8 @@ else
end
end
## If error, exit as status 1
if (response.code == 403) then
if (response.code == 403 && is_forked_project) then
puts "Errors detected, but commits will be allowed for forked repository. Commit errors reported in this push will block merge into origin repository until resolved."
elsif (response.code == 403) then
exit 1
end
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