name: test-commit-validation
mode: mapreduce
setup:
- shell: |
cat > work-items.json << 'EOF'
{
"items": [
{"id": 1, "should_commit": true, "file": "file1.txt"},
{"id": 2, "should_commit": false, "file": "file2.txt"},
{"id": 3, "should_commit": true, "file": "file3.txt"}
]
}
EOF
map:
input: "work-items.json"
json_path: "$.items[*]"
max_parallel: 3
agent_template:
- shell: |
if [ "${item.should_commit}" = "true" ]; then
echo "Creating commit for item ${item.id}"
echo "Test content for item ${item.id}" > ${item.file}
git add ${item.file}
git commit -m "Add ${item.file} for item ${item.id}"
else
echo "Skipping commit for item ${item.id} (should fail validation)"
echo "Test content for item ${item.id}" > ${item.file}
# Deliberately not committing to test validation
fi
commit_required: true
reduce:
- shell: |
echo "Map phase completed"
echo "Expected: 2 successful (id 1,3), 1 failed (id 2)"