From 545e81714b0ae06f00fe90a2138ab89f4fe3a6e7 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 7 Oct 2019 15:20:03 +0200 Subject: [PATCH] hack/validate: allow forcing validation This introduces a FORCE_VALIDATE environment variable, which allows forcing some validation steps, even if no changes were detected. Signed-off-by: Sebastiaan van Stijn --- Makefile | 1 + hack/validate/default-seccomp | 2 +- hack/validate/swagger | 4 ++-- hack/validate/swagger-gen | 4 ++-- hack/validate/vendor | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 9e49843660..cfac707590 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,7 @@ DOCKER_ENVS := \ -e DOCKER_TEST_HOST \ -e DOCKER_USERLANDPROXY \ -e DOCKERD_ARGS \ + -e TEST_FORCE_VALIDATE \ -e TEST_INTEGRATION_DIR \ -e TEST_SKIP_INTEGRATION \ -e TEST_SKIP_INTEGRATION_CLI \ diff --git a/hack/validate/default-seccomp b/hack/validate/default-seccomp index 24cbf00d24..32921ae268 100755 --- a/hack/validate/default-seccomp +++ b/hack/validate/default-seccomp @@ -7,7 +7,7 @@ IFS=$'\n' files=( $(validate_diff --diff-filter=ACMR --name-only -- 'profiles/seccomp' || true) ) unset IFS -if [ ${#files[@]} -gt 0 ]; then +if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then # We run 'go generate' and see if we have a diff afterwards go generate ./profiles/seccomp/ >/dev/null # Let see if the working directory is clean diff --git a/hack/validate/swagger b/hack/validate/swagger index 58c032a716..927fb0c00a 100755 --- a/hack/validate/swagger +++ b/hack/validate/swagger @@ -7,7 +7,7 @@ IFS=$'\n' files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/swagger.yaml' || true) ) unset IFS -if [ ${#files[@]} -gt 0 ]; then - LANG=C.UTF-8 yamllint -c ${SCRIPTDIR}/.swagger-yamllint api/swagger.yaml +if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then + LANG=C.UTF-8 yamllint -c "${SCRIPTDIR}"/.swagger-yamllint api/swagger.yaml swagger validate api/swagger.yaml fi diff --git a/hack/validate/swagger-gen b/hack/validate/swagger-gen index 744f627eb4..118cff057e 100755 --- a/hack/validate/swagger-gen +++ b/hack/validate/swagger-gen @@ -7,8 +7,8 @@ IFS=$'\n' files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/types/' 'api/swagger.yaml' || true) ) unset IFS -if [ ${#files[@]} -gt 0 ]; then - ${SCRIPTDIR}/../generate-swagger-api.sh 2> /dev/null +if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then + "${SCRIPTDIR}"/../generate-swagger-api.sh 2> /dev/null # Let see if the working directory is clean diffs="$(git diff -- api/types/)" if [ "$diffs" ]; then diff --git a/hack/validate/vendor b/hack/validate/vendor index 66700af9c7..d8634d1da8 100755 --- a/hack/validate/vendor +++ b/hack/validate/vendor @@ -8,7 +8,7 @@ validate_vendor_diff(){ files=( $(validate_diff --diff-filter=ACMR --name-only -- 'vendor.conf' 'vendor/' || true) ) unset IFS - if [ ${#files[@]} -gt 0 ]; then + if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then # recreate vendor/ vndr # check if any files have changed