Skip to content

Commit

Permalink
Temporarily allow "v-prefix" differences in version check
Browse files Browse the repository at this point in the history
The docker-compose binary was stripping the "v" prefix when printing
versions, causing the outputed version to not match the version that
was set.

This has been fixed in the "main" branch, but has not yet shipped in
a release, so temporarily ignoreing those differences by strippping
the prefix from both the "expected" and "actual" version that's printed.

We must remove this temporary fix once the fix in docker-compose has
been released, so added a TODO for this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jul 3, 2021
1 parent 0c803a6 commit 808c14b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion deb/common/rules
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ override_dh_auto_test:
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"

# TODO: remove "trim v-prefix" once https://github.com/docker/compose-cli/pull/1884 is released.
ver="$$(/usr/libexec/docker/cli-plugins/docker-compose docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $$1 == "Version" { print $$2 }')"; \
test "$$ver" = "$(COMPOSE_VERSION)" && echo "PASS: docker-compose version OK" || (echo "FAIL: docker-compose version ($$ver) did not match" && exit 1)
test "$${ver#v}" = "$${COMPOSE_VERSION#v}" && echo "PASS: docker-compose version OK" || (echo "FAIL: docker-compose 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
ver="$$(/usr/libexec/docker/cli-plugins/docker-scan docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $$1 == "Version" { print $$2 }')"; \
Expand Down
3 changes: 2 additions & 1 deletion rpm/SPECS/docker-compose-plugin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ GOPROXY="https://proxy.golang.org" GO111MODULE=on GIT_TAG="%{_compose_version}"
popd

%check
# TODO: remove "trim v-prefix" once https://github.com/docker/compose-cli/pull/1884 is released.
ver="$(${RPM_BUILD_ROOT}%{_libexecdir}/docker/cli-plugins/docker-compose docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $1 == "Version" { print $2 }')"; \
test "$ver" = "%{_compose_version}" && echo "PASS: docker-compose version OK" || (echo "FAIL: docker-compose version ($ver) did not match" && exit 1)
test "v${ver#v}" = "%{_compose_version}" && echo "PASS: docker-compose version OK" || (echo "FAIL: docker-compose version ($ver) did not match" && exit 1)

%install
pushd ${RPM_BUILD_DIR}/src/compose-cli
Expand Down

0 comments on commit 808c14b

Please sign in to comment.