mirror of
https://github.com/oneclickvirt/backtrace.git
synced 2026-10-16 08:25:49 +08:00
ci: preserve verified artifacts and recover network operations
This commit is contained in:
parent
2258999848
commit
567c096eb3
7
.github/scripts/ci_network.sh
vendored
7
.github/scripts/ci_network.sh
vendored
@ -68,6 +68,7 @@ curl() {
|
|||||||
for ((i=0; i<${#curl_args[@]}; i++)); do
|
for ((i=0; i<${#curl_args[@]}; i++)); do
|
||||||
argument="${curl_args[i]}"
|
argument="${curl_args[i]}"
|
||||||
case "$argument" in
|
case "$argument" in
|
||||||
|
--fail-with-body) curl_args[i]=--fail ;;
|
||||||
--data*|-d*|--form*|-F*|--upload-file*|-T*) mutating=true ;;
|
--data*|-d*|--form*|-F*|--upload-file*|-T*) mutating=true ;;
|
||||||
POST|PATCH|PUT|DELETE|-XPOST|-XPATCH|-XPUT|-XDELETE|--request=POST|--request=PATCH|--request=PUT|--request=DELETE) mutating=true ;;
|
POST|PATCH|PUT|DELETE|-XPOST|-XPATCH|-XPUT|-XDELETE|--request=POST|--request=PATCH|--request=PUT|--request=DELETE) mutating=true ;;
|
||||||
https://*) source_index=$i ;;
|
https://*) source_index=$i ;;
|
||||||
@ -75,7 +76,7 @@ curl() {
|
|||||||
done
|
done
|
||||||
if $mutating; then
|
if $mutating; then
|
||||||
# A timed-out mutation may already have reached the server.
|
# A timed-out mutation may already have reached the server.
|
||||||
command curl --fail-with-body --connect-timeout 15 --max-time 600 "${curl_args[@]}"
|
command curl --fail --connect-timeout 15 --max-time 600 "${curl_args[@]}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
if [[ "$source_index" -ge 0 ]]; then
|
if [[ "$source_index" -ge 0 ]]; then
|
||||||
@ -89,7 +90,7 @@ curl() {
|
|||||||
fi
|
fi
|
||||||
stdout_file=$(mktemp)
|
stdout_file=$(mktemp)
|
||||||
stderr_file=$(mktemp)
|
stderr_file=$(mktemp)
|
||||||
if command curl --fail-with-body --connect-timeout 15 --max-time 1200 --retry 3 --retry-max-time 180 --retry-connrefused "${curl_args[@]}" >"$stdout_file" 2>"$stderr_file"; then
|
if command curl --fail --connect-timeout 15 --max-time 1200 --retry 3 --retry-max-time 180 --retry-connrefused "${curl_args[@]}" >"$stdout_file" 2>"$stderr_file"; then
|
||||||
cat "$stdout_file"
|
cat "$stdout_file"
|
||||||
cat "$stderr_file" >&2
|
cat "$stderr_file" >&2
|
||||||
rm -f "$stdout_file" "$stderr_file"
|
rm -f "$stdout_file" "$stderr_file"
|
||||||
@ -99,7 +100,7 @@ curl() {
|
|||||||
fi
|
fi
|
||||||
if [[ -n "$backup" ]]; then
|
if [[ -n "$backup" ]]; then
|
||||||
curl_args[source_index]="$backup"
|
curl_args[source_index]="$backup"
|
||||||
if command curl --fail-with-body --connect-timeout 15 --max-time 1200 --retry 3 --retry-max-time 180 --retry-connrefused "${curl_args[@]}" >"$stdout_file" 2>"$stderr_file"; then
|
if command curl --fail --connect-timeout 15 --max-time 1200 --retry 3 --retry-max-time 180 --retry-connrefused "${curl_args[@]}" >"$stdout_file" 2>"$stderr_file"; then
|
||||||
cat "$stdout_file"
|
cat "$stdout_file"
|
||||||
cat "$stderr_file" >&2
|
cat "$stderr_file" >&2
|
||||||
rm -f "$stdout_file" "$stderr_file"
|
rm -f "$stdout_file" "$stderr_file"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user