mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Validate toml
Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <princess@docker.com> (github: jfrazelle) Docker-DCO-1.1-Signed-off-by: Jessie Frazelle <hugs@docker.com> (github: jfrazelle)
This commit is contained in:
parent
87fd6375f1
commit
d245a8a706
5 changed files with 37 additions and 2 deletions
|
@ -10,5 +10,5 @@ script:
|
||||||
- rm integration-cli/docker_cli_daemon_test.go
|
- rm integration-cli/docker_cli_daemon_test.go
|
||||||
- rm integration-cli/docker_cli_exec_test.go
|
- rm integration-cli/docker_cli_exec_test.go
|
||||||
# Validate and test.
|
# Validate and test.
|
||||||
- hack/make.sh validate-dco validate-gofmt
|
- hack/make.sh validate-dco validate-gofmt validate-toml
|
||||||
- hack/make.sh binary cross test-unit test-integration-cli test-integration test-docker-py
|
- hack/make.sh binary cross test-unit test-integration-cli test-integration test-docker-py
|
||||||
|
|
|
@ -155,6 +155,10 @@ RUN set -x \
|
||||||
&& git clone -b v1.2 https://github.com/russross/blackfriday.git /go/src/github.com/russross/blackfriday \
|
&& git clone -b v1.2 https://github.com/russross/blackfriday.git /go/src/github.com/russross/blackfriday \
|
||||||
&& go install -v github.com/cpuguy83/go-md2man
|
&& go install -v github.com/cpuguy83/go-md2man
|
||||||
|
|
||||||
|
# install toml validator
|
||||||
|
RUN git clone -b v0.1.0 https://github.com/BurntSushi/toml.git /go/src/github.com/BurntSushi/toml \
|
||||||
|
&& go install -v github.com/BurntSushi/toml/cmd/tomlv
|
||||||
|
|
||||||
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
# Wrap all commands in the "docker-in-docker" script to allow nested containers
|
||||||
ENTRYPOINT ["hack/dind"]
|
ENTRYPOINT ["hack/dind"]
|
||||||
|
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -74,7 +74,7 @@ test-docker-py: build
|
||||||
$(DOCKER_RUN_DOCKER) hack/make.sh binary test-docker-py
|
$(DOCKER_RUN_DOCKER) hack/make.sh binary test-docker-py
|
||||||
|
|
||||||
validate: build
|
validate: build
|
||||||
$(DOCKER_RUN_DOCKER) hack/make.sh validate-gofmt validate-dco
|
$(DOCKER_RUN_DOCKER) hack/make.sh validate-gofmt validate-dco validate-toml
|
||||||
|
|
||||||
shell: build
|
shell: build
|
||||||
$(DOCKER_RUN_DOCKER) bash
|
$(DOCKER_RUN_DOCKER) bash
|
||||||
|
|
|
@ -44,6 +44,7 @@ echo
|
||||||
DEFAULT_BUNDLES=(
|
DEFAULT_BUNDLES=(
|
||||||
validate-dco
|
validate-dco
|
||||||
validate-gofmt
|
validate-gofmt
|
||||||
|
validate-toml
|
||||||
|
|
||||||
binary
|
binary
|
||||||
|
|
||||||
|
|
30
project/make/validate-toml
Normal file
30
project/make/validate-toml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source "$(dirname "$BASH_SOURCE")/.validate"
|
||||||
|
|
||||||
|
IFS=$'\n'
|
||||||
|
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'MAINTAINERS' || true) )
|
||||||
|
unset IFS
|
||||||
|
|
||||||
|
badFiles=()
|
||||||
|
for f in "${files[@]}"; do
|
||||||
|
# we use "git show" here to validate that what's committed is formatted
|
||||||
|
if [ "$(git show "$VALIDATE_HEAD:$f" | tomlv)" ]; then
|
||||||
|
badFiles+=( "$f" )
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||||
|
echo 'Congratulations! All toml source files have valid syntax.'
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "These files are not valid toml:"
|
||||||
|
for f in "${badFiles[@]}"; do
|
||||||
|
echo " - $f"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
echo 'Please reformat the above files as valid toml'
|
||||||
|
echo
|
||||||
|
} >&2
|
||||||
|
false
|
||||||
|
fi
|
Loading…
Reference in a new issue