Skip to content

Commit b5c7ac7

Browse files
Upload results.json using raw api, rather than test-collector (#433)
Redo of #428 Incorporates #430 It's too difficult to use `test-collector` to upload these files with a custom job-id, and #428 did it in an unsafe way.
1 parent 374e62f commit b5c7ac7

7 files changed

+37
-10
lines changed

pipelines/main/launch_signed_jobs.yml.signature

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Salted__~ xHE�H��$B0_ ��(��������,#ag�(��9��xS��y.�vq��g�����:�Ek0�j�L��#�_�$�c�="�+�1E
1+
Salted__،���;�lh�)L+�P��8����J�͟h�l[X��8O��zf�sފ�Q�ƛJu}�'�I��+f�Lh�BupPz=QH-{t��pm
0 Bytes
Binary file not shown.

pipelines/main/misc/upload_buildkite_results.yml

+28-4
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,38 @@ steps:
1616
- staticfloat/cryptic#v2:
1717
variables:
1818
- BUILDKITE_ANALYTICS_TOKEN="U2FsdGVkX18BUSpNWNimRUOAh2ku0ugS7x3RRy1CfJBCxTLWArJpa1PXKoILfI7q"
19-
- test-collector#v1.10.1:
20-
files: "results*.json"
21-
format: "json"
22-
missing-error: 0
2319
timeout_in_minutes: ${TIMEOUT?}
2420
soft_fail: true
2521
commands: |
22+
echo "--- Downloading test results from test step"
2623
buildkite-agent artifact download --step "test_${TRIPLET?}" "results*.json" . || true
24+
25+
echo "--- Uploading test results and assigning them to the test run"
26+
export JOB_ID="$$(buildkite-agent meta-data get BUILDKITE_TEST_JOB_ID_test_${TRIPLET?} || echo "unknown")"
27+
28+
shopt -s nullglob # Ensure empty glob does not return a literal string
29+
for file in results*.json; do
30+
echo "Uploading $$file..."
31+
# We can't use the test-collector plugin because it doesn't provide a way to set a custom `job_id`
32+
curl \
33+
-X POST \
34+
--silent \
35+
--show-error \
36+
--max-time "${TIMEOUT?}" \
37+
-H "Authorization: Token token=\"$$BUILDKITE_ANALYTICS_TOKEN\"" \
38+
-F "data=@\"$$file\"" \
39+
-F "format=json" \
40+
-F "run_env[CI]=buildkite" \
41+
-F "run_env[key]=\"$$BUILDKITE_BUILD_ID\"" \
42+
-F "run_env[url]=\"$$BUILDKITE_BUILD_URL\"" \
43+
-F "run_env[branch]=\"$$BUILDKITE_BRANCH\"" \
44+
-F "run_env[commit_sha]=\"$$BUILDKITE_COMMIT\"" \
45+
-F "run_env[number]=\"$$BUILDKITE_BUILD_NUMBER\"" \
46+
-F "run_env[job_id]=\"$$JOB_ID\"" \
47+
-F "run_env[message]=\"$$(printf “%q” “$$BUILDKITE_MESSAGE”)\"" \
48+
https://analytics-api.buildkite.com/v1/uploads
49+
echo "\n"
50+
done
2751
agents:
2852
queue: "julia"
2953
env:
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
Salted___��x^�|gB�>��O$9���'����ZW�ҷ�fSiqy�VՌ���`rIW�
2-
��h���6�Yq.�5�����2����
1+
Salted__F5*�P3ߩ��oi'��� 4:�1�s�A:�U��=t���!�:_�`}��o����>K0�,d�Q��~d3)Q�^�xFK��
Binary file not shown.

pipelines/scheduled/launch_upload_jobs.yml.signature

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Salted__���`��&Z��AkY�c�Æ"Y�O��H�M�M���Y��叱k �Gq��H��_L�I.'�8�$�Z�}X NA. rh� �xɈ
1+
Salted__��F�"� ���z5���!@6�C`s_2�b��I�ti�s�FN �ԂKڹn2��y���~��.�P�
2+
�f����C�dHwh9L�.�}�hE�

utilities/test_julia.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ if [[ "${USE_RR-}" == "rr" ]] || [[ "${USE_RR-}" == "rr-net" ]]; then
7777

7878
# Do not run Pkg tests on rr
7979
TESTS_TO_SKIP+=( Pkg )
80-
80+
8181
# rr: all tests EXCEPT the network-related tests
8282
# rr-net: ONLY the network-related tests
8383
NETWORK_RELATED_TESTS=( Artifacts Downloads download LazyArtifacts LibGit2/online)
@@ -160,8 +160,11 @@ else
160160
fi
161161

162162
echo "--- Upload results.json report"
163+
# store the test job id so that the upload job can assign the results to the right job id
164+
buildkite-agent meta-data set BUILDKITE_TEST_JOB_ID_${BUILDKITE_STEP_KEY} "${BUILDKITE_JOB_ID}"
165+
echo "meta-data BUILDKITE_TEST_JOB_ID_${BUILDKITE_STEP_KEY} has been set to \"$(buildkite-agent meta-data get BUILDKITE_TEST_JOB_ID_${BUILDKITE_STEP_KEY})\""
163166
if compgen -G "${JULIA_INSTALL_DIR}/share/julia/test/results*.json"; then
164-
(cd "${JULIA_INSTALL_DIR}/share/julia/test"; buildkite-agent artifact upload results*.json)
167+
(cd "${JULIA_INSTALL_DIR}/share/julia/test"; buildkite-agent artifact upload "results*.json")
165168
else
166169
echo "no JSON results files found"
167170
fi

0 commit comments

Comments
 (0)