Commit 0f9e82f6 authored by Rémy Coutable's avatar Rémy Coutable

Don't raise in `scripts/api/get_job_id.rb` when job isn't found

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 5074778e
......@@ -10,7 +10,7 @@ class JobFinder
pipeline_query: {}.freeze,
job_query: {}.freeze
).freeze
MAX_PIPELINES_TO_ITERATE = 200
MAX_PIPELINES_TO_ITERATE = 20
def initialize(options)
@project = options.delete(:project)
......@@ -51,7 +51,7 @@ class JobFinder
end
end
raise 'Job not found!'
warn 'Job not found!'
end
def find_job_with_filtered_pipelines
......@@ -63,7 +63,7 @@ class JobFinder
end
end
raise 'Job not found!'
warn 'Job not found!'
end
def find_job_in_pipeline
......@@ -73,7 +73,7 @@ class JobFinder
return job if found_job_by_name?(job) # rubocop:disable Cop/AvoidReturnFromBlocks
end
raise 'Job not found!'
warn 'Job not found!'
end
def found_job_with_artifact?(job)
......@@ -87,7 +87,7 @@ class JobFinder
end
def pipeline_query_params
@pipeline_query_params ||= { per_page: 100, **pipeline_query }
@pipeline_query_params ||= { per_page: MAX_PIPELINES_TO_ITERATE, **pipeline_query }
end
def job_query_params
......
......@@ -108,12 +108,7 @@ function retrieve_frontend_fixtures_mapping() {
local job_name="generate-frontend-fixtures-mapping"
local test_metadata_with_mapping_job_id
# On the MR that introduces 'generate-frontend-fixtures-mapping', we cannot retrieve the file from a master scheduled pipeline, so we take it from a known MR pipeline
if [[ "${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}" == "339343-execute-related-jests-specs-for-mrs-with-backend-changes" ]]; then
test_metadata_with_mapping_job_id=$(scripts/api/get_job_id.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" --pipeline-id "414921396" -Q "scope=success" --job-name "${job_name}")
else
test_metadata_with_mapping_job_id=$(scripts/api/get_job_id.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" -q "ref=${artifact_branch}" -q "username=${username}" -Q "scope=success" --job-name "${job_name}")
fi
if [[ $? -eq 0 ]] && [[ -n "${test_metadata_with_mapping_job_id}" ]]; then
echo "test_metadata_with_mapping_job_id: ${test_metadata_with_mapping_job_id}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment