-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflows: added / refined duplication checks
- Loading branch information
Showing
4 changed files
with
38 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Change to the locations directory | ||
cd locations || exit 1 | ||
|
||
# Variable to accumulate duplicate findings | ||
all_duplicates="" | ||
|
||
# Iterate over each file in the directory | ||
for file in ./*; do | ||
# Check if it is a file | ||
if [ -f "$file" ]; then | ||
# Extract vids / vid names, sort, and find duplicates | ||
duplicates_vid=$(yq 'select(.networks != null) | .networks[].vid' "$file" | grep -v 'null' | sed 's/["'\'']//g' |sort | uniq -cd) | ||
duplicates_name=$(yq 'select(.networks != null) | .networks[].name' "$file" | grep -v 'null' | sed 's/["'\'']//g' | sort | uniq -cd) | ||
# Accumulate duplicates if found | ||
if [ -n "$duplicates_vid" ]; then | ||
all_duplicates+="\nDuplicate VIDs found in $file:\n$duplicates_vid" | ||
fi | ||
if [ -n "$duplicates_name" ]; then | ||
all_duplicates+="\nDuplicate VLAN names found in $file:\n$duplicates_name" | ||
fi | ||
fi | ||
done | ||
|
||
# Check if there were any duplicates found | ||
if [ -n "$all_duplicates" ]; then | ||
echo -e "Duplicates VIDs or VLAN names found:$all_duplicates" | ||
exit 1 | ||
else | ||
echo "No duplicates found." | ||
fi |
This file was deleted.
Oops, something went wrong.
9 changes: 6 additions & 3 deletions
9
.../workflows/check-ip-prefix-duplicates.yml → .github/workflows/check-duplicates.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
--- | ||
name: Check for duplicate IP prefixes | ||
name: Check for duplication errors | ||
|
||
on: [push, pull_request] # yamllint disable-line rule:truthy | ||
|
||
jobs: | ||
check-ip-prefix-duplicates: | ||
check-duplicates: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Run IP prefix duplicate check | ||
- name: Check for duplicates | ||
run: | | ||
./.github/checks/check-address-duplicates.sh | ||
./.github/checks/check-hostname-duplicates.sh | ||
./.github/checks/check-ip-prefix-duplicates.sh | ||
./.github/checks/check-vlan-duplicates.sh |
This file was deleted.
Oops, something went wrong.