Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
412c8883bc | ||
|
|
c1a24fedfd |
@@ -32,7 +32,7 @@ repos:
|
||||
- id: dart-check
|
||||
name: dart format (autofix) + check-fast (parallel)
|
||||
language: system
|
||||
entry: bash -c 'cd "$(git rev-parse --show-toplevel)" && nix develop --command dagger call --progress=plain -q -m ci --source=. check-fast'
|
||||
entry: bash -c 'cd "$(git rev-parse --show-toplevel)" && scripts/precommit_dart_check.sh'
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
- id: ci-no-direct-dagger
|
||||
|
||||
@@ -124,9 +124,6 @@
|
||||
# nix develop --command does not set IN_NIX_SHELL; set it so _preflight passes in CI
|
||||
export IN_NIX_SHELL=1
|
||||
|
||||
# Point Dagger client at the running engine socket
|
||||
export DAGGER_HOST=unix:///run/dagger/engine.sock
|
||||
|
||||
# Disable Flutter telemetry inside dev shell
|
||||
export FLUTTER_SUPPRESS_ANALYTICS=true
|
||||
|
||||
|
||||
Executable
+42
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pre-commit wrapper for the `dart-check` hook.
|
||||
#
|
||||
# `dagger call ... check-fast` needs a Dagger engine. On a dev machine or in
|
||||
# CI that engine is provisioned from a local container runtime (docker/podman)
|
||||
# or reached through _EXPERIMENTAL_DAGGER_RUNNER_HOST. In engine-less sandboxes
|
||||
# (e.g. the agentloop agent pods that commit on our behalf) none of those
|
||||
# exist, so dagger falls back to its default engine image reference and aborts
|
||||
# with:
|
||||
# start engine: driver for scheme "image" was not available
|
||||
# which blocked every commit the agent tried to make.
|
||||
#
|
||||
# Codeberg CI still runs check-fast on every push, so skipping here is safe:
|
||||
# warn loudly and let the commit through when no engine can be reached.
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
# True when dagger has some way to reach/provision an engine.
|
||||
engine_available() {
|
||||
# A shared engine reached over the wire wins outright.
|
||||
[ -n "${_EXPERIMENTAL_DAGGER_RUNNER_HOST:-}" ] && return 0
|
||||
# Otherwise dagger provisions the engine from a local container runtime.
|
||||
# `info` (not `version`) confirms the daemon is actually reachable; cap it
|
||||
# with a timeout so a stale docker context cannot hang the commit.
|
||||
if command -v docker >/dev/null 2>&1 && timeout 10 docker info >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
if command -v podman >/dev/null 2>&1 && timeout 10 podman info >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
if ! engine_available; then
|
||||
echo "WARNING: no Dagger engine available (no container runtime, and" \
|
||||
"_EXPERIMENTAL_DAGGER_RUNNER_HOST is unset); skipping dart-check." \
|
||||
"Codeberg CI still runs check-fast on push." >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec nix develop --command dagger call --progress=plain -q -m ci --source=. check-fast
|
||||
Reference in New Issue
Block a user