Skip to content

Commit

Permalink
Fix verifying make targets
Browse files Browse the repository at this point in the history
Make evaluates conditions in the preprocessing phase - before any target
is executed. It means that we will not be able to detect the changes
made by make or make generate in a make condition.

This change fixes this issue by moving the check into a dedicated script
and calling it from the verifying targets.

We also now sync kubevirt ci in the dedicated container to avoid issues
with different tool versions.

Signed-off-by: Daniel Belenky <[email protected]>
  • Loading branch information
Daniel Belenky committed Aug 30, 2020
1 parent 08be23f commit 1dddf1d
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
22 changes: 9 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ bazel-generate:
bazel-build:
hack/dockerized "hack/bazel-fmt.sh && hack/bazel-build.sh"

bazel-build-verify: TARGET_TO_RUN='make'
bazel-build-verify: bazel-build check-git-tree-state build-verify bazel-test
bazel-build-verify: bazel-build
./hack/dockerized "hack/bazel-fmt.sh"
./hack/verify-generate.sh
./hack/build-verify.sh
./hack/dockerized "hack/bazel-test.sh"

bazel-build-images:
hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} DOCKER_TAG_ALT=${DOCKER_TAG_ALT} IMAGE_PREFIX=${IMAGE_PREFIX} IMAGE_PREFIX_ALT=${IMAGE_PREFIX_ALT} ./hack/bazel-build-images.sh"
Expand All @@ -29,24 +32,17 @@ bazel-push-images:

push: bazel-push-images

check-git-tree-state:
ifneq ($(strip $(shell git status --porcelain 2>/dev/null)),)
$(error git tree is not clean, you probably need to run '${TARGET_TO_RUN}' and commit the changes)
endif

check-for-binaries:
hack/check-for-binaries.sh

bazel-test:
hack/dockerized "hack/bazel-fmt.sh && hack/bazel-test.sh"

generate:
hack/dockerized "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} IMAGE_PULL_POLICY=${IMAGE_PULL_POLICY} VERBOSITY=${VERBOSITY} ./hack/generate.sh"
SYNC_VENDOR=true hack/dockerized "./hack/bazel-generate.sh && hack/bazel-fmt.sh"
hack/sync-kubevirtci.sh
hack/dockerized hack/sync-kubevirtci.sh

generate-verify: TARGET_TO_RUN='make generate'
generate-verify: generate check-for-binaries check-git-tree-state
generate-verify: generate
./hack/verify-generate.sh
./hack/check-for-binaries.sh

apidocs:
hack/dockerized "./hack/gen-swagger-doc/gen-swagger-docs.sh v1 html"
Expand Down
2 changes: 1 addition & 1 deletion cluster-up-sha.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10f64444b69573f1a5380670a1be4e98cc33f7f2
0bd56e7aca8eae1dafb5a6e0a64d9fc9e80eaa03
3 changes: 2 additions & 1 deletion cluster-up/cluster/local/provider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ function up() {
}

function prepare_config() {
cat >hack/config-provider-local.sh <<EOF
PROVIDER_CONFIG_FILE_PATH="${BASE_PATH}/$KUBEVIRT_PROVIDER/config-provider-$KUBEVIRT_PROVIDER.sh"
cat > "$PROVIDER_CONFIG_FILE_PATH" <<EOF
master_ip=$(_main_ip)
docker_tag=devel
kubeconfig=$(_cert_dir)/admin.kubeconfig
Expand Down
2 changes: 1 addition & 1 deletion cluster-up/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12b5cdabfec1da7285c59724248d44b01de3693e
426443f01f541258d17d8abd005c1f9296f614d6
2 changes: 1 addition & 1 deletion hack/config-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cdi_namespace=cdi
image_pull_policy=${IMAGE_PULL_POLICY:-IfNotPresent}
verbosity=${VERBOSITY:-2}
package_name=${PACKAGE_NAME:-kubevirt-dev}
kubevirtci_git_hash="12b5cdabfec1da7285c59724248d44b01de3693e"
kubevirtci_git_hash="426443f01f541258d17d8abd005c1f9296f614d6"

# try to derive csv_version from docker tag. But it must start with x.y.z, without leading v
default_csv_version="${docker_tag/latest/0.0.0}"
Expand Down
8 changes: 8 additions & 0 deletions hack/verify-generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

if [[ -n $(git status --porcelain 2>/dev/null) ]]; then
echo "ERROR: git tree state is not clean!"
echo "You probably need to run 'make generate' or 'make' and commit the changes"
git status
exit 1
fi

0 comments on commit 1dddf1d

Please sign in to comment.