Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion just/engine.just
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ build *args:
fi
;;
esac
bash "$build_script" {{args}}
# build.sh picks docker over podman when both are on PATH -- under Docker

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this comment.... should you just fix build.sh to pick podman first and fallback to docker if podman is unavailable?

(I am aware from other discussion in this PR that podman still uses docker runtime in some cases)

# Desktop that lands the build in another WSL distro's VM.
CONTAINER_RUNTIME=podman bash "$build_script" {{args}}
# Skip the mirror for `--help`; otherwise mirror the refreshed install/.
case " {{args}} " in
*" --help "*|*" -h "*) ;;
Expand Down
2 changes: 1 addition & 1 deletion just/lua.just
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RECOIL_DIR := DEVTOOLS_DIR / "RecoilEngine"
BAR_DIR := DEVTOOLS_DIR / "Beyond-All-Reason"
LDE_DIR := DEVTOOLS_DIR / "lua-doc-extractor"
COMPOSE_FILE := DEVTOOLS_DIR / "docker-compose.dev.yml"
COMPOSE := "docker compose -f " + COMPOSE_FILE
COMPOSE := "podman compose -f " + COMPOSE_FILE

# Friendlier name for `library` — same recipe, "build the lua library"
alias build := library
Expand Down
6 changes: 6 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ export DEVTOOLS_DISTROBOX
: "${DEVTOOLS_SYNC_DISTROBOX:=bar-sync}"
export DEVTOOLS_SYNC_DISTROBOX

# Our own Docker client config; Docker Desktop's ~/.docker/config.json names a

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debated putting this in .env, but that file holds user selections and this is derived rather than chosen, so it doesn't really fit.

There's also a timing problem with .env: set dotenv-load reads it when just starts, so a key written at step 0 isn't in the environment for step 4 of that same run. It'd be unset for the first setup::init and correct on every run after — a rough way to fail, since it'd only ever bite a new contributor.

That said, the : below does allow users to override it in their own .env file and it will be honored.

This does add a minor risk if someone has DOCKER_CONFIG on their shell, but that's kind of expected/I'm fine with it — Docker Desktop itself doesn't set that var, it writes ~/.docker/config.json.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine given the use case, I have never heard of someone setting $DOCKER_CONFIG on their environment. Possibly it would be good to emit an info message of $DOCKER_CONFIG envvar set so someone with eagle-eyes can spot it in the log.

# credsStore helper that can't be exec'd from WSL.
: "${DOCKER_CONFIG:=$DEVTOOLS_DIR/.devtools/docker}"
export DOCKER_CONFIG
mkdir -p "$DOCKER_CONFIG"

RED=$'\033[0;31m'
GREEN=$'\033[0;32m'
YELLOW=$'\033[1;33m'
Expand Down
14 changes: 14 additions & 0 deletions scripts/doctor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ check_doctor_deps() {
_pass "podman $(podman --version | awk '{print $3}') + compose $(_compose_version) + socket"
fi

if is_wsl; then
local docker_bin found=""
docker_bin="$(command -v docker 2>/dev/null || true)"
[ -n "$docker_bin" ] && [[ "$(readlink -f "$docker_bin")" == *docker-desktop* ]] \
&& found="docker on PATH"
[ -f "$HOME/.docker/config.json" ] && grep -q '"credsStore"' "$HOME/.docker/config.json" \
&& found="${found:+$found, }credsStore in ~/.docker/config.json"
if [ -n "$found" ]; then
_warn "Docker Desktop detected ($found)"
echo " just recipes pin CONTAINER_RUNTIME/DOCKER_CONFIG around it;"
echo " direct docker-compose or docker-build-v2/build.sh calls will fail"
fi
fi

if ! command -v distrobox &>/dev/null; then
_warn "distrobox not installed (optional — needed for bar::lint, bar::fmt, lua::*)"
echo " Install: just setup::deps"
Expand Down