Skip to content
Open
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
14 changes: 12 additions & 2 deletions .dagger/src/operator_flows/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ async def _get_hook_env_vars(self, test_artifacts: dagger.Directory) -> Dict[str
hooks_container = (
dag.container()
.from_("alpine:latest")
.with_exec(["apk", "add", "--no-cache", "shellcheck", "bash"])
.with_directory("/test_artifacts", test_artifacts)
.with_exec(["tree", "/test_artifacts"])
.with_exec(["sh", "-c", """
Expand All @@ -605,15 +606,24 @@ async def _get_hook_env_vars(self, test_artifacts: dagger.Directory) -> Dict[str
if [ -d "$hook_dir" ]; then
# Extract hook name from directory name (remove "hook_" prefix)
hook_name=$(basename "$hook_dir" | sed 's/^hook_//')

# Check if hook.sh exists
if [ -f "$hook_dir/hook.sh" ]; then
echo "Found hook: $hook_name -> $hook_dir/hook.sh"

# Validate hook script with shellcheck (only fail on errors, not warnings/style)
echo "Validating $hook_dir/hook.sh with shellcheck..."
if ! shellcheck --severity=error "$hook_dir/hook.sh"; then
echo "ERROR: shellcheck validation failed for $hook_dir/hook.sh"
exit 1
fi
echo "shellcheck validation passed for $hook_dir/hook.sh"

hook_env_vars="$hook_env_vars\\n$hook_name=$hook_dir/hook.sh"
fi
fi
done

# Save hook environment variables to a file
echo -e "$hook_env_vars" > /hooks_env_vars.txt
"""])
Expand Down
Loading