Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigating why upload step takes so long #2010

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Scripts/upload_test_results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ echo "Extracting result bundle attachments to ${xcparse_output_directory}." 2>&1
cd xcparse
if [[ ! -f .build/debug/xcparse ]]
then
swift build
echo "Showing time taken to build xcparse." 2>&1
time swift build
fi

.build/debug/xcparse attachments "${result_bundles}" "${xcparse_output_directory}"
Expand All @@ -198,7 +199,8 @@ do
attachment_file="${xcparse_output_directory}/$(jq --raw-output ".[${i}].attachmentName" < "${filtered_xcparse_attachment_descriptors_file}")"

temp_crash_reports_json_file=$(mktemp)
jq \
echo "Showing time taken to create crash reports JSON file." 2>&1
time jq \
--slurpfile attachmentDescriptors "${filtered_xcparse_attachment_descriptors_file}" \
--rawfile attachment "${attachment_file}" \
". += [{filename: \$attachmentDescriptors[0][$i].attachmentName, test_class_name: \$attachmentDescriptors[0][$i].testClassName, test_case_name: \$attachmentDescriptors[0][$i].testCaseName, data: \$attachment | @base64 }]" \
Expand All @@ -215,7 +217,8 @@ done
if [[ ! -z $GITHUB_TOKEN ]]
then
temp_github_jobs_response_file=$(mktemp)
gh api "/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}/jobs" > $temp_github_jobs_response_file
echo "Showing time taken to fetch jobs from GitHub API." 2>&1
time gh api "/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/attempts/${GITHUB_RUN_ATTEMPT}/jobs" > $temp_github_jobs_response_file

matching_jobs_file=$(mktemp)

Expand Down Expand Up @@ -293,7 +296,8 @@ else
optional_params+=(--argjson github_job_html_url null)
fi

jq -n \
echo "Showing time taken to create request body." 2>&1
time jq -n \
--rawfile junit_report_xml "${test_reports}" \
--slurpfile crash_reports "${crash_reports_json_file}" \
--arg github_repository "${GITHUB_REPOSITORY}" \
Expand All @@ -311,7 +315,9 @@ jq -n \
> "${temp_request_body_file}"

echo "::group::Request body"
date
printf "Created request body:\n$(cat "${temp_request_body_file}")\n\n" 2>&1
date
echo "::endgroup::"

# 10. Send the request.
Expand All @@ -326,7 +332,7 @@ fi
request_id=$(uuidgen)

temp_response_body_file=$(mktemp)
curl -vvv --fail-with-body --data-binary "@${temp_request_body_file}" --header "Content-Type: application/json" --header "Test-Observability-Auth-Key: ${TEST_OBSERVABILITY_SERVER_AUTH_KEY}" --header "X-Request-ID: ${request_id}" "${upload_server_base_url}/uploads" | tee "${temp_response_body_file}"
time curl -vvv --fail-with-body --data-binary "@${temp_request_body_file}" --header "Content-Type: application/json" --header "Test-Observability-Auth-Key: ${TEST_OBSERVABILITY_SERVER_AUTH_KEY}" --header "X-Request-ID: ${request_id}" "${upload_server_base_url}/uploads" | tee "${temp_response_body_file}"
echo 2>&1 # Print a newline to separate the `curl` output from the next log line.

# 11. Extract the ID of the created upload and log the web UI URL.
Expand Down
Loading