Skip to content

Commit

Permalink
lint + skip vendors
Browse files Browse the repository at this point in the history
  • Loading branch information
jpinsonneau committed Mar 14, 2024
1 parent 22c6e20 commit 08ca611
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ ifeq (, $(shell which shellcheck))
@echo "### shellcheck could not be found, skipping shell lint"
else
@echo "### Run shellcheck against bash scripts"
find . -name '*.sh' | xargs shellcheck
find . -name '*.sh' -not -path "./vendor/*" | xargs shellcheck
endif

.PHONY: clean
Expand Down
15 changes: 8 additions & 7 deletions scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@ function loadYAMLs() {
namespaceYAMLContent
'
if [ -f ./res/namespace.yml ]; then
namespaceYAML="`cat ./res/namespace.yml`"
namespaceYAML="$(cat ./res/namespace.yml)"
fi

saYAML='
saYAMLContent
'
if [ -f ./res/service-account.yml ]; then
saYAML="`cat ./res/service-account.yml`"
saYAML="$(cat ./res/service-account.yml)"
fi

flowAgentYAML='
flowAgentYAMLContent
'
if [ -f ./res/flow-capture.yml ]; then
flowAgentYAML="`cat ./res/flow-capture.yml`"
flowAgentYAML="$(cat ./res/flow-capture.yml)"
fi

packetAgentYAML='
packetAgentYAMLContent
'
if [ -f ./res/packet-capture.yml ]; then
packetAgentYAML="`cat ./res/packet-capture.yml`"
packetAgentYAML="$(cat ./res/packet-capture.yml)"
fi

collectorServiceYAML='
collectorServiceYAMLContent
'
if [ -f ./res/collector-service.yml ]; then
collectorServiceYAML="`cat ./res/collector-service.yml`"
collectorServiceYAML="$(cat ./res/collector-service.yml)"
fi
}

Expand Down Expand Up @@ -66,18 +66,19 @@ function setup {
echo "creating collector service"
echo "$collectorServiceYAML" | oc apply -f -

if [ $1 = "flows" ]; then
if [ "$1" = "flows" ]; then
echo "creating flow-capture agents"
echo "${flowAgentYAML/"{{FLOW_FILTER_VALUE}}"/$2}" | oc apply -f -
oc rollout status daemonset netobserv-cli -n netobserv-cli --timeout 60s
elif [ $1 = "packets" ]; then
elif [ "$1" = "packets" ]; then
echo "creating packet-capture agents"
echo "${packetAgentYAML/"{{PCA_FILTER_VALUE}}"/$2}" | oc apply -f -
oc rollout status daemonset netobserv-cli -n netobserv-cli --timeout 60s
fi
}

function cleanup {
# shellcheck disable=SC2034
if output=$(oc whoami 2>&1); then
echo "Copying collector output files..."
mkdir -p ./output
Expand Down
2 changes: 1 addition & 1 deletion scripts/inject.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ -z "$1" ]; then
echo "output generated in tmp folder"
else
echo "output generated in $1 folder"
cp -a ./tmp/. ./$1
cp -a ./tmp/. ./"$1"
rm -rf ./tmp
fi

0 comments on commit 08ca611

Please sign in to comment.