Skip to content

Commit

Permalink
Add a deps-sync target
Browse files Browse the repository at this point in the history
This target works exactly like `deps-update` except that it does not
update go dependencies and only does the sync part.

This can be used in CI to ensure that our vendor dependencies and go.mod
files are really in sync.

Signed-off-by: Roman Mohr <rmohr@redhat.com>
  • Loading branch information
rmohr committed Jun 11, 2021
1 parent 2eb0434 commit fd97163
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,14 @@ distclean: clean
rm -rf vendor/

deps-update-patch:
SYNC_VENDOR=true hack/dockerized " ./hack/dep-update.sh -u=patch && ./hack/dep-prune.sh && ./hack/bazel-generate.sh"
SYNC_VENDOR=true hack/dockerized " ./hack/dep-update.sh -- -u=patch && ./hack/dep-prune.sh && ./hack/bazel-generate.sh"

deps-update:
SYNC_VENDOR=true hack/dockerized " ./hack/dep-update.sh && ./hack/dep-prune.sh && ./hack/bazel-generate.sh"

deps-sync:
SYNC_VENDOR=true hack/dockerized " ./hack/dep-update.sh --sync-only && ./hack/dep-prune.sh && ./hack/bazel-generate.sh"

rpm-deps:
SYNC_VENDOR=true hack/dockerized " ./hack/rpm-deps.sh"

Expand Down Expand Up @@ -179,6 +182,7 @@ bump-kubevirtci:
test \
clean \
distclean \
deps-sync \
sync \
manifests \
functest \
Expand Down
22 changes: 19 additions & 3 deletions hack/dep-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,38 @@
set -ex

export GO111MODULE=on
export _sync_only="false"

while true; do
case "$1" in
-s | --sync-only)
_sync_only="true"
shift 1
;;
--)
shift
break
;;
*) break ;;
esac
done

(
echo $_sync_only
cd staging/src/kubevirt.io/client-go
go get $@ ./...
if [ "${_sync_only}" == "false" ]; then go get $@ ./...; fi
go mod tidy
)

(
cd staging/src/github.com/golang/glog
go get $@ ./...
if [ "${_sync_only}" == "false" ]; then go get $@ ./...; fi
go mod tidy
)

(
cd staging/src/kubevirt.io/client-go/examples/listvms
go get $@ ./...
if [ "${_sync_only}" == "false" ]; then go get $@ ./...; fi
go mod tidy
)

Expand Down

0 comments on commit fd97163

Please sign in to comment.