Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,34 @@ This version (2.5.2) of the Pact standalone executables package contains:
* [pact-stub-server](https://github.com/pact-foundation/pact-stub-server)
* [pact_verifier_cli](https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_verifier_cli)
* [pact-plugin-cli](https://github.com/pact-foundation/pact-plugins/tree/main/cli)
* [pact-broker-cli](https://github.com/pact-foundation/pact-broker-cli)

Binaries will be extracted into `pact/bin`:

```
./pact/bin/
├── pact (central entry point to all binaries)
├── pact-broker
├── pactflow
├── pact-broker-cli
├── pact_mock_server_cli
├── pact-stub-server
├── pact_verifier_cli
├── pact-plugin-cli
├── pact-message (legacy)
├── pact-mock-service (legacy)
├── pact-provider-verifier (legacy)
└── pact-stub-service (legacy)
├── pact-broker (legacy) - use `pact-broker-cli`
├── pactflow (legacy) - use `pact-broker-cli pactflow`
├── pact-message (legacy) - use `pact_mock_server_cli` (consumer) / `pact_verifier_cli` (provider)
├── pact-mock-service (legacy) - use `pact_mock_server_cli`
├── pact-provider-verifier (legacy) - use `pact_verifier_cli`
└── pact-stub-service (legacy) - use `pact-stub-server`
```

Note: from `v2.6.0+`, the legacy commands will redirect to the new cli executables built in rust.

Existing behaviour can be preserved by setting the `PACT_CLI_LEGACY` environment variable.

In `v3.0.0`, the ruby runtime will be removed completely, and all commands will link to the rust executables.

Longer term, this package is likely to be deprecated, replaced with a single `pact` cli executable.

### Windows Users

Please append `.bat` to any of the provided ruby-based binaries
Expand Down Expand Up @@ -75,9 +85,14 @@ Ruby is not required on the host platform, Ruby 3.3.9 is provided in the distrib
| Linux | 3.3.9 | aarch64 (arm64)| ✅ |
| Windows| 3.3.9 | x86_64 | ✅ |
| Windows| 3.3.9 | aarch64 (arm64)| 🚧 |
| Windows| N/A. | aarch64 (arm64)| ✅ |

🚧 - Tested under emulation mode x86_64 in Windows on ARM

Windows-arm64 package supports rust based executables only and does not provide an arm64 runtime currently.

To use ruby packages on windows on arm, please use the x86_64 package.

## Usage

<a name="pact-mock-service"></a>
Expand Down
30 changes: 23 additions & 7 deletions packaging/README.md.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,34 @@ This version (<%= ENV.fetch('VERSION') %>) of the Pact standalone executables pa
* [pact-stub-server](https://github.com/pact-foundation/pact-stub-server)
* [pact_verifier_cli](https://github.com/pact-foundation/pact-reference/tree/master/rust/pact_verifier_cli)
* [pact-plugin-cli](https://github.com/pact-foundation/pact-plugins/tree/main/cli)
* [pact-broker-cli](https://github.com/pact-foundation/pact-broker-cli)

Binaries will be extracted into `pact/bin`:

```
./pact/bin/
├── pact (central entry point to all binaries)
├── pact-broker
├── pactflow
├── pact-broker-cli
├── pact_mock_server_cli
├── pact-stub-server
├── pact_verifier_cli
├── pact-plugin-cli
├── pact-message (legacy)
├── pact-mock-service (legacy)
├── pact-provider-verifier (legacy)
└── pact-stub-service (legacy)
├── pact-broker (legacy) - use `pact-broker-cli`
├── pactflow (legacy) - use `pact-broker-cli pactflow`
├── pact-message (legacy) - use `pact_mock_server_cli` (consumer) / `pact_verifier_cli` (provider)
├── pact-mock-service (legacy) - use `pact_mock_server_cli`
├── pact-provider-verifier (legacy) - use `pact_verifier_cli`
└── pact-stub-service (legacy) - use `pact-stub-server`
```

Note: from `v2.6.0+`, the legacy commands will redirect to the new cli executables built in rust.

Existing behaviour can be preserved by setting the `PACT_CLI_LEGACY` environment variable.

In `v3.0.0`, the ruby runtime will be removed completely, and all commands will link to the rust executables.

Longer term, this package is likely to be deprecated, replaced with a single `pact` cli executable.

### Windows Users

Please append `.bat` to any of the provided ruby-based binaries
Expand Down Expand Up @@ -74,7 +84,13 @@ Ruby is not required on the host platform, Ruby 3.3.9 is provided in the distrib
| Linux | 3.3.9 | x86_64 | ✅ |
| Linux | 3.3.9 | aarch64 (arm64)| ✅ |
| Windows| 3.3.9 | x86_64 | ✅ |
| Windows| 3.3.9 | aarch64 (arm64)| 🚧 |
| Windows| N/A. | aarch64 (arm64)| ✅ |

🚧 - Tested under emulation mode x86_64 in Windows on ARM

Windows-arm64 package supports rust based executables only and does not provide an arm64 runtime currently.

To use ruby packages on windows on arm, please use the x86_64 package.

🚧 - Tested under emulation mode x86_64 in Windows on ARM

Expand Down
10 changes: 10 additions & 0 deletions packaging/pact-broker.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
SET RUNNING_PATH=%~dp0
CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH

IF NOT DEFINED PACT_CLI_LEGACY (
IF "%~1"=="" (
%RUNNING_PATH%pact-broker-cli.exe --help
EXIT /B %ERRORLEVEL%
) ELSE (
%RUNNING_PATH%pact-broker-cli.exe %*
EXIT /B %ERRORLEVEL%
)
)

:: Tell Bundler where the Gemfile and gems are.
set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile"
set BUNDLE_IGNORE_CONFIG=
Expand Down
12 changes: 12 additions & 0 deletions packaging/pact-broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ done
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

if [ -z "${PACT_CLI_LEGACY}" ]; then
APP="$DIR/pact-broker-cli"
if [ -x "$APP" ]; then
if [ "$#" -eq 0 ]; then
exec "$APP" --help
else
exec "$APP" "$@"
fi
exit $?
fi
fi

# Figure out where this script is located.
LIBDIR="$(cd "$DIR" && cd ../lib && pwd)"

Expand Down
6 changes: 6 additions & 0 deletions packaging/pact-message.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
SET RUNNING_PATH=%~dp0
CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH

IF NOT DEFINED PACT_CLI_LEGACY (
echo pact-message is deprecated. Please use pact_mock_server_cli instead.
echo or set the PACT_CLI_LEGACY environment variable to use the old CLI.
EXIT /B 1
)

:: Tell Bundler where the Gemfile and gems are.
set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile"
set BUNDLE_IGNORE_CONFIG=
Expand Down
6 changes: 6 additions & 0 deletions packaging/pact-message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ done
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

if [ -z "${PACT_CLI_LEGACY}" ]; then
echo "pact-message is deprecated. Please use pact_mock_server_cli instead."
echo "or set the PACT_CLI_LEGACY environment variable to use the old CLI."
exit 1
fi

# Figure out where this script is located.
LIBDIR="$(cd "$DIR" && cd ../lib && pwd)"

Expand Down
5 changes: 5 additions & 0 deletions packaging/pact-mock-service.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
SET RUNNING_PATH=%~dp0
CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH

IF NOT DEFINED PACT_CLI_LEGACY (
%RUNNING_PATH%pact_mock_server_cli.exe %*
EXIT /B %ERRORLEVEL%
)

:: Tell Bundler where the Gemfile and gems are.
set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile"
set BUNDLE_IGNORE_CONFIG=
Expand Down
8 changes: 8 additions & 0 deletions packaging/pact-mock-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ done
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

if [ -z "${PACT_CLI_LEGACY}" ]; then
APP="$DIR/pact_mock_server_cli"
if [ -x "$APP" ]; then
exec "$APP" "$@"
exit $?
fi
fi

# Figure out where this script is located.
LIBDIR="$(cd "$DIR" && cd ../lib && pwd)"

Expand Down
5 changes: 5 additions & 0 deletions packaging/pact-provider-verifier.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
SET RUNNING_PATH=%~dp0
CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH

IF NOT DEFINED PACT_CLI_LEGACY (
%RUNNING_PATH%pact_verifier_cli.exe %*
EXIT /B %ERRORLEVEL%
)

:: Tell Bundler where the Gemfile and gems are.
set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile"
set BUNDLE_IGNORE_CONFIG=
Expand Down
8 changes: 8 additions & 0 deletions packaging/pact-provider-verifier.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ done
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

if [ -z "${PACT_CLI_LEGACY}" ]; then
APP="$DIR/pact_verifier_cli"
if [ -x "$APP" ]; then
exec "$APP" "$@"
exit $?
fi
fi

# Figure out where this script is located.
LIBDIR="$(cd "$DIR" && cd ../lib && pwd)"

Expand Down
5 changes: 5 additions & 0 deletions packaging/pact-publish.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
SET RUNNING_PATH=%~dp0
CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH

IF NOT DEFINED PACT_CLI_LEGACY (
%RUNNING_PATH%pact-broker-cli.exe publish %*
EXIT /B %ERRORLEVEL%
)

:: Tell Bundler where the Gemfile and gems are.
set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile"
set BUNDLE_IGNORE_CONFIG=
Expand Down
8 changes: 8 additions & 0 deletions packaging/pact-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ done
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

if [ -z "${PACT_CLI_LEGACY}" ]; then
APP="$DIR/pact-broker-cli publish"
if [ -x "$APP" ]; then
exec "$APP" "$@"
exit $?
fi
fi

# Figure out where this script is located.
LIBDIR="$(cd "$DIR" && cd ../lib && pwd)"

Expand Down
5 changes: 5 additions & 0 deletions packaging/pact-stub-service.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
SET RUNNING_PATH=%~dp0
CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH

IF NOT DEFINED PACT_CLI_LEGACY (
%RUNNING_PATH%pact-stub-server.exe %*
EXIT /B %ERRORLEVEL%
)

:: Tell Bundler where the Gemfile and gems are.
set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile"
set BUNDLE_IGNORE_CONFIG=
Expand Down
8 changes: 8 additions & 0 deletions packaging/pact-stub-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ done
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

if [ -z "${PACT_CLI_LEGACY}" ]; then
APP="$DIR/pact-stub-server"
if [ -x "$APP" ]; then
exec "$APP" "$@"
exit $?
fi
fi

# Figure out where this script is located.
LIBDIR="$(cd "$DIR" && cd ../lib && pwd)"

Expand Down
30 changes: 18 additions & 12 deletions packaging/pact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,26 @@
exit_status = Process.wait2(io.pid)[1].exitstatus
exit(exit_status)
end
when 'pact-broker-cli'
ARGV.shift
output = `#{File.expand_path("../../bin/pact-broker-cli", __dir__)} #{ARGV.join(" ")}`
exit_status = $?.exitstatus
puts output
exit(exit_status)
else
puts "available commands:"
puts "__________________"
puts "#{FILENAME} help"
puts "#{FILENAME} pact"
puts "#{FILENAME} pactflow"
puts "#{FILENAME} stub-server"
puts "#{FILENAME} verifier"
puts "#{FILENAME} mock-server"
puts "#{FILENAME} message"
puts "#{FILENAME} broker"
puts "#{FILENAME} pact-broker"
puts "#{FILENAME} plugin"
puts "#{FILENAME} stub-service (legacy)"
puts "#{FILENAME} provider-verifier (legacy)"
puts "#{FILENAME} mock-service (legacy)"
puts "#{FILENAME} pact (central entry point to all binaries)"
puts "#{FILENAME} pact-broker-cli"
puts "#{FILENAME} pact_mock_server_cli"
puts "#{FILENAME} pact-stub-server"
puts "#{FILENAME} pact_verifier_cli"
puts "#{FILENAME} pact-plugin-cli"
puts "#{FILENAME} pact-broker (legacy) - use `pact-broker-cli`"
puts "#{FILENAME} pactflow (legacy) - use `pact-broker-cli pactflow`"
puts "#{FILENAME} pact-message (legacy) - use `pact_mock_server_cli` (consumer) / `pact_verifier_cli` (provider)"
puts "#{FILENAME} pact-mock-service (legacy) - use `pact_mock_server_cli`"
puts "#{FILENAME} pact-provider-verifier (legacy) - use `pact_verifier_cli`"
puts "#{FILENAME} pact-stub-service (legacy) - use `pact-stub-server`"
end
5 changes: 5 additions & 0 deletions packaging/pactflow.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
SET RUNNING_PATH=%~dp0
CALL :RESOLVE "%RUNNING_PATH%\.." ROOT_PATH

IF NOT DEFINED PACT_CLI_LEGACY (
%RUNNING_PATH%pact-broker-cli.exe pactflow %*
EXIT /B %ERRORLEVEL%
)

:: Tell Bundler where the Gemfile and gems are.
set "BUNDLE_GEMFILE=%ROOT_PATH%\lib\vendor\Gemfile"
set BUNDLE_IGNORE_CONFIG=
Expand Down
8 changes: 8 additions & 0 deletions packaging/pactflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ done
RDIR="$( dirname "$SOURCE" )"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

if [ -z "${PACT_CLI_LEGACY}" ]; then
APP="$DIR/pact-broker-cli pactflow"
if [ -x "$APP" ]; then
exec "$APP" "$@"
exit $?
fi
fi

# Figure out where this script is located.
LIBDIR="$(cd "$DIR" && cd ../lib && pwd)"

Expand Down
10 changes: 7 additions & 3 deletions script/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ PATH_TO_BIN=.${PATH_SEPERATOR}pkg${PATH_SEPERATOR}pact${PATH_SEPERATOR}bin${PATH
tools=(
pact
pact-broker
pact-message
pact-mock-service
pact-provider-verifier
pact-stub-service
Expand All @@ -51,14 +50,19 @@ tools=(
pact-stub-server
pact_verifier_cli
pact_mock_server_cli
pact-broker-cli
)

if [ ! -z "${PACT_CLI_LEGACY:-}" ]; then
tools+=(pact-message)
fi

test_cmd=""
for tool in ${tools[@]}; do
echo testing $tool
if [ "$BINARY_OS" = "windows" ] ; then FILE_EXT=.bat; fi
if [ "$BINARY_OS" = "windows" ] && ([ "$tool" = "pact-plugin-cli" ] || [ "$tool" = "pact-stub-server" ] || [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact_mock_server_cli" ]) ; then FILE_EXT=.exe ; fi
if [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact-mock-service" ]; then test_cmd="--help" ; fi
if [ "$BINARY_OS" = "windows" ] && ([ "$tool" = "pact-plugin-cli" ] || [ "$tool" = "pact-stub-server" ] || [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact_mock_server_cli" ] || [ "$tool" = "pact-broker-cli" ]) ; then FILE_EXT=.exe ; fi
if [ "$tool" = "pact_verifier_cli" ] || [ "$tool" = "pact-mock-service" ] || [ "$tool" = "pact-broker-cli" ]; then test_cmd="--help" ; fi
echo executing ${tool}${FILE_EXT}
${PATH_TO_BIN}${tool}${FILE_EXT} ${test_cmd};
done
Loading