add debug and fix printf
Some checks failed
run tests / run-container (push) Failing after 5s

This commit is contained in:
Ivan Schaller 2023-08-16 11:56:27 +02:00
parent 6a9f799df0
commit 51996b4b33
Signed by: olofvndrhr
GPG key ID: 2A6BE07D99C8C205
3 changed files with 17 additions and 5 deletions

View file

@ -17,6 +17,7 @@ jobs:
- name: single-line options
uses: https://git.44net.ch/actions/docker-run-action@main
with:
debug: true
image: debian:11-slim
volumes: /tmp/:/tmp/
options: -e TESTENV=${{ gitea.workspace }}
@ -25,6 +26,7 @@ jobs:
- name: multi-line options
uses: https://git.44net.ch/actions/docker-run-action@main
with:
debug: true
image: debian:11-slim
volumes: >-
/tmp/:/tmp/

View file

@ -47,8 +47,13 @@ inputs:
docker_network:
description: "Docker container network to use"
default: ${{ job.container.network }}
required: false
default: ${{ job.container.network }}
debug:
description: "Enable debugging"
required: false
default: "false"
runs:
using: "docker"

View file

@ -2,6 +2,11 @@
set -euo pipefail
# set debugging
if [ -n "${INPUT_DEBUG}" ]; then
set -x
fi
RUNTIME_OPTIONS=()
CUSTOM_OPTIONS=()
RUN_COMMAND=()
@ -10,7 +15,7 @@ env | grep -v -E "^(#|;| |PATH|SHLVL|HOSTNAME|DOCKER_*)" | awk '$1 ~ /^\w+=/' |
# login to container registry
if [ -n "${INPUT_USERNAME}" ]; then
printf '%s' "'${INPUT_PASSWORD}'" | docker login "${INPUT_REGISTRY}" -u "${INPUT_USERNAME}" --password-stdin
printf -- '%s' "'${INPUT_PASSWORD}'" | docker login "${INPUT_REGISTRY}" -u "${INPUT_USERNAME}" --password-stdin
fi
# set custom network
@ -24,19 +29,19 @@ if [ "${INPUT_MOUNT_SOCKET,,}" == "true" ]; then
fi
# map volumes
mapfile -t -d ' ' TMP_VOLUMES < <(printf '%s' "${INPUT_VOLUMES}")
mapfile -t -d ' ' TMP_VOLUMES < <(printf -- '%s' "${INPUT_VOLUMES}")
for vol in "${TMP_VOLUMES[@]}"; do
RUNTIME_OPTIONS+=(--volume "${vol}")
done
# get custom options
mapfile -t -d ' ' TMP_OPTIONS < <(printf '%s' "${INPUT_OPTIONS}")
mapfile -t -d ' ' TMP_OPTIONS < <(printf -- '%s' "${INPUT_OPTIONS}")
for opt in "${TMP_OPTIONS[@]}"; do
CUSTOM_OPTIONS+=("${opt}")
done
# get run command
mapfile -t -d ' ' TMP_RUN < <(printf '%s' "${INPUT_RUN}")
mapfile -t -d ' ' TMP_RUN < <(printf -- '%s' "${INPUT_RUN}")
for cmd in "${TMP_RUN[@]}"; do
RUN_COMMAND+=("${cmd}")
done