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

Update envvar check to catch wiki commit earlier

parent 79fe9a64
No related branches found
No related tags found
1 merge request!75Add some extra empty checks and add helper for checking vars
......@@ -55,23 +55,15 @@ gl_repo = ENV['GL_REPOSITORY']
if (nil_or_empty(gl_repo)) then
puts "No Gitlab repository set, likely dealing with non-repo commit, skipping"
exit 0
elsif (gl_repo =~ /^wiki-/) then
puts "Commit is associated with a wiki, and does not need to be validated. Skipping."
exit 0
elsif (gl_repo !~ /^project-/) then
puts "GL_REPOSITORY envvar is improperly set does not match expected format, cannot validate"
exit 1
end
## Get the project ID from env var, extracting from pattern 'project-###'
project_id = gl_repo[8..-1]
project_path = ENV['GL_PROJECT_PATH']
## When pushing group wikis, project_path may be empty
if (nil_or_empty(project_path)) then
puts "Cannot retrieve project path, likely a group. Skipping validation"
exit 0
end
## Check if current repo is a project wiki (no project ID and ends in .wiki)
if (project_path =~ WIKI_REGEX_MATCH) then
puts "Repository is a project wiki and not bound by ECA, skipping"
exit 0
end
## Get data about project from API
project_response = HTTParty.get("https://gitlab.eclipse.org/api/v4/projects/#{project_id}",
......
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