mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Fix the creation of the jobResultsCache.json file.
This commit is contained in:
parent
a953eb42b1
commit
55bfc885db
@ -156,23 +156,23 @@ function update_job_result_cache() {
|
|||||||
|
|
||||||
for upload_attempt in $(seq 3); do
|
for upload_attempt in $(seq 3); do
|
||||||
echo "Copying ${job_results} to ${tmp_results} (attempt ${upload_attempt})"
|
echo "Copying ${job_results} to ${tmp_results} (attempt ${upload_attempt})"
|
||||||
|
# The sed construct below is stripping out only the "version" lines
|
||||||
|
# and then ensuring there's a single comma at the end of the line.
|
||||||
gsutil -q cat ${job_results} 2>&- |\
|
gsutil -q cat ${job_results} 2>&- |\
|
||||||
sed -n 's/^\({"version".*}\),*/\1,/p' >> ${tmp_results} || continue
|
sed -n 's/^\({"version".*}\),*/\1,/p' |\
|
||||||
|
tail -${cache_size} >> ${tmp_results} || continue
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "{\"version\": \"${version}\", \"buildnumber\": \"${BUILD_NUMBER}\"," \
|
echo "{\"version\": \"${version}\", \"buildnumber\": \"${BUILD_NUMBER}\"," \
|
||||||
"\"result\": \"${build_result}\"}" >> ${tmp_results}
|
"\"result\": \"${build_result}\"}" >> ${tmp_results}
|
||||||
|
|
||||||
# JSON doesn't like terminating elements to contain a "," separator, so
|
echo "]" >> ${tmp_results}
|
||||||
# terminate the elements with an empty one.
|
|
||||||
echo -e "{}\n]" >> ${tmp_results}
|
|
||||||
|
|
||||||
for upload_attempt in $(seq 3); do
|
for upload_attempt in $(seq 3); do
|
||||||
echo "Copying ${tmp_results} to ${job_results} (attempt ${upload_attempt})"
|
echo "Copying ${tmp_results} to ${job_results} (attempt ${upload_attempt})"
|
||||||
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" \
|
gsutil -q -h "Content-Type:application/json" cp -a "${gcs_acl}" \
|
||||||
<(tail -${cache_size} ${tmp_results}) ${job_results} || continue
|
${tmp_results} ${job_results} || continue
|
||||||
break
|
break
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user