-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
externalize clair scanning from bats
- Loading branch information
Showing
2 changed files
with
38 additions
and
27 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,37 @@ | ||
#!/bin/bash | ||
|
||
if [ ! -s ./clair-scanner ]; then | ||
curl -L -o ./clair-scanner https://github.com/arminc/clair-scanner/releases/download/v8/clair-scanner_linux_amd64 | ||
chmod 755 clair-scanner | ||
fi | ||
|
||
docker ps | grep clair-db | ||
if [ $? == "0" ]; then | ||
docker kill db | ||
docker rm db | ||
docker run -p 5432:5432 -d --name db arminc/clair-db:latest | ||
else | ||
docker run -p 5432:5432 -d --name db arminc/clair-db:latest | ||
fi | ||
sleep 30 | ||
|
||
docker ps | grep clair-local-scan | ||
if [ $? == "0" ]; then | ||
docker kill clair | ||
docker rm clair | ||
docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.5 | ||
else | ||
docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.5 | ||
fi | ||
sleep 30 | ||
|
||
./clair-scanner --ip 172.17.0.1 $1 | ||
retcode=$? | ||
|
||
docker kill clair | ||
docker rm clair | ||
docker kill db | ||
docker rm db | ||
|
||
exit $retcode | ||
|
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