added sync_ci_to_adjcent_repos.sh
parent
2f4d6de13d
commit
1ec6fd5aff
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
# vim:ts=4:sts=4:sw=4:et
|
||||
#
|
||||
# Author: Hari Sekhon
|
||||
# Date: 2020-02-13 15:36:35 +0000 (Thu, 13 Feb 2020)
|
||||
#
|
||||
# https://github.com/harisekhon/bash-tools
|
||||
#
|
||||
# License: see accompanying Hari Sekhon LICENSE file
|
||||
#
|
||||
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
|
||||
#
|
||||
# https://www.linkedin.com/in/harisekhon
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
[ -n "${DEBUG:-}" ] && set -x
|
||||
srcdir="$(dirname "$0")"
|
||||
|
||||
cd "$srcdir"
|
||||
|
||||
sed 's/#.*//; s/:/ /' "$srcdir/setup/repolist.txt" |
|
||||
grep -v -e bash-tools -e '^[[:space:]]*$' |
|
||||
while read -r repo dir; do
|
||||
if [ -z "$dir" ]; then
|
||||
dir="$repo"
|
||||
fi
|
||||
# filtered above
|
||||
#if ls -lLdi "$dir" "$srcdir" | awk '{print $1}' | uniq -d | grep -q .; then
|
||||
# echo "skipping $dir as it's our directory"
|
||||
# continue
|
||||
#fi
|
||||
repo="$(tr '[:upper:]' '[:lower:]' <<< "$repo")"
|
||||
if ! [ -d "../$dir" ]; then
|
||||
echo "WARNING: repo dir $dir not found, skipping..."
|
||||
continue
|
||||
fi
|
||||
for filename in $(sed 's/#.*//; /^[[:space:]]*$/d' "$srcdir/setup/ci.txt"); do
|
||||
target="../$dir/$filename"
|
||||
echo "syncing $filename -> $target"
|
||||
sed "s,/bash-tools,/$repo," "$filename" > "$target"
|
||||
if [ "$repo" = "nagios-plugins" ]; then
|
||||
perl -pi -e 's/(^[[:space:]]+make ci$)/\1 ci zookeeper-retry/' "$target"
|
||||
fi
|
||||
done
|
||||
done
|
||||
"$srcdir/.github/workflows/sync_to_adjacent_repos.sh"
|
Loading…
Reference in New Issue