Skip to content

Commit 9aa5cc7

Browse files
committed
Format scripts according to the latest shfmt settings
1 parent 664c395 commit 9aa5cc7

12 files changed

+34
-34
lines changed

_common

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ runcli() {
3939
set +e
4040
errorlog=$(mktemp -t runcli-errorlog-XXXX)
4141
# shellcheck disable=SC2064
42-
output=$("${args[@]}" 2>"$errorlog")
42+
output=$("${args[@]}" 2> "$errorlog")
4343
rc=$?
4444
set -e
4545
if [[ -s "$errorlog" ]]; then
46-
read -r errstr <"$errorlog"
46+
read -r errstr < "$errorlog"
4747
warn "$1 ($(caller)): (${args[*]}) stderr: >>>$errstr<<<"
4848
fi
4949
rm "$errorlog"
@@ -57,7 +57,7 @@ runcli() {
5757
runjq() {
5858
local rc output
5959
local jq_output_limit="${jq_output_limit:-15}"
60-
input=$(</dev/stdin)
60+
input=$(< /dev/stdin)
6161
set +e
6262
output=$(echo "$input" | jq "$@" 2>&1)
6363
rc=$?
@@ -231,7 +231,7 @@ get_image() {
231231
find_latest_published_tumbleweed_image() {
232232
local latest_builds build image=null assetname
233233
local tw_group_id=$1 arch=$2 machine=$3 type=$4
234-
read -r -a latest_builds <<<"$(latest_published_tw_builds "$tw_group_id")"
234+
read -r -a latest_builds <<< "$(latest_published_tw_builds "$tw_group_id")"
235235
if [[ "${#latest_builds[@]}" -eq 0 ]]; then
236236
warn "Unable to find latest published Tumbleweed builds."
237237
exit 1

backlog-set-due-date

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ issues=$(mktemp -t backlog-set-due-date-XXXX)
2121
jquery=".issues | .[] | select(.priority.name!=\"$priority\" and .due_date==null and .assigned_to!=null and .status.name==\"$status\")"
2222

2323
if [ $# -eq 1 ] && [ -f "$1" ] && [ "$dry_run" = "1" ]; then
24-
jq -r "$jquery" "$1" >"$issues"
24+
jq -r "$jquery" "$1" > "$issues"
2525
else
2626
redmine_api_key="${redmine_api_key:?"Need redmine API key"}"
27-
curl -sS -H "X-Redmine-API-Key: $redmine_api_key" "$host/issues.json?query_id=$query_id&limit=$ticket_limit" | jq -r "$jquery" >"$issues"
27+
curl -sS -H "X-Redmine-API-Key: $redmine_api_key" "$host/issues.json?query_id=$query_id&limit=$ticket_limit" | jq -r "$jquery" > "$issues"
2828
fi
2929

3030
[ "$dry_run" = "1" ] && prefix="echo"

openqa-investigate

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ clone() {
8787
# shellcheck disable=SC2207
8888
clone_ids=($(echo "$out" | runjq -r 'values[]'))
8989
for id in "${clone_ids[@]}"; do
90-
"${client_call[@]}" --json --data "{\"priority\": $((base_prio + prio_add))}" -X PUT jobs/"$id" >/dev/null
90+
"${client_call[@]}" --json --data "{\"priority\": $((base_prio + prio_add))}" -X PUT jobs/"$id" > /dev/null
9191
done
9292
}
9393

@@ -214,7 +214,7 @@ fetch-investigation-results() {
214214
investigate_comment=$("${client_call[@]}" -X GET jobs/"$origin_job_id"/comments | runjq -r '[.[] | select(.text | contains("Automatic investigation jobs for job") and contains(":investigate:retry*:"))] | min_by(.id)') || return $?
215215
[[ $investigate_comment == 'null' ]] && return
216216
output=$(echo "$investigate_comment" | runjq -r '.text') || return $?
217-
mapfile -t comment_lines <<<"$output"
217+
mapfile -t comment_lines <<< "$output"
218218

219219
for line in "${comment_lines[@]}"; do
220220
if [[ $line =~ :investigate:([^:*]+).*t\#([0-9]+) ]]; then
@@ -244,7 +244,7 @@ identify-issue-type() {
244244
product_issue=false test_issue=false
245245

246246
output=$(fetch-investigation-results "$origin_job_id") || return $?
247-
mapfile -t result_lines <<<"$output"
247+
mapfile -t result_lines <<< "$output"
248248

249249
for line in "${result_lines[@]}"; do
250250
if [[ $line =~ ^([^|]+)\|([^|]+)\|([^|]+) ]]; then
@@ -303,7 +303,7 @@ post-investigate() {
303303
# gracefully
304304
out=$("${client_call[@]}" -X POST jobs/"$origin_job_id"/comments text="$comment" 2>&1) || rc=$?
305305
if [[ "$rc" -ne 0 ]]; then
306-
status=$(echo "$out" | runjq .error_status 2>/dev/null || echo "unknown")
306+
status=$(echo "$out" | runjq .error_status 2> /dev/null || echo "unknown")
307307
if [[ "$status" != "404" ]]; then
308308
echoerr "Unexpected error encountered when posting comments on job $origin_job_id after investigation job $id failed: '$out'"
309309
return 2
@@ -377,4 +377,4 @@ main() {
377377
investigate "$@"
378378
}
379379

380-
caller 0 >/dev/null || main "$@"
380+
caller 0 > /dev/null || main "$@"

openqa-investigate-multi

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ main() {
1818
exit $rc
1919
}
2020

21-
caller 0 >/dev/null || main "$@"
21+
caller 0 > /dev/null || main "$@"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
jobs=$(tail -n 200 /var/log/openqa | sed -n 's/^.*Got \(artefact for job with no worker assigned (maybe running job already considered dead): \(.*\)\|status update for job \([0-9]\+\) with unexpected worker.*expected no updates anymore, job is done with result incomplete.*\)$/\2\3/p' | uniq)
22
for job in $jobs; do
33
worker_and_instance=$(sudo -u geekotest psql -q --no-align --tuples-only openqa -c "select host,instance from workers where id=(select assigned_worker_id from jobs where id='$job');")
4-
IFS='|' read worker instance <<<$worker_and_instance
4+
IFS='|' read worker instance <<< $worker_and_instance
55
salt "${worker}*" cmd.run "grep -q $job /var/lib/openqa/pool/$instance/*.json && systemctl restart openqa-worker@${instance} ||:"
66
done

openqa-label-known-issues

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ handle_unreachable_or_no_log() {
4040

4141
if ! curl "${curl_args[@]}" -s --head "$testurl" -o /dev/null; then
4242
# the page might be gone, try the scheme+host we configured (might be different one though)
43-
if ! grep -q "$host_url" <<<"$testurl"; then
43+
if ! grep -q "$host_url" <<< "$testurl"; then
4444
echoerr "'$testurl' is not reachable and 'host_url' parameter does not match '$testurl', can not check further, continuing with next"
4545
return
4646
fi
@@ -139,7 +139,7 @@ investigate_issue() {
139139
# combine both the reason and autoinst-log.txt to check known issues
140140
# against even in case when autoinst-log.txt is missing the details, e.g.
141141
# see https://progress.opensuse.org/issues/69178
142-
echo "$reason" >>"$out"
142+
echo "$reason" >> "$out"
143143
if [[ "$curl_output" != "200" ]] && [[ "$curl_output" != "301" ]]; then
144144
# if we can not even access the page it is something more critical
145145
handle_unreachable_or_no_log "$id" "$testurl" "$out"
@@ -173,4 +173,4 @@ label_issue() {
173173
investigate_issue "$testurl"
174174
}
175175

176-
caller 0 >/dev/null || label_issue "$@"
176+
caller 0 > /dev/null || label_issue "$@"

openqa-label-known-issues-and-investigate-hook

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ hook() {
4646
fi
4747
}
4848

49-
caller 0 >/dev/null || hook "$@"
49+
caller 0 > /dev/null || hook "$@"

openqa-label-known-issues-multi

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ main() {
2727
print_summary
2828
}
2929

30-
caller 0 >/dev/null || main "$@"
30+
caller 0 > /dev/null || main "$@"

openqa-review-failed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"$(dirname "$0")"/openqa-monitor-investigation-candidates | "$(dirname "$0")"/openqa-label-known-issues-multi 3>&1 1>/dev/null 2>&3- | sed -n 's/\(\S*\) : Unknown test issue, to be reviewed.*$/\1/p' | "$(dirname "$0")"/openqa-investigate-multi
1+
"$(dirname "$0")"/openqa-monitor-investigation-candidates | "$(dirname "$0")"/openqa-label-known-issues-multi 3>&1 1> /dev/null 2>&3- | sed -n 's/\(\S*\) : Unknown test issue, to be reviewed.*$/\1/p' | "$(dirname "$0")"/openqa-investigate-multi

os-autoinst-obs-auto-submit

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ update_package() {
5656
reenable_buildtime_services
5757
# ignore those updates
5858
rm -f _service:*-test.changes
59-
cp -v .osc/*-test.changes . 2>/dev/null || :
59+
cp -v .osc/*-test.changes . 2> /dev/null || :
6060
for file in _service:*; do
6161
# shellcheck disable=SC2001
6262
mv -v "$file" "$(echo "$file" | sed -e 's,.*:,,')"
@@ -101,7 +101,7 @@ sync_changesrevision() {
101101
$prefix xmlstarlet ed -L -u "//param[@name='changesrevision']" -v "$factory_rev" "$path"/_servicedata
102102
if ! diff -u "$path"/.osc/_servicedata "$path"/_servicedata; then
103103
$osc up "$path"
104-
$osc cat "$submit_target" "$package" "$package".changes >"$path/$package".changes
104+
$osc cat "$submit_target" "$package" "$package".changes > "$path/$package".changes
105105
$osc ci -m "sync changesrevision with $submit_target" "$path"
106106
$osc up --server-side-source-service-files "$path"
107107
fi
@@ -110,7 +110,7 @@ sync_changesrevision() {
110110
generate_os-autoinst-distri-opensuse-deps_changelog() {
111111
dir=$1
112112
package=$2
113-
$osc cat "$submit_target" "$package" "$package".changes >"$package"-factory.changes
113+
$osc cat "$submit_target" "$package" "$package".changes > "$package"-factory.changes
114114
{
115115
echo "-------------------------------------------------------------------"
116116
echo "$(LANG=c date -u) - Dominik Heidler <[email protected]>"
@@ -120,15 +120,15 @@ generate_os-autoinst-distri-opensuse-deps_changelog() {
120120
| sed -e 's/Requires:\s*/dependency /g' -e 's/^-/- Removed /g' -e 's/^+/- Added /g'
121121
echo
122122
cat "$package"-factory.changes
123-
} >"$dir/$package/$package".changes
123+
} > "$dir/$package/$package".changes
124124
}
125125

126126
handle_auto_submit() {
127127
package=$1
128128
$osc service wait "$src_project" "$package"
129129
$osc co --server-side-source-service-files "$src_project"/"$package"
130130
if [[ "$package" == "os-autoinst-distri-opensuse-deps" ]]; then
131-
$osc cat "$submit_target" "$package" "$package.spec" >"$package-factory.spec"
131+
$osc cat "$submit_target" "$package" "$package.spec" > "$package-factory.spec"
132132
if diff -u "$package"-factory.spec "$src_project/$package/_service:obs_scm:$package".spec | grep "^[+-]Requires"; then
133133
# dependency added or removed
134134
generate_os-autoinst-distri-opensuse-deps_changelog "$src_project" "$package"

reboot-stability-check

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ main() {
2626
done
2727
}
2828

29-
caller 0 >/dev/null || main "$@"
29+
caller 0 > /dev/null || main "$@"

steps.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ results=""
77
if [ -z "$steps" ]; then
88
exit 0
99
else
10-
for k in $(jq -c 'keys[]' <<<"$steps"); do
11-
outcome="$(jq -c ".${k}.outcome" <<<"$steps")"
10+
for k in $(jq -c 'keys[]' <<< "$steps"); do
11+
outcome="$(jq -c ".${k}.outcome" <<< "$steps")"
1212
if [[ $outcome != \"success\" ]]; then
1313
if [ -z "$results" ]; then
14-
repo_url="$(sed "$sed_c" <<<"$repo_url")"
15-
repo="$(sed "$sed_c" <<<"$repo")"
14+
repo_url="$(sed "$sed_c" <<< "$repo_url")"
15+
repo="$(sed "$sed_c" <<< "$repo")"
1616
results="<p><b>There are failures in the GitHub Actions pipeline for repo"
1717
results="${results}<a href='${repo_url}'>${2}</a></b></p>"
1818
results="${results}<table><tr><th>Job</th><th>Step</th><th>State</th></tr>"
1919
fi
20-
pipeline="$(sed -e 's/^"//' -e 's/"$//' <<<"$k")"
21-
pipeline="$(sed "$sed_c" <<<"$pipeline")"
22-
outcome="$(sed -e 's/^"//' -e 's/"$//' <<<"$outcome")"
23-
run_url="$(sed "$sed_c" <<<"$run_url")"
24-
job="$(sed "$sed_c" <<<"$job")"
20+
pipeline="$(sed -e 's/^"//' -e 's/"$//' <<< "$k")"
21+
pipeline="$(sed "$sed_c" <<< "$pipeline")"
22+
outcome="$(sed -e 's/^"//' -e 's/"$//' <<< "$outcome")"
23+
run_url="$(sed "$sed_c" <<< "$run_url")"
24+
job="$(sed "$sed_c" <<< "$job")"
2525
results="${results}<tr><td><a href='${run_url}'>${job}</td><td>${pipeline}</td><td>${outcome}</td></tr>"
2626
fi
2727
if [ -n "$results" ]; then

0 commit comments

Comments
 (0)