Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
Enable shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Oct 26, 2022
1 parent 5882e74 commit a48f839
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ repos:
rev: v0.8.0
hooks:
- id: shellcheck
args:
- --color=always
- # keep at bottom as these are slower
repo: local
hooks:
Expand Down
11 changes: 6 additions & 5 deletions _build/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ else
fi

# current user might not exist in /etc/passwd at all
if ! $(whoami &> /dev/null) || ! getent passwd $(whoami || id -u) &> /dev/null ; then
if ! "$(whoami &> /dev/null)" || ! getent passwd "$(whoami || id -u)" &> /dev/null ; then
if [ -n "$EP_DEBUG" ]; then
echo "adding missing uid $(id -u) into /etc/passwd"
fi
echo "$(id -u):x:$(id -u):0:container user $(id -u):/home/runner:/bin/bash" >> /etc/passwd
export HOME=/home/runner
fi

MYHOME=`getent passwd $(whoami) | cut -d: -f6`
MYHOME=$(getent passwd "$(whoami)" | cut -d: -f6)

if [ "$MYHOME" != "$HOME" ] || [ "$MYHOME" != "/home/runner" ]; then
if [ -n "$EP_DEBUG" ]; then
Expand All @@ -60,17 +60,18 @@ fi
if [[ -n "${LAUNCHED_BY_RUNNER}" ]]; then
# Special actions to be compatible with old ansible-runner versions, 2.1.x specifically
RUNNER_CALLBACKS=$(python3 -c "from ansible_runner.display_callback.callback import awx_display; print(awx_display.__file__)")
export ANSIBLE_CALLBACK_PLUGINS="$(dirname $RUNNER_CALLBACKS)"
ANSIBLE_CALLBACK_PLUGINS="$(dirname "$RUNNER_CALLBACKS")"
export ANSIBLE_CALLBACK_PLUGINS

# old versions split the callback name between awx_display and minimal, but new version just uses awx_display
export ANSIBLE_STDOUT_CALLBACK=awx_display
fi

if [[ -d ${AWX_ISOLATED_DATA_DIR} ]]; then
if output=$(ansible-galaxy collection list --format json 2> /dev/null); then
echo $output > ${AWX_ISOLATED_DATA_DIR}/collections.json
echo "$output" > "${AWX_ISOLATED_DATA_DIR}/collections.json"
fi
ansible --version 2> /dev/null | head -n 1 > ${AWX_ISOLATED_DATA_DIR}/ansible_version.txt
ansible --version 2> /dev/null | head -n 1 > "${AWX_ISOLATED_DATA_DIR}/ansible_version.txt"
fi

for SCRIPT in /usr/local/bin/dumb-init /usr/bin/dumb-init /bin/dumb-init; do
Expand Down
2 changes: 1 addition & 1 deletion _build/validate
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -exuo pipefail

CNT=${1:-quay.io/ansible/creator-ee:latest}

podman run -ti --user="$(id -u)" $CNT uname -a
podman run -ti --user="$(id -u)" "$CNT" uname -a

0 comments on commit a48f839

Please sign in to comment.