add validation for generating default secccomp profile

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
This commit is contained in:
Jessica Frazelle 2016-02-08 10:52:53 -08:00
parent d57816de02
commit 9bc771af9d
No known key found for this signature in database
GPG Key ID: 18F3685C0022BFF3
4 changed files with 30 additions and 2 deletions

View File

@ -116,4 +116,4 @@ test-unit: build
$(DOCKER_RUN_DOCKER) hack/make.sh test-unit
validate: build
$(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-gofmt validate-pkg validate-lint validate-test validate-toml validate-vet validate-vendor
$(DOCKER_RUN_DOCKER) hack/make.sh validate-dco validate-default-seccomp validate-gofmt validate-pkg validate-lint validate-test validate-toml validate-vet validate-vendor

View File

@ -56,6 +56,7 @@ echo
# List of bundles to create when no argument is passed
DEFAULT_BUNDLES=(
validate-dco
validate-default-seccomp
validate-gofmt
validate-lint
validate-pkg

View File

@ -0,0 +1,27 @@
#!/bin/bash
source "${MAKEDIR}/.validate"
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'profiles/seccomp' || true) )
unset IFS
if [ ${#files[@]} -gt 0 ]; then
# We run vendor.sh to and see if we have a diff afterwards
go generate ./profiles/seccomp/ >/dev/null
# Let see if the working directory is clean
diffs="$(git status --porcelain -- profiles/seccomp 2>/dev/null)"
if [ "$diffs" ]; then
{
echo 'The result of go generate ./profiles/seccomp/ differs'
echo
echo "$diffs"
echo
echo 'Please re-run go generate ./profiles/seccomp/'
echo
} >&2
false
else
echo 'Congratulations! Seccomp profile generation is done correctly.'
fi
fi

View File

@ -29,7 +29,7 @@ func main() {
panic(err)
}
if err := ioutil.WriteFile(f, b, 0755); err != nil {
if err := ioutil.WriteFile(f, b, 0644); err != nil {
panic(err)
}
}