From 8650a706431f569983e79c6a8a3868571d563405 Mon Sep 17 00:00:00 2001 From: ybonatakis Date: Fri, 26 Jan 2024 12:40:29 +0100 Subject: [PATCH] git subrepo pull (merge) external/os-autoinst-common subrepo: subdir: "external/os-autoinst-common" merged: "fbd66e7f6" upstream: origin: "git@github.com:os-autoinst/os-autoinst-common.git" branch: "master" commit: "fbd66e7f6" git-subrepo: version: "0.4.6" origin: "???" commit: "???" Signed-off-by: ybonatakis --- container/openqa_data/scripts/set_openid | 2 +- container/webui/nginx-entrypoint.sh | 2 +- container/webui/run_openqa.sh | 16 +++---- container/worker/kvm-mknod.sh | 2 +- container/worker/launch_workers_pool.sh | 22 ++++----- container/worker/run_openqa_worker.sh | 2 +- dependencies.yaml | 3 +- dist/rpm/openQA.spec | 2 +- external/os-autoinst-common/.editorconfig | 2 + external/os-autoinst-common/.gitrepo | 4 +- script/configure-web-proxy | 26 +++++----- script/openqa-auto-update | 16 +++---- script/openqa-bootstrap | 14 +++--- script/openqa-bootstrap-container | 2 +- script/openqa-check-devel-repo | 14 +++--- script/openqa-clone-custom-git-refspec | 40 ++++++++-------- script/openqa-continuous-update | 14 +++--- script/openqa-rollback | 22 ++++----- .../BatchedProj/Batch1/read_files.sh | 6 +-- .../BatchedProj/Batch2/read_files.sh | 6 +-- .../Proj1/read_files.sh | 4 +- .../openqa-trigger-from-obs/script/rsync.sh | 2 +- t/dummy-isotovideo.sh | 10 ++-- t/test_postgresql | 2 +- tools/ci/build_cache.sh | 2 +- tools/ci/build_dependencies.sh | 8 ++-- tools/ci/build_local_container.sh | 6 +-- tools/ci/ci-packages.txt | 1 + tools/ci/prepare_dependency_pr.sh | 2 +- tools/generate-documentation | 16 +++---- tools/generate-packed-assets | 2 +- tools/js-tidy | 8 ++-- tools/run-tests-within-container | 2 +- tools/test_containers_compose | 2 +- tools/test_helm_chart | 4 +- tools/tidy | 48 +++++++++---------- 36 files changed, 169 insertions(+), 167 deletions(-) diff --git a/container/openqa_data/scripts/set_openid b/container/openqa_data/scripts/set_openid index 406444f4f36..93b11378860 100644 --- a/container/openqa_data/scripts/set_openid +++ b/container/openqa_data/scripts/set_openid @@ -6,7 +6,7 @@ read OPENID awk -v openid="$OPENID" ' /^provider/ {$0 = "provider = " openid} {print} -' /data/conf/openqa.ini >/data/conf/openqa.ini.new +' /data/conf/openqa.ini > /data/conf/openqa.ini.new mv /data/conf/openqa.ini.new /data/conf/openqa.ini echo "The file now contains:" diff --git a/container/webui/nginx-entrypoint.sh b/container/webui/nginx-entrypoint.sh index ad8dca20984..fcdc13c5889 100755 --- a/container/webui/nginx-entrypoint.sh +++ b/container/webui/nginx-entrypoint.sh @@ -7,7 +7,7 @@ for i in $(seq "${OPENQA_WEBUI_REPLICAS:-2}"); do done reg="s/REPLICAS/$replicas_cfg/" -sed "$reg" /etc/nginx/nginx.conf.template >/etc/nginx/nginx.conf +sed "$reg" /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf echo 'NGINX configuration:' cat /etc/nginx/nginx.conf diff --git a/container/webui/run_openqa.sh b/container/webui/run_openqa.sh index c5f0d88a1b9..51d4630ea50 100644 --- a/container/webui/run_openqa.sh +++ b/container/webui/run_openqa.sh @@ -44,7 +44,7 @@ function all_together_apache() { # run the database within the container if no database is configured by the user (by making one available via `-v`) if [[ ! -e /data/conf/database.ini ]]; then mkdir -p /data/conf - echo -e "[production]\ndsn = DBI:Pg:dbname=openqa" >/data/conf/database.ini + echo -e "[production]\ndsn = DBI:Pg:dbname=openqa" > /data/conf/database.ini chown -R postgres:postgres /var/lib/pgsql # ensure right ownership in case `/var/lib/pgsql` is from host via `-v` su postgres -c '/usr/share/postgresql/postgresql-script start' su postgres -c '/usr/bin/openqa-setup-db' @@ -63,11 +63,11 @@ usermod --shell /bin/sh geekotest # run services case "$MODE" in -upgradedb) upgradedb ;; -scheduler) scheduler ;; -websockets) websockets ;; -gru) gru ;; -livehandler) livehandler ;; -webui) webui ;; -*) all_together_apache ;; + upgradedb) upgradedb ;; + scheduler) scheduler ;; + websockets) websockets ;; + gru) gru ;; + livehandler) livehandler ;; + webui) webui ;; + *) all_together_apache ;; esac diff --git a/container/worker/kvm-mknod.sh b/container/worker/kvm-mknod.sh index 24e790cae0b..26e80bab259 100644 --- a/container/worker/kvm-mknod.sh +++ b/container/worker/kvm-mknod.sh @@ -3,7 +3,7 @@ set -e kvm=$({ [[ -f /proc/config.gz ]] && test "$(zgrep CONFIG_KVM=y /proc/config.gz)"; } || true) -$kvm || lsmod | grep '\' >/dev/null || { +$kvm || lsmod | grep '\' > /dev/null || { echo >&2 "KVM module not loaded; software emulation will be used" exit 1 } diff --git a/container/worker/launch_workers_pool.sh b/container/worker/launch_workers_pool.sh index 26ad10d88c8..118077fa538 100755 --- a/container/worker/launch_workers_pool.sh +++ b/container/worker/launch_workers_pool.sh @@ -5,7 +5,7 @@ size=1 cre="${cre:-"podman"}" usage() { - cat </dev/null; then + if [ -e "/dev/kvm" ] && getent group kvm > /dev/null; then /root/qemu/kvm-mknod.sh group=$(ls -lhn /dev/kvm | cut -d ' ' -f 4) diff --git a/dependencies.yaml b/dependencies.yaml index 97420de9d92..90b74c39707 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -84,7 +84,6 @@ devel_no_selenium_requires: devel_requires: '%devel_no_selenium_requires': chromedriver: - shfmt: main_requires: '%assetpack_requires': @@ -182,11 +181,11 @@ test_requires: curl: jq: ShellCheck: - shfmt: os-autoinst-devel: postgresql-server: python3-setuptools: python3-yamllint: + shfmt: perl(App::cpanminus): perl(Perl::Critic): perl(Perl::Critic::Freenode): diff --git a/dist/rpm/openQA.spec b/dist/rpm/openQA.spec index 6baf8b9754b..bcadcb9a8d2 100644 --- a/dist/rpm/openQA.spec +++ b/dist/rpm/openQA.spec @@ -75,7 +75,7 @@ # The following line is generated from dependencies.yaml %define devel_no_selenium_requires %build_requires %cover_requires %qemu %test_requires curl perl(Perl::Tidy) postgresql-devel rsync sudo tar xorg-x11-fonts # The following line is generated from dependencies.yaml -%define devel_requires %devel_no_selenium_requires chromedriver shfmt +%define devel_requires %devel_no_selenium_requires chromedriver Name: openQA Version: 4.6 diff --git a/external/os-autoinst-common/.editorconfig b/external/os-autoinst-common/.editorconfig index be91dcd9e9f..503c34cfdf9 100644 --- a/external/os-autoinst-common/.editorconfig +++ b/external/os-autoinst-common/.editorconfig @@ -2,6 +2,8 @@ indent_style = space indent_size = 4 binary_next_line = true +switch_case_indent = true +space_redirects = true [.bpan/**] ignore = true diff --git a/external/os-autoinst-common/.gitrepo b/external/os-autoinst-common/.gitrepo index f0ca2baaf00..f6aa8d56e6f 100644 --- a/external/os-autoinst-common/.gitrepo +++ b/external/os-autoinst-common/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:os-autoinst/os-autoinst-common.git branch = master - commit = ef465670789c9b49ce0e4e1f3da61c2cc313a0e0 - parent = 6ca685738c5db7ccdd9394dec8d4841a293c65ec + commit = fbd66e7f61d2397f55bc8b6143a405c8ed639008 + parent = 7f2e4f335e1ce7b7d89e5056da4acbb82b18bc94 method = merge cmdver = 0.4.6 diff --git a/script/configure-web-proxy b/script/configure-web-proxy index c438e8fc6f8..ae272336d04 100755 --- a/script/configure-web-proxy +++ b/script/configure-web-proxy @@ -1,7 +1,7 @@ #!/bin/bash -e usage() { - cat </etc/nginx/vhosts.d/openqa.conf + sed "s/openqa.example.com/$(hostname)/" /etc/nginx/vhosts.d/openqa.conf.template > /etc/nginx/vhosts.d/openqa.conf sed -i -e "s/\(^[^#]*server_name localhost;\)/#\1/" /etc/nginx/nginx.conf elif [[ $web_proxy == "apache" || $web_proxy == "apache2" ]]; then echo "Setting up apache" for i in headers proxy proxy_http proxy_wstunnel rewrite; do a2enmod $i; done - sed "s/#ServerName.*$/ServerName $(hostname)/" /etc/apache2/vhosts.d/openqa.conf.template >/etc/apache2/vhosts.d/openqa.conf + sed "s/#ServerName.*$/ServerName $(hostname)/" /etc/apache2/vhosts.d/openqa.conf.template > /etc/apache2/vhosts.d/openqa.conf else echo "No supported proxy: $web_proxy" exit 1 diff --git a/script/openqa-auto-update b/script/openqa-auto-update index ed59179d066..5efa2d3872c 100755 --- a/script/openqa-auto-update +++ b/script/openqa-auto-update @@ -3,7 +3,7 @@ set -e set -o pipefail usage() { - cat </dev/null || (command -v rebootmgrctl >/dev/null && rebootmgrctl reboot || :) +needs-restarting --reboothint > /dev/null || (command -v rebootmgrctl > /dev/null && rebootmgrctl reboot || :) diff --git a/script/openqa-bootstrap b/script/openqa-bootstrap index 6986422d065..2aebd62fb83 100755 --- a/script/openqa-bootstrap +++ b/script/openqa-bootstrap @@ -105,20 +105,20 @@ if [ -z "$skip_suse_tests" ]; then fi # ensure that the hostname is mapped to 127.0.0.1 (needed for livehandler) -grep -q "$(hostname)" /etc/hosts || echo "127.0.0.1 $(hostname)" >>/etc/hosts +grep -q "$(hostname)" /etc/hosts || echo "127.0.0.1 $(hostname)" >> /etc/hosts # start daemons if [ -z "$running_systemd" ]; then - pgrep -f openqa-scheduler-daemon >/dev/null || su geekotest -c /usr/share/openqa/script/openqa-scheduler-daemon & - pgrep -f openqa-websockets-daemon >/dev/null || su geekotest -c /usr/share/openqa/script/openqa-websockets-daemon & - pgrep -f openqa-gru >/dev/null || su geekotest -c /usr/share/openqa/script/openqa-gru & - pgrep -f openqa-livehandler-daemon >/dev/null || su geekotest -c /usr/share/openqa/script/openqa-livehandler-daemon & + pgrep -f openqa-scheduler-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-scheduler-daemon & + pgrep -f openqa-websockets-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-websockets-daemon & + pgrep -f openqa-gru > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-gru & + pgrep -f openqa-livehandler-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-livehandler-daemon & if [[ $setup_web_proxy == "nginx" ]]; then nginx else /usr/sbin/start_apache2 -k start fi - pgrep -f openqa-webui-daemon >/dev/null || su geekotest -c /usr/share/openqa/script/openqa-webui-daemon & + pgrep -f openqa-webui-daemon > /dev/null || su geekotest -c /usr/share/openqa/script/openqa-webui-daemon & else if [[ $setup_web_proxy == "nginx" ]]; then systemctl enable --now nginx @@ -140,7 +140,7 @@ API_KEY=$(hexdump -n 8 -e '2/4 "%08X" 1 "\n"' /dev/random) API_SECRET=$(hexdump -n 8 -e '2/4 "%08X" 1 "\n"' /dev/random) echo "INSERT INTO api_keys (key, secret, user_id, t_created, t_updated) VALUES ('${API_KEY}', '${API_SECRET}', 2, NOW(), NOW());" | su postgres -c "psql $dbname" -cat >>/etc/openqa/client.conf <> /etc/openqa/client.conf << EOF [localhost] key = ${API_KEY} secret = ${API_SECRET} diff --git a/script/openqa-bootstrap-container b/script/openqa-bootstrap-container index 84c3f09e45c..f5776860131 100755 --- a/script/openqa-bootstrap-container +++ b/script/openqa-bootstrap-container @@ -33,7 +33,7 @@ PKGS_TO_INSTALL="aaa_base systemd shadow zypper openSUSE-release vim iproute2 ip zypper -n install systemd-container mkdir -p /var/lib/machines/ -cat >/etc/systemd/system/systemd-nspawn-openqa@.service < /etc/systemd/system/systemd-nspawn-openqa@.service << EOF [Unit] Description=Container %i Documentation=man:systemd-nspawn(1) diff --git a/script/openqa-check-devel-repo b/script/openqa-check-devel-repo index af6633beb8f..6ca00fd035a 100755 --- a/script/openqa-check-devel-repo +++ b/script/openqa-check-devel-repo @@ -3,7 +3,7 @@ set -e set -o pipefail usage() { - cat < [CUSTOM_TEST_VAR_1=foo] [CUSTOM_TEST_VAR_2=bar] ... openqa-clone-custom-git-refspec [CUSTOM_TEST_VAR_1=foo] [CUSTOM_TEST_VAR_2=bar] ... @@ -59,24 +59,24 @@ opts=$(getopt -o vhnc: --long verbose,dry-run,help,clone-job-args: -n "$0" -- "$ eval set -- "$opts" while true; do case "$1" in - -v | --verbose) - set -x - shift - ;; - -h | --help) usage 0 ;; - -n | --dry-run) - dry_run=true - shift - ;; - -c | --clone-job-args) - clone_args="$2 $clone_args" - shift 2 - ;; - --) - shift - break - ;; - *) break ;; + -v | --verbose) + set -x + shift + ;; + -h | --help) usage 0 ;; + -n | --dry-run) + dry_run=true + shift + ;; + -c | --clone-job-args) + clone_args="$2 $clone_args" + shift 2 + ;; + --) + shift + break + ;; + *) break ;; esac done job_list="${job:-"$2"}" @@ -127,7 +127,7 @@ clone_job() { local json_url=${host}/tests/${job}/file/vars.json local json_data json_data=$(eval "${curl_openqa} -s ${json_url}") - echo "$json_data" | jq . &>/dev/null \ + echo "$json_data" | jq . &> /dev/null \ || fail "Unreadable openQA job or no valid JSON data encountered. \ Please try 'curl $json_url' or select another job, e.g. in the same scenario: $host/t$job#next_previous" local testsuite="${testsuite:-"$(echo "$json_data" | jq -r '.TEST')"}" || throw_json_error "$json_url" "$json_data" diff --git a/script/openqa-continuous-update b/script/openqa-continuous-update index 90d294c695f..e6fedd80876 100755 --- a/script/openqa-continuous-update +++ b/script/openqa-continuous-update @@ -3,7 +3,7 @@ set -e set -o pipefail usage() { - cat </dev/null 2>&1 && pwd)" +thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" -echo "openSUSE-Leap-15.1-DVD-x86_64-Build470.2-Media.iso" >"$thisdir"/files_iso.lst -echo "Build469.1" >"$thisdir"/Media1_ftp_ftp.lst +echo "openSUSE-Leap-15.1-DVD-x86_64-Build470.2-Media.iso" > "$thisdir"/files_iso.lst +echo "Build469.1" > "$thisdir"/Media1_ftp_ftp.lst diff --git a/t/data/openqa-trigger-from-obs/BatchedProj/Batch2/read_files.sh b/t/data/openqa-trigger-from-obs/BatchedProj/Batch2/read_files.sh index f26b1e7c8d2..570f3dffa8b 100644 --- a/t/data/openqa-trigger-from-obs/BatchedProj/Batch2/read_files.sh +++ b/t/data/openqa-trigger-from-obs/BatchedProj/Batch2/read_files.sh @@ -1,4 +1,4 @@ -thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" -echo "openSUSE-Leap-15.1-DVD-x86_64-Snapshot4704-Media.iso" >"$thisdir"/files_iso.lst -echo "openSUSE-Leap-15.1-DVD-x86_64-Snapshot4703-Media.iso" >>"$thisdir"/files_iso.lst +echo "openSUSE-Leap-15.1-DVD-x86_64-Snapshot4704-Media.iso" > "$thisdir"/files_iso.lst +echo "openSUSE-Leap-15.1-DVD-x86_64-Snapshot4703-Media.iso" >> "$thisdir"/files_iso.lst diff --git a/t/data/openqa-trigger-from-obs/Proj1/read_files.sh b/t/data/openqa-trigger-from-obs/Proj1/read_files.sh index ac296ee7892..70158cf6c08 100644 --- a/t/data/openqa-trigger-from-obs/Proj1/read_files.sh +++ b/t/data/openqa-trigger-from-obs/Proj1/read_files.sh @@ -1,3 +1,3 @@ -thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" -echo "openSUSE-Leap-15.1-DVD-x86_64-Build470.1-Media.iso" >"$thisdir"/files_iso.lst +echo "openSUSE-Leap-15.1-DVD-x86_64-Build470.1-Media.iso" > "$thisdir"/files_iso.lst diff --git a/t/data/openqa-trigger-from-obs/script/rsync.sh b/t/data/openqa-trigger-from-obs/script/rsync.sh index 87a109f29d0..30f9e45c9d6 100755 --- a/t/data/openqa-trigger-from-obs/script/rsync.sh +++ b/t/data/openqa-trigger-from-obs/script/rsync.sh @@ -1,6 +1,6 @@ #!/bin/bash -thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" function sleep_until_file_created { for ((i = 0; i < 20; i += 1)); do diff --git a/t/dummy-isotovideo.sh b/t/dummy-isotovideo.sh index 41cc4659fdc..f0e50f8b1b3 100644 --- a/t/dummy-isotovideo.sh +++ b/t/dummy-isotovideo.sh @@ -2,16 +2,16 @@ set -euo pipefail echo "dummy isotovideo started with arguments: $*" -echo "arguments: $*" >autoinst-log.txt +echo "arguments: $*" > autoinst-log.txt # create fake test results so the web UI thinks we ran at least one test module successfully and considers # the test as passed mkdir -p testresults -echo '[{"category":"dummy","name":"fake","script":"none","flags":{}}]' >testresults/test_order.json -echo '{"dents":0,"details":[],"result":"ok"}' >testresults/result-fake.json -echo '{"current_test":"fake","status":"finished","test_execution_paused":0}' >autoinst-status.json +echo '[{"category":"dummy","name":"fake","script":"none","flags":{}}]' > testresults/test_order.json +echo '{"dents":0,"details":[],"result":"ok"}' > testresults/result-fake.json +echo '{"current_test":"fake","status":"finished","test_execution_paused":0}' > autoinst-status.json # also add a vars.json file for less distracting error messages in the test log -echo '{"ARCH":"x86_64","NAME":"fake-test"}' >vars.json +echo '{"ARCH":"x86_64","NAME":"fake-test"}' > vars.json exit 0 diff --git a/t/test_postgresql b/t/test_postgresql index 7c3f101b675..42bbcc904b5 100755 --- a/t/test_postgresql +++ b/t/test_postgresql @@ -18,7 +18,7 @@ initdb --auth-local=peer -N "$DIR" -U "$(id -u -n)" echo "unix_socket_directories='$DIR'" echo "fsync=off" echo "full_page_writes=off" -) >>"$DIR"/postgresql.conf +) >> "$DIR"/postgresql.conf LOGDIR="$DIR/log" LOGFILE="${LOGFILE:-"$LOGDIR/postgresql-openqa-test.log"}" diff --git a/tools/ci/build_cache.sh b/tools/ci/build_cache.sh index 15824d44c87..5ae812bb989 100755 --- a/tools/ci/build_cache.sh +++ b/tools/ci/build_cache.sh @@ -8,6 +8,6 @@ set -ex sudo zypper ar -f -p 90 https://download.opensuse.org/repositories/devel:/openQA:/Leap:/15.5/15.5 openQA sudo zypper ar -f -p 95 http://download.opensuse.org/repositories/devel:openQA/15.5 devel tools/retry sudo zypper --gpg-auto-import-keys ref -sudo zypper -n install --download-only $(sed -e 's/\r//' /dev/null 2>&1 && pwd)" +thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" CI_PACKAGES=$thisdir/ci-packages.txt DEPS_BEFORE="${DEPS_BEFORE:-"$(mktemp)"}" @@ -15,15 +15,15 @@ listdeps() { rpm -qa --qf "%{NAME}-%{VERSION}\n" | grep -v gpg-pubkey | grep -v openQA | grep -v os-autoinst | sort } -listdeps >"$DEPS_BEFORE" +listdeps > "$DEPS_BEFORE" sudo zypper ar --priority 91 -f https://download.opensuse.org/repositories/devel:openQA/15.5 devel_openQA sudo zypper ar --priority 90 -f https://download.opensuse.org/repositories/devel:/openQA:/Leap:/15.5/15.5 devel_openQA_Leap tools/retry sudo sh -c 'zypper --gpg-auto-import-keys ref && sudo zypper --no-refresh -n install openQA-devel perl-TAP-Harness-JUnit' -listdeps >"$DEPS_AFTER" +listdeps > "$DEPS_AFTER" -comm -13 "$DEPS_BEFORE" "$DEPS_AFTER" >"$CI_PACKAGES" +comm -13 "$DEPS_BEFORE" "$DEPS_AFTER" > "$CI_PACKAGES" # let's tidy if Tidy version changes newtidyver="$(git diff "$CI_PACKAGES" | grep perl-Perl-Tidy | grep '^+' | grep -o '[0-9.]*' || :)" diff --git a/tools/ci/build_local_container.sh b/tools/ci/build_local_container.sh index d3d360eab33..f1de8fc4e51 100755 --- a/tools/ci/build_local_container.sh +++ b/tools/ci/build_local_container.sh @@ -5,16 +5,16 @@ set -e -thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" cre="${cre:-"podman"}" -$cre build -t localtest -f- "$thisdir" <tools/ci/autoinst.sha + curl -s https://api.github.com/repos/os-autoinst/os-autoinst/commits | grep sha | head -n 1 | grep -o -E '[0-9a-f]{40}' > tools/ci/autoinst.sha git add tools/ci/ci-packages.txt tools/ci/autoinst.sha # these might have changed by tidy in tools/ci/build_dependencies.sh git add cpanfile dbicdh dependencies.yaml tools/* script/* lib/* t/* diff --git a/tools/generate-documentation b/tools/generate-documentation index 64266a36767..d2a8dc14b5e 100755 --- a/tools/generate-documentation +++ b/tools/generate-documentation @@ -41,7 +41,7 @@ set -eo pipefail # exit status 0 if any changes detected anything_changed() { - echo '*.pdf -diff' >>.gitattributes + echo '*.pdf -diff' >> .gitattributes git --no-pager diff --shortstat local lines_changed_in_index lines_changed_in_api other_files_changed @@ -99,9 +99,9 @@ update_docs() { git add docs/index.html docs/current.pdf docs/api/testapi.html git add docs/api/schema topic="Update documentation to commit ${shortref}" - echo "$topic" >last.commit - echo "" >>last.commit - [[ -z "${CIRCLE_SHA1}" ]] || (cd .. && git log --pretty=fuller "${CIRCLE_SHA1}" -1 >>out/last.commit) + echo "$topic" > last.commit + echo "" >> last.commit + [[ -z "${CIRCLE_SHA1}" ]] || (cd .. && git log --pretty=fuller "${CIRCLE_SHA1}" -1 >> out/last.commit) git commit -F last.commit if [[ -n "${PUBLISH}" ]] && [[ "${PUBLISH}" != 0 ]]; then git push "$PUSH_REMOTE_URL" "$PUSH_BRANCH" @@ -131,8 +131,8 @@ update_api() { find . -name '*.asciidoc' -not -name 'header' -exec "${asciidoctor_bin}" {} \; while IFS= read -r -d '' file; do - header_template "$file" >"$file.tmp" - cat "$file" >>"$file.tmp" + header_template "$file" > "$file.tmp" + cat "$file" >> "$file.tmp" mv "$file.tmp" "$file" done < <(find . -name '*.html' -print0) cd .. @@ -145,7 +145,7 @@ update_schemas() { header_template() { filename=$(basename -s .html "$1") - cat </dev/null || true # we don't care if the directory already exists + mkdir "${tmpwd}"/output 2> /dev/null || true # we don't care if the directory already exists cp -r images "${tmpwd}"/output [[ ${formats[pdf]} ]] \ diff --git a/tools/generate-packed-assets b/tools/generate-packed-assets index c57512a2a35..0e147d286d2 100755 --- a/tools/generate-packed-assets +++ b/tools/generate-packed-assets @@ -36,7 +36,7 @@ generate() { # shellcheck disable=SC2039 for _ in {1..3}; do # shellcheck disable=SC2086 - env MOJO_MODE="$1" perl $BUILD_CACHE_OPTS -e "$BUILD_CACHE" >/dev/null && return 0 + env MOJO_MODE="$1" perl $BUILD_CACHE_OPTS -e "$BUILD_CACHE" > /dev/null && return 0 rc=$? sleep 1 done diff --git a/tools/js-tidy b/tools/js-tidy index 36dba5c9240..e9d05f1d730 100755 --- a/tools/js-tidy +++ b/tools/js-tidy @@ -1,7 +1,7 @@ #!/bin/bash usage() { - cat </dev/null 2>&1; then +if ! command -v npm > /dev/null 2>&1; then echo "No Node.js found, install it first!" exit 1 fi diff --git a/tools/run-tests-within-container b/tools/run-tests-within-container index 744b26c507d..d3567977a8a 100755 --- a/tools/run-tests-within-container +++ b/tools/run-tests-within-container @@ -37,7 +37,7 @@ run_fullstack_test() { if ! prove -l "${PROVE_ARGS}" "$@"; then touch tests_failed find '/tmp' -path '*/t/full-stack.d/openqa/testresults/*/autoinst-log.txt' \ - -exec echo 'contents of' {} \; -exec cat {} \; 2>/dev/null >'/opt/openqa/autoinst-log.txt' + -exec echo 'contents of' {} \; -exec cat {} \; 2> /dev/null > '/opt/openqa/autoinst-log.txt' fi } diff --git a/tools/test_containers_compose b/tools/test_containers_compose index d6a30bd43aa..23fffcc0180 100755 --- a/tools/test_containers_compose +++ b/tools/test_containers_compose @@ -43,7 +43,7 @@ test_webui() { && cp -r container/webui "$workspace" \ && cd "$workspace/webui" \ && sed -i -e "s/method = OpenID/method = Fake/" conf/openqa.ini - printf "[nginx]\nkey = 1234567890ABCDEF\nsecret = 1234567890ABCDEF\n" >conf/client.conf \ + printf "[nginx]\nkey = 1234567890ABCDEF\nsecret = 1234567890ABCDEF\n" > conf/client.conf \ && setup_containers \ && docker-compose exec -T webui openqa-cli api -X POST jobs ISO=foo.iso DISTRI=my-distri FLAVOR=my-flavor VERSION=42 BUILD=42 TEST=my-test \ --host http://nginx:9526 || ( diff --git a/tools/test_helm_chart b/tools/test_helm_chart index 8c7a835a98d..42ed29b0a4c 100755 --- a/tools/test_helm_chart +++ b/tools/test_helm_chart @@ -1,8 +1,8 @@ #!/bin/bash set -euo pipefail -which helm >/dev/null || echo "Error: Helm is not installed" -which ct >/dev/null || echo "Error: ct is not installed" +which helm > /dev/null || echo "Error: Helm is not installed" +which ct > /dev/null || echo "Error: ct is not installed" cd container/helm diff --git a/tools/tidy b/tools/tidy index 8056d2abdf1..99d85666dac 100755 --- a/tools/tidy +++ b/tools/tidy @@ -4,7 +4,7 @@ # perltidy rules can be found in ../.perltidyrc # usage() { - cat </dev/null 2>&1; then +if ! command -v perltidy > /dev/null 2>&1; then echo "No perltidy found, install it first!" exit 1 fi