mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add validation for generating default secccomp profile
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
This commit is contained in:
parent
d57816de02
commit
9bc771af9d
4 changed files with 30 additions and 2 deletions
2
Makefile
2
Makefile
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
27
hack/make/validate-default-seccomp
Normal file
27
hack/make/validate-default-seccomp
Normal 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
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue