build: Download CRD deps only when necessary #783
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Create individual make targets for the CRD dependencies so that make can identify that the CRD dependencies have already been downloaded and skip. When the
SOURCE_VER
changes, old CRDs are deleted and new ones aredownloaded, keeping a record of the source CRD versions in
build/.src-crd-<version>
by file name.Also, introduce
cleanup-crd-deps
make target to delete the previously downloaded CRDs.Without this, the CRDs were downloaded every single time when running tests:
An alternative is to pass the curl continue-at option
-C -
which checks with remote and doesn't downloads the same file if it has been downloaded already:But with individual make targets for the CRDs, there's no need to check if the downloaded files match with the remote. It's better to just skip downloading entirely if the file exists using make's native style.
For handling overall updates to such dependencies, it may be better to introduce a
distclean
make target that resets the repository, deleting any old files that need to be updated. Maybe later as a separate PR.