ci: fix linter errors: find-container.sh

This commit is contained in:
Michael Grote 2023-11-09 09:03:35 +01:00
parent 993d41945c
commit 3eab1e668f

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
if [[ ! -z "$NEXTCLOUD_PROJECT_NAME" ]]; then
if [[ -n "$NEXTCLOUD_PROJECT_NAME" ]]; then
containerName="${NEXTCLOUD_PROJECT_NAME}[_-]"
matchEnd="[\._-]\d+"
else
@ -12,6 +12,6 @@ containerName="${containerName}${NEXTCLOUD_CONTAINER_NAME}"
# Get the ID of the first matching container so we can exec something in it later
docker ps --format '{{.Names}},{{.ID}}' | \
egrep "^${containerName}${matchEnd}" | \
grep -E "^${containerName}${matchEnd}" | \
awk '{split($0,a,","); print a[2]}' | \
head -n 1