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

Merge branch 'malowe/master/70' into 'master'

Iss #70 - Add bypass for fork projects in oniro-core

See merge request eclipsefdn/it/api/git-eca-rest-api!88
parents e9a3c41a e7067b04
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,21 @@ require 'json' ...@@ -5,6 +5,21 @@ require 'json'
require 'httparty' require 'httparty'
require 'multi_json' require 'multi_json'
WIKI_REGEX_MATCH = /.*\.wiki$/ WIKI_REGEX_MATCH = /.*\.wiki$/
HOST_URL='https://gitlab.eclipse.org'
# 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',
'/eclipse/oniro-core/linux',
'/eclipse/oniro-core/linux-meta',
'/eclipse/oniro-core/llvm-project',
'/eclipse/oniro-core/meta-arm',
'/eclipse/oniro-core/meta-av96',
'/eclipse/oniro-core/meta-binaryaudit',
'/eclipse/oniro-core/meta-clang',
'/eclipse/oniro-core/meta-openembedded',
'/eclipse/oniro-core/meta-riscv',
'/eclipse/oniro-core/meta-seco-intel',
'/eclipse/oniro-core/meta-zephyr']
## Process the commit into a hash object that will be posted to the ECA validation service ## Process the commit into a hash object that will be posted to the ECA validation service
def process_commit(sha) def process_commit(sha)
...@@ -66,7 +81,7 @@ end ...@@ -66,7 +81,7 @@ end
project_id = gl_repo[8..-1] project_id = gl_repo[8..-1]
## Get data about project from API ## Get data about project from API
project_response = HTTParty.get("https://gitlab.eclipse.org/api/v4/projects/#{project_id}", project_response = HTTParty.get("#{HOST_URL}/api/v4/projects/#{project_id}",
:headers => { :headers => {
'Authorization' => 'Bearer ' + access_token 'Authorization' => 'Bearer ' + access_token
}) })
...@@ -88,6 +103,9 @@ end ...@@ -88,6 +103,9 @@ end
if (nil_or_empty(project_url)) then if (nil_or_empty(project_url)) then
puts "Could not determine a web URL for project, likely not a fully-qualified project, skipping" puts "Could not determine a web URL for project, likely not a fully-qualified project, skipping"
exit 0 exit 0
elsif (ALLOW_LIST_PROJECTS.any? {|repo_namespace| "#{HOST_URL}#{repo_namespace}" == project_url}) then
puts "Found allow listed project, skipping validation"
exit 0
end end
## Get all new commits for branch, relative to itself for existing branch, relative to tree for new ## Get all new commits for branch, relative to itself for existing branch, relative to tree for new
......
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