Skip to content

Commit

Permalink
Run the 'shellcheck' linter as a 'pre-commit' hook
Browse files Browse the repository at this point in the history
  • Loading branch information
brianaydemir committed Dec 5, 2024
1 parent b62d680 commit ea9efaf
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ repos:
# Override the default arguments, which include writing back all
# suggested changes. We don't want false positives to mangle files.
args: [--force-exclude, --sort]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
args: [--severity=warning]
3 changes: 2 additions & 1 deletion github_scripts/citests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ fi
plugin_output=$(./stash_plugin osdf:///ospool/uc-shared/public/OSG-Staff/validation/test.txt query1)
rm query1

# shellcheck disable=SC2076
if ! [[ $plugin_output =~ "TransferUrl = \"osdf:///ospool/uc-shared/public/OSG-Staff/validation/test.txt\"" ]]; then
echo "TransferUrl not in plugin output"
to_exit=1
Expand Down Expand Up @@ -73,7 +74,7 @@ cleanup() {
}
trap cleanup EXIT

for idx in {1..20}; do
for _idx in {1..20}; do
if [ -e "$SOCKET_DIR/socket" ]; then
break
fi
Expand Down
8 changes: 5 additions & 3 deletions github_scripts/osx_install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh -ex
#!/bin/bash
# Copyright (C) 2024, Pelican Project, Morgridge Institute for Research
#
# Licensed under the Apache License, Version 2.0 (the "License"); you
Expand All @@ -14,6 +14,8 @@
# limitations under the License.
#

set -ex

#
# This script installs all the xrootd-related dependencies into the
# Mac OS X instance in GitHub.
Expand All @@ -25,7 +27,7 @@ brew install minio ninja coreutils

# The new macos-latest runner has some issues with /usr/local/<lib/include>. Adjust perms ahead of time
sudo mkdir -p /usr/local/lib && sudo mkdir -p /usr/local/include
sudo chmod -R 777 /usr/local && sudo chown -R $(whoami):admin /usr/local
sudo chmod -R 777 /usr/local && sudo chown -R "$(whoami)":admin /usr/local

mkdir dependencies
pushd dependencies
Expand Down Expand Up @@ -71,7 +73,7 @@ mkdir build
cd build
cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=$PWD/release_dir
ninja install
xrootd_libdir=$(grealpath $(dirname $(grealpath `which xrootd`))/../lib/)
xrootd_libdir=$(grealpath "$(dirname "$(grealpath "$(which xrootd)")")"/../lib/)
echo "Will install into: $xrootd_libdir"
sudo mkdir -p $xrootd_libdir
sudo ln -s $PWD/release_dir/lib/libXrdHTTPServer-5.so $xrootd_libdir
Expand Down
10 changes: 5 additions & 5 deletions images/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if [ "$2" == "origin" ]; then

shopt -s nullglob
for fullfile in /opt/scitokens-server/etc/trusted-cas/*.pem; do
aliasname=$(basename "$file")
filename=$(basename "$fullfile")
aliasname="${filename%.*}"
keytool -cacerts -importcert -noprompt -storepass changeit -file "$fullfile" -alias "$aliasname"
done
Expand Down Expand Up @@ -85,15 +85,15 @@ if [ "$2" == "origin" ]; then
# Tomcat requires us to provide the intermediate chain (which, in Kubernetes, is often in the same
# file as the host certificate itself. If there wasn't one provided, try splitting it out.
if [ ! -e /opt/tomcat/conf/chain.pem ]; then
pushd /tmp > /dev/null
pushd /tmp > /dev/null || { echo "pushd failed"; exit 1; }
if csplit -f tls- -b "%02d.crt.pem" -s -z "/opt/tomcat/conf/hostcert.pem" '/-----BEGIN CERTIFICATE-----/' '{1}' 2>/dev/null ; then
cp /tmp/tls-01.crt.pem /opt/tomcat/conf/chain.pem
rm /tmp/tls-*.crt.pem
else
# No intermediate CAs found. Create an empty file.
touch /opt/tomcat/conf/chain.pem
fi
popd > /dev/null
popd > /dev/null || { echo "popd failed"; exit 1; }
fi
fi

Expand All @@ -113,15 +113,15 @@ if [ $# -ne 0 ]; then
case "$program_selector" in
pelican)
# Run pelican with the rest of the arguments
echo "Running pelican with arguments: $@"
echo "Running pelican with arguments: $*"
exec tini -- /pelican/pelican "$@"
# we shouldn't get here
echo >&2 "Exec of tini failed!"
exit 1
;;
osdf)
# Run osdf with the rest of the arguments
echo "Running osdf with arguments: $@"
echo "Running osdf with arguments: $*"
exec tini -- /pelican/osdf "$@"
# we shouldn't get here
echo >&2 "Exec of tini failed!"
Expand Down
2 changes: 1 addition & 1 deletion web_ui/frontend/dev/image/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ echo "Starting cron"
cron

# Run the original Docker entrypoint script with any passed arguments
echo "Running original Docker entrypoint script with arguments: $@"
echo "Running original Docker entrypoint script with arguments: $*"
/docker-entrypoint.sh "$@"

0 comments on commit ea9efaf

Please sign in to comment.