diff --git a/deb/common/rules b/deb/common/rules index 55f2ac4d05..db12f217ca 100755 --- a/deb/common/rules +++ b/deb/common/rules @@ -36,8 +36,18 @@ override_dh_auto_build: done override_dh_auto_test: - ./engine/bundles/dynbinary-daemon/dockerd -v - ./cli/build/docker -v + ver="$$(engine/bundles/dynbinary-daemon/dockerd --version)"; \ + test "$$ver" = "Docker version $(VERSION), build $(ENGINE_GITCOMMIT)" && echo "PASS: daemon version OK" || (echo "FAIL: daemon version ($$ver) did not match" && exit 1) + + ver="$$(cli/build/docker --version)"; \ + test "$$ver" = "Docker version $(VERSION), build $(CLI_GITCOMMIT)" && echo "PASS: cli version OK" || (echo "FAIL: cli version ($$ver) did not match" && exit 1) + + # FIXME: --version currently doesn't work as it makes a connection to the daemon, so using the plugin metadata instead + # TODO change once we support scan-plugin on other architectures + if [ "$(TARGET_ARCH)" = "amd64" ]; then \ + ver="$$(/usr/libexec/docker/cli-plugins/docker-scan docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $$1 == "Version" { print $$2 }')"; \ + test "$$ver" = "$(SCAN_VERSION)" && echo "PASS: docker-scan version OK" || (echo "FAIL: docker-scan version ($$ver) did not match" && exit 1); \ + fi override_dh_strip: # Go has lots of problems with stripping, so just don't diff --git a/rpm/SPECS/docker-ce-cli.spec b/rpm/SPECS/docker-ce-cli.spec index 3253f6b90d..7e71907b7a 100644 --- a/rpm/SPECS/docker-ce-cli.spec +++ b/rpm/SPECS/docker-ce-cli.spec @@ -64,8 +64,9 @@ done popd -# %check -# cli/build/docker -v +%check +ver="$(cli/build/docker --version)"; \ + test "$ver" = "Docker version %{_origversion}, build %{_gitcommit_cli}" && echo "PASS: cli version OK" || (echo "FAIL: cli version ($ver) did not match" && exit 1) %install # install binary diff --git a/rpm/SPECS/docker-ce.spec b/rpm/SPECS/docker-ce.spec index 64ea11f6d5..35346717a2 100644 --- a/rpm/SPECS/docker-ce.spec +++ b/rpm/SPECS/docker-ce.spec @@ -89,7 +89,8 @@ VERSION=%{_origversion} PRODUCT=docker hack/make.sh dynbinary popd %check -engine/bundles/dynbinary-daemon/dockerd -v +ver="$(engine/bundles/dynbinary-daemon/dockerd --version)"; \ + test "$ver" = "Docker version %{_origversion}, build %{_gitcommit_engine}" && echo "PASS: daemon version OK" || (echo "FAIL: daemon version ($ver) did not match" && exit 1) %install # install daemon binary diff --git a/rpm/SPECS/docker-scan-plugin.spec b/rpm/SPECS/docker-scan-plugin.spec index ef01974208..2549dd1b06 100644 --- a/rpm/SPECS/docker-scan-plugin.spec +++ b/rpm/SPECS/docker-scan-plugin.spec @@ -31,9 +31,10 @@ popd %check -# FIXME: --version currently doesn't work as it makes a connection to the daemon +# FIXME: --version currently doesn't work as it makes a connection to the daemon, so using the plugin metadata instead #${RPM_BUILD_ROOT}%{_libexecdir}/docker/cli-plugins/docker-scan scan --accept-license --version -${RPM_BUILD_ROOT}%{_libexecdir}/docker/cli-plugins/docker-scan --help +ver="$(${RPM_BUILD_ROOT}%{_libexecdir}/docker/cli-plugins/docker-scan docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $1 == "Version" { print $2 }')"; \ + test "$ver" = "%{_scan_version}" && echo "PASS: docker-scan version OK" || (echo "FAIL: docker-scan version ($ver) did not match" && exit 1) %install pushd ${RPM_BUILD_DIR}/src/scan-cli-plugin