From 0cacfd088a09b067bc0060b00141d3e07f48046c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 23 Feb 2024 17:20:22 +0100 Subject: [PATCH 1/2] ci(go, common): Expose DEBIAN_FRONTEND as step env variable It could have been set at more global level, but it's not relevant yet. --- gh-actions/common/build-debian/action.yml | 6 ++++-- gh-actions/go/code-sanity/action.yaml | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gh-actions/common/build-debian/action.yml b/gh-actions/common/build-debian/action.yml index a912bfeb..82f9c9aa 100644 --- a/gh-actions/common/build-debian/action.yml +++ b/gh-actions/common/build-debian/action.yml @@ -43,12 +43,14 @@ runs: steps: - name: Set up source package build shell: bash + env: + DEBIAN_FRONTEND: noninteractive run: | set -eu echo "::group::Install devscripts" - DEBIAN_FRONTEND=noninteractive sudo apt update - DEBIAN_FRONTEND=noninteractive sudo apt install -y devscripts + sudo apt update + sudo apt install -y devscripts echo "::endgroup::" echo "::group::Append commit SHA to local version" diff --git a/gh-actions/go/code-sanity/action.yaml b/gh-actions/go/code-sanity/action.yaml index 305bc8f9..43cbbc7a 100644 --- a/gh-actions/go/code-sanity/action.yaml +++ b/gh-actions/go/code-sanity/action.yaml @@ -27,14 +27,16 @@ runs: cache: false - name: Set up jq shell: bash + env: + DEBIAN_FRONTEND: noninteractive run: | echo "::group::Download jq" if [ "${{runner.os}}" = "Windows" ]; then winget.exe install jqlang.jq --accept-source-agreements --accept-package-agreements --silent --verbose || true else sudo --version &> /dev/null && SUDO="sudo" || SUDO="" - DEBIAN_FRONTEND=noninteractive $SUDO apt update - DEBIAN_FRONTEND=noninteractive $SUDO apt install jq + $SUDO apt update + $SUDO apt install jq fi echo "::endgroup::" jq --version From 9175586ea190e9a4e0abb2955a899ae8c86c0e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 23 Feb 2024 17:21:56 +0100 Subject: [PATCH 2/2] ci(go): Use command -v to find if sudo is around and its path It's the shellcheck suggested way to find out whether a command is there, and just nicer to use as it doesn't imply launching anything else. --- gh-actions/go/code-sanity/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gh-actions/go/code-sanity/action.yaml b/gh-actions/go/code-sanity/action.yaml index 43cbbc7a..25acbada 100644 --- a/gh-actions/go/code-sanity/action.yaml +++ b/gh-actions/go/code-sanity/action.yaml @@ -34,7 +34,7 @@ runs: if [ "${{runner.os}}" = "Windows" ]; then winget.exe install jqlang.jq --accept-source-agreements --accept-package-agreements --silent --verbose || true else - sudo --version &> /dev/null && SUDO="sudo" || SUDO="" + SUDO=$(command -v sudo || true) $SUDO apt update $SUDO apt install jq fi @@ -116,7 +116,7 @@ runs: # A terrible workaround for https://github.com/golangci/golangci-lint-action/issues/135 # Avoid using sudo (it is unavailable in docker) - sudo --version &> /dev/null && SUDO="sudo" || SUDO="" + SUDO=$(command -v sudo || true) $SUDO chmod -R +w ../../../go/ - name: Code formatting, vet, static checker Security…