Skip to content

Commit e376f23

Browse files
author
Matthew Fisher
committed
feat(builder): add repo check script
This script parses through /deis/services and removes all repositories that have been removed from the controller.
1 parent e7c18a1 commit e376f23

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

builder/conf.d/check-repos.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[template]
2+
src = "check-repos"
3+
dest = "/home/git/check-repos"
4+
uid = 0
5+
gid = 0
6+
mode = "0755"
7+
keys = [
8+
"/deis/services",
9+
]
10+
reload_cmd = "/home/git/check-repos"

builder/templates/check-repos

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
listcontains() {
4+
for word in $1; do
5+
[[ $word = $2 ]] && return 0
6+
done
7+
return 1
8+
}
9+
10+
cd $(dirname $0) # absolute path
11+
12+
for repo in *.git;
13+
do
14+
reponame="${repo%.*}"
15+
if ! listcontains "{{ range $services := .deis_services }}{{ Base $services.Key }} {{ end }}" "$reponame";
16+
then
17+
rm -rf "$repo"
18+
fi
19+
done

0 commit comments

Comments
 (0)