34 lines
876 B
Bash
34 lines
876 B
Bash
#!/bin/bash
|
|
|
|
# Function to process diffs and check ignores
|
|
process_diff() {
|
|
local container_id=$1
|
|
local cname=$2
|
|
local ignores=$3
|
|
|
|
# Get the diff
|
|
diff_output=$(docker diff $container_id)
|
|
|
|
# Process ignores
|
|
if [ -n "$ignores" ]; then
|
|
IFS=',' read -ra ignore_array <<< "$ignores"
|
|
for ignore in "${ignore_array[@]}"; do
|
|
diff_output=$(echo "$diff_output" | grep -v "$ignore")
|
|
done
|
|
fi
|
|
|
|
# Write the diff output to a file
|
|
echo "$diff_output" > "${cname}.diff"
|
|
|
|
# Check if there are any changes left after applying ignores
|
|
if [ -n "$diff_output" ]; then
|
|
# Send notification using go-glitch
|
|
echo "$diff_output" | go-glitch
|
|
fi
|
|
}
|
|
|
|
export -f process_diff
|
|
|
|
# Read containers.txt and process each line in parallel
|
|
cat containers.txt | parallel --colsep ' ' 'process_diff {1} {2} {3}'
|
|
./ |