diff --git a/Dockerfile b/Dockerfile index d68c2d4..9a23528 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ ADD docker/pact /usr/local/bin/pact RUN apk update \ && apk add ruby=3.4.4-r0 \ - ca-certificates=20250619-r0 \ + ca-certificates=20250911-r0 \ libressl \ less \ git \ @@ -29,7 +29,7 @@ RUN apk update \ && bundle config git.allow_insecure true \ && gem update --system 3.6.9 \ && gem install json -v "~>2.15" \ - && gem install bigdecimal -v "~>3.2" \ + && gem install bigdecimal -v "~>3.3" \ && gem install racc -v "~>1.8" \ && gem uninstall rubygems-update \ && gem cleanup \ @@ -75,7 +75,9 @@ RUN case ${TARGETPLATFORM} in \ && wget -qO - https://github.com/pact-foundation/pact-reference/releases/download/pact_verifier_cli-v1.1.3/pact_verifier_cli-linux-${BIN_ARCH}.gz \ | gunzip -fc > ./bin/pact_verifier_cli && chmod +x ./bin/pact_verifier_cli \ && wget -qO - https://github.com/pact-foundation/pact-core-mock-server/releases/download/pact_mock_server_cli-v1.0.6/pact_mock_server_cli-linux-${BIN_ARCH}.gz \ - | gunzip -fc > ./bin/pact_mock_server_cli && chmod +x ./bin/pact_mock_server_cli + | gunzip -fc > ./bin/pact_mock_server_cli && chmod +x ./bin/pact_mock_server_cli \ + && wget -qO - https://github.com/pact-foundation/pact-broker-cli/releases/download/v0.1.0/pact-broker-cli-${BIN_ARCH}-linux-musl \ + -O ./bin/pact-broker-cli && chmod +x ./bin/pact-broker-cli ENTRYPOINT ["/pact/entrypoint.sh"] diff --git a/Gemfile.lock b/Gemfile.lock index f98850a..bbaa7b2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,8 +9,8 @@ PATH remote: . specs: pact-cli (1.5.0) - bigdecimal (~> 3.2) - json (~> 2.13) + bigdecimal (~> 3.3) + json (~> 2.15) pact-mock_service pact-provider-verifier pact_broker-client (~> 1.28) @@ -21,7 +21,7 @@ GEM specs: awesome_print (1.9.2) base64 (0.3.0) - bigdecimal (3.2.3) + bigdecimal (3.3.1) bump (0.10.0) coderay (1.1.3) csv (3.3.5) @@ -42,7 +42,7 @@ GEM csv mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - json (2.15.0) + json (2.15.1) jsonpath (1.1.5) multi_json logger (1.7.0) diff --git a/README.md b/README.md index 43af037..868f1f1 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Commands: publish PACT_DIRS_OR_FILES ... # Publish pacts to a Pact Broker. stub-server # Run a Pact stub server stub-service # (legacy) Run a Pact stub service - verifier # Run a Pact verifier + verifier # Verify pact(s) against a provider. Supports local and networked (http-based) files. verify PACT_URL ... # (legacy) Verify pact(s) against a provider. Supports local and networked (http-based) files. version # Print the version of the CLI diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index a4cbf74..f98694d 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh -PACT_COMMANDS=" broker help mock-service publish stub-service verify version verifier mock-server stub-server plugin " -PACT_RUST_COMMANDS=" pact-plugin-cli pact-stub-server pact_mock_server_cli pact_verifier_cli " +PACT_COMMANDS=" broker broker-cli help mock-service publish publish-cli stub-service verify version verifier mock-server stub-server plugin " +PACT_RUST_COMMANDS=" pact-plugin-cli pact-stub-server pact_mock_server_cli pact_verifier_cli pact-broker-cli " # git branch detection command fails due to cve fix https://github.blog/2022-04-12-git-security-vulnerability-announced/ # fatal: unsafe repository (REPO is owned by someone else) in other workflow steps after running checkout diff --git a/lib/pact/cli.rb b/lib/pact/cli.rb index 2454779..0cdc61d 100644 --- a/lib/pact/cli.rb +++ b/lib/pact/cli.rb @@ -36,17 +36,17 @@ def stub_service Pact::StubService::CLI.start(process_argv("stub-service")) end - desc 'pact-broker', 'Interact with a Pact Broker (also aliased as the subcommand `broker`)' + desc 'pact-broker', '(legacy) Interact with a Pact Broker (also aliased as the subcommand `broker`) - use `pact-broker-cli` subcommand instead' def pact_broker ::PactBroker::Client::CLI::Broker.start(process_argv("pact-broker")) end - desc 'broker', 'Interact with a Pact Broker (this command is still supported by has been superseded by the pact-broker command for consistency across the various packages', hide: true + desc 'broker', '(legacy) Interact with a Pact Broker (this command is still supported by has been superseded by the pact-broker command for consistency across the various packages - use `pact-broker-cli` subcommand instead', hide: true def broker ::PactBroker::Client::CLI::Broker.start(process_argv("broker")) end - desc 'pactflow', 'Interact with PactFlow' + desc 'pactflow', '(legacy) Interact with PactFlow - use `pact-broker-cli pactflow` subcommand instead' def pactflow ::Pactflow::Client::CLI::Pactflow.start(process_argv("pactflow")) end @@ -64,13 +64,22 @@ def verify Pact::ProviderVerifier::CLI::Verify.start(process_argv("")) end - desc ::PactBroker::Client::CLI::Broker.commands["publish"].usage, ::PactBroker::Client::CLI::Broker.commands["publish"].description + desc ::PactBroker::Client::CLI::Broker.commands["publish"].usage, "(legacy) " + ::PactBroker::Client::CLI::Broker.commands["publish"].description long_desc ::PactBroker::Client::CLI::Broker.commands["publish"].long_description def publish ::PactBroker::Client::CLI::Broker.start(process_argv("")) end + desc 'publish-cli', 'Publish pacts to a Pact Broker.' + def publish_cli + ARGV.shift + output = `./bin/pact-broker-cli publish #{ARGV.join(" ")}` + exit_status = $?.exitstatus + puts output + exit(exit_status) + end + desc "version", "Print the version of the CLI" def version require 'pact/cli/version' @@ -84,7 +93,7 @@ def plugin puts output exit(exit_status) end - desc 'verifier', 'Run a Pact verifier' + desc 'verifier', 'Verify pact(s) against a provider. Supports local and networked (http-based) files.' def verifier ARGV.shift output = `./bin/pact_verifier_cli #{ARGV.join(" ")}` @@ -114,6 +123,14 @@ def stub_server exit(exit_status) end end + desc 'pact-broker-cli', 'Interact with a Pact Broker' + def broker_cli + ARGV.shift + output = `./bin/pact-broker-cli #{ARGV.join(" ")}` + exit_status = $?.exitstatus + puts output + exit(exit_status) + end no_commands do def self.exit_on_failure? true diff --git a/pact-cli.gemspec b/pact-cli.gemspec index 249087a..d9a3eb1 100644 --- a/pact-cli.gemspec +++ b/pact-cli.gemspec @@ -45,7 +45,7 @@ Gem::Specification.new do |spec| spec.add_dependency "pact-provider-verifier" spec.add_dependency "pact_broker-client", "~> 1.28" spec.add_dependency "json", "~>2.15" # must match native lib install in the Dockerfile - spec.add_dependency "bigdecimal", "~>3.2" # must match native lib install in the Dockerfile + spec.add_dependency "bigdecimal", "~>3.3" # must match native lib install in the Dockerfile spec.add_dependency "rack-test", ">= 0.6.3", "< 3.0.0"