Maintenance: make shellcheck stricter to fail on 'warning' messages, and remove lint-bash-scripts from Github CI.

This commit is contained in:
Martin Gruner 2021-06-18 10:44:24 +02:00
parent 333d4aef8c
commit 63825b012d
7 changed files with 10 additions and 35 deletions

View file

@ -1,18 +0,0 @@
#!/bin/sh
#
# lint bash scripts
#
set -o errexit
CONFIG_DIR=".github"
TMP_FILE="$(mktemp)"
find "${CONFIG_DIR}" -type f -name "*.sh" > "${TMP_FILE}"
while read -r FILE; do
echo lint "${FILE}"
shellcheck -x "${FILE}"
done < "${TMP_FILE}"

View file

@ -4,19 +4,8 @@ on:
pull_request pull_request
jobs: jobs:
lint-bash-scripts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Lint Bash scripts
uses: docker://koalaman/shellcheck-alpine:v0.7.0
with:
args: .github/lint-scripts.sh
ci: ci:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: lint-bash-scripts
services: services:
mysql: mysql:
image: mysql:5 image: mysql:5

View file

@ -4,10 +4,12 @@
# #
PATH=/sbin:/bin:/usr/sbin:/usr/bin: PATH=/sbin:/bin:/usr/sbin:/usr/bin:
# shellcheck disable=SC2046
BACKUP_SCRIPT_PATH="$(dirname $(realpath $0))" BACKUP_SCRIPT_PATH="$(dirname $(realpath $0))"
if [ -f "${BACKUP_SCRIPT_PATH}/config" ]; then if [ -f "${BACKUP_SCRIPT_PATH}/config" ]; then
# Ensure we're inside of our Backup-Script folder (see issue 2508) # Ensure we're inside of our Backup-Script folder (see issue 2508)
# shellcheck disable=SC2164
cd "${BACKUP_SCRIPT_PATH}" cd "${BACKUP_SCRIPT_PATH}"
# import config # import config

View file

@ -4,6 +4,7 @@
# #
PATH=/sbin:/bin:/usr/sbin:/usr/bin: PATH=/sbin:/bin:/usr/sbin:/usr/bin:
# shellcheck disable=SC2046
BACKUP_SCRIPT_PATH="$(dirname $(realpath $0))" BACKUP_SCRIPT_PATH="$(dirname $(realpath $0))"
if [ -f "${BACKUP_SCRIPT_PATH}/config" ]; then if [ -f "${BACKUP_SCRIPT_PATH}/config" ]; then

View file

@ -22,7 +22,8 @@ function check_os()
# Debian # Debian
if [ -f /etc/debian_version ]; then if [ -f /etc/debian_version ]; then
OS=Debian OS=Debian
local MAJOR=$(cut -d. /etc/debian_version -f1) local MAJOR
MAJOR=$(cut -d. /etc/debian_version -f1)
if [ $MAJOR -lt 7 ]; then if [ $MAJOR -lt 7 ]; then
echo Please check the supported operating systems echo Please check the supported operating systems
exit 1 exit 1
@ -54,9 +55,9 @@ fi
HOMEDIR=$(getent passwd $USER | cut -d: -f 6) HOMEDIR=$(getent passwd $USER | cut -d: -f 6)
GROUP=$(id -gn $USER) GROUP=$(id -gn $USER)
cd "${HOMEDIR}" cd "${HOMEDIR}" || exit 1
sudo -u "${USER}" -H git clone $REPOURL zammad sudo -u "${USER}" -H git clone $REPOURL zammad
cd zammad cd zammad || exit 1
LATEST=$(git tag --list|sort|tail -1) LATEST=$(git tag --list|sort|tail -1)
git checkout tags/"${LATEST}" git checkout tags/"${LATEST}"
chown -R "${USER}":"${GROUP}" . chown -R "${USER}":"${GROUP}" .

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
echo "Zammad S/MIME test certificate generation" echo "Zammad S/MIME test certificate generation"
@ -79,6 +79,7 @@ do
done done
echo "Generating from CA chain" echo "Generating from CA chain"
# shellcheck disable=SC2043
for EMAIL_ADDRESS in chain@example.com for EMAIL_ADDRESS in chain@example.com
do do
if [[ ! -e "$CERT_DIR/$EMAIL_ADDRESS.crt" ]] if [[ ! -e "$CERT_DIR/$EMAIL_ADDRESS.crt" ]]

View file

@ -5,5 +5,4 @@ set -o pipefail
docker build --no-cache -t zammad/smime-test-certificates:latest . docker build --no-cache -t zammad/smime-test-certificates:latest .
docker run --rm -v `pwd`/../:/etc/ssl/certs zammad/smime-test-certificates:latest docker run --rm -v "$(pwd)/../:/etc/ssl/certs" zammad/smime-test-certificates:latest