Skip to content
Merged
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
5 changes: 2 additions & 3 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ jobs:

- name: Show help commands
run: |
pact-cli --help
pact-cli pactflow --help
pact --help

- name: Run pact-broker commands
- name: Run pactbroker commands
shell: bash
run: ./run.sh
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ jobs:
shell: bash
env:
PACT_BROKER_BASE_URL: http://localhost:9292
BIN: target/${{ inputs.target }}/release/pact-cli
BIN: target/${{ inputs.target }}/release/pact
- name: test pact-cli with locally running Pact Broker (Windows)
if: ${{ runner.os == 'Windows' && inputs.target != 'aarch64-pc-windows-msvc' }}
run: ./run.ps1
shell: pwsh
env:
PACT_BROKER_BASE_URL: http://localhost:9292
BIN: target/${{ inputs.target }}/release/pact-cli.exe
BIN: target/${{ inputs.target }}/release/pact.exe
- name: Create dist
id: dist
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ indexmap = { version = "1.9.3", features = ["std"] }


# [lib]
# name = "pact-cli" # Name of the library
# name = "pact" # Name of the library
# crate-type = ["cdylib", "staticlib"] # For compiling to a shared library

[[bin]]
name = "pact-cli"
name = "pact"
path = "src/bin.rs"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SHELL := /bin/bash

TARGET=
USE_CROSS=
BINARY_NAME?=pact-cli
BINARY_NAME?=pact
SLIM=false
BUILDER=cargo

Expand Down
35 changes: 17 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ Example

- name: Show help commands
run: |
pact-cli --help
pact-cli pactflow --help
pact --help
```

### Docker
Expand All @@ -116,13 +115,13 @@ tags format
### All commands

```console
$ pact-cli --help
$ pact --help
Pact consolidated CLI - pact_core_mock_server, pact_verifier, pact-stub-server, pact-plugin-cli, pact-broker-cli in a single binary

Usage: pact-cli [OPTIONS] [COMMAND]
Usage: pact [OPTIONS] [COMMAND]

Commands:
pact-broker A Rust and CLI client for the Pact Broker. Publish and retrieve pacts and verification results.
broker A Rust and CLI client for the Pact Broker. Publish and retrieve pacts and verification results.
pactflow PactFlow specific commands
completions Generates completion scripts for your shell
plugin CLI utility for Pact plugins
Expand All @@ -137,13 +136,13 @@ Options:

```

### `pact-broker`
### `broker`

```console
$ pact-cli pact-broker --help
$ pact broker --help
A Rust and CLI client for the Pact Broker. Publish and retrieve pacts and verification results.

Usage: pact-cli pact-broker [OPTIONS] [COMMAND]
Usage: pact broker [OPTIONS] [COMMAND]

Commands:
publish Publishes pacts to the Pact Broker
Expand Down Expand Up @@ -185,10 +184,10 @@ Options:
### `pactflow`

```console
$ pact-cli pactflow --help
$ pact pactflow --help
PactFlow specific commands

Usage: pact-cli pactflow [OPTIONS] [COMMAND]
Usage: pact pactflow [OPTIONS] [COMMAND]

Commands:
publish-provider-contract Publish provider contract to PactFlow
Expand All @@ -203,10 +202,10 @@ Options:
### `plugin`

```console
$ pact-cli plugin --help
$ pact plugin --help
CLI utility for Pact plugins

Usage: pact-cli plugin [OPTIONS] <COMMAND>
Usage: pact plugin [OPTIONS] <COMMAND>

Commands:
list List installed or available plugins
Expand All @@ -231,10 +230,10 @@ Options:
### `mock`

```console
$ pact-cli mock --help
$ pact mock --help
Standalone Pact mock server

Usage: pact-cli mock [OPTIONS] [COMMAND]
Usage: pact mock [OPTIONS] [COMMAND]

Commands:
start Starts the master mock server
Expand All @@ -260,10 +259,10 @@ Options:
### `verifier`

```console
$ pact-cli verifier --help
$ pact verifier --help
Standalone pact verifier for provider pact verification

Usage: pact-cli verifier [OPTIONS]
Usage: pact verifier [OPTIONS]

Options:
--help Print help and exit
Expand Down Expand Up @@ -367,10 +366,10 @@ Development options:
### `stub`

```console
$ pact-cli stub --help
$ pact stub --help
Pact Stub Server 0.6.3

Usage: pact-cli stub [OPTIONS]
Usage: pact stub [OPTIONS]

Options:
-l, --loglevel <loglevel>
Expand Down
2 changes: 1 addition & 1 deletion cbindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ prefix_with_name = true
# [parse.expand]

# # Expand macros for `pact_matching_ffi`.
# crates = ["pact-cli_ffi"]
# crates = ["pact_cli_ffi"]
26 changes: 13 additions & 13 deletions docker/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ ARG VERSION=0.0.9

RUN if [ "$TARGETARCH" = "amd64" ]; then \
BIN_ARCH="x86_64"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musl; \
BIN_FILE=pact-${BIN_ARCH}-linux-musl; \
elif [ "$TARGETARCH" = "386" ] || [ "$TARGETARCH" = "586" ] || [ "$TARGETARCH" = "686" ]; then \
BIN_ARCH="i686"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musl; \
BIN_FILE=pact-${BIN_ARCH}-linux-musl; \
elif [ "$TARGETARCH" = "arm64" ]; then \
BIN_ARCH="aarch64"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musl; \
BIN_FILE=pact-${BIN_ARCH}-linux-musl; \
elif [ "$TARGETARCH" = "s390x" ]; then \
BIN_ARCH="s390x"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-gnu; \
BIN_FILE=pact-${BIN_ARCH}-linux-gnu; \
apk add --no-cache wget; \
elif [ "$TARGETARCH" = "riscv64" ]; then \
BIN_ARCH="riscv64gc"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-gnu; \
BIN_FILE=pact-${BIN_ARCH}-linux-gnu; \
elif [ "$TARGETARCH" = "arm" ]; then \
echo ${TARGETVARIANT}; \
if [ "$TARGETVARIANT" = "v8" ]; then \
BIN_ARCH="arm"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musleabi; \
BIN_FILE=pact-${BIN_ARCH}-linux-musleabi; \
elif [ "$TARGETVARIANT" = "v7" ]; then \
BIN_ARCH="armv7"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musleabi; \
BIN_FILE=pact-${BIN_ARCH}-linux-musleabi; \
elif [ "$TARGETVARIANT" = "v6" ]; then \
BIN_ARCH="arm"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musleabihf; \
BIN_FILE=pact-${BIN_ARCH}-linux-musleabihf; \
elif [ "$TARGETVARIANT" = "v5" ]; then \
BIN_ARCH="armv5te"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musleabi; \
BIN_FILE=pact-${BIN_ARCH}-linux-musleabi; \
else \
echo "Invalid TARGETVARIANT: ${TARGETVARIANT}"; \
exit 1; \
Expand All @@ -43,12 +43,12 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
echo "Invalid TARGETARCH: ${TARGETARCH}"; \
exit 1; \
fi \
&& wget -O pact-cli https://github.com/you54f/pact-cli/releases/download/v${VERSION}/${BIN_FILE} && \
chmod +x pact-cli
&& wget -O pact https://github.com/you54f/pact/releases/download/v${VERSION}/${BIN_FILE} && \
chmod +x pact

FROM --platform=linux/${TARGETARCH}${TARGETVARIANT:+/${TARGETVARIANT}} ${BASE_IMAGE}
WORKDIR /app
COPY --from=builder /pact-cli /app/
COPY --from=builder /pact /app/
EXPOSE 8080
ENTRYPOINT ["./pact-cli"]
ENTRYPOINT ["./pact"]
CMD ["--help"]
26 changes: 13 additions & 13 deletions docker/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@ ARG VERSION=0.0.9
RUN apt-get update && apt-get install -y wget
RUN if [ "$TARGETARCH" = "amd64" ]; then \
BIN_ARCH="x86_64"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musl; \
BIN_FILE=pact-${BIN_ARCH}-linux-musl; \
elif [ "$TARGETARCH" = "386" ] || [ "$TARGETARCH" = "586" ] || [ "$TARGETARCH" = "686" ]; then \
BIN_ARCH="i686"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musl; \
BIN_FILE=pact-${BIN_ARCH}-linux-musl; \
elif [ "$TARGETARCH" = "arm64" ]; then \
BIN_ARCH="aarch64"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musl; \
BIN_FILE=pact-${BIN_ARCH}-linux-musl; \
elif [ "$TARGETARCH" = "s390x" ]; then \
BIN_ARCH="s390x"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-gnu; \
BIN_FILE=pact-${BIN_ARCH}-linux-gnu; \
elif [ "$TARGETARCH" = "riscv64" ]; then \
BIN_ARCH="riscv64gc"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-gnu; \
BIN_FILE=pact-${BIN_ARCH}-linux-gnu; \
elif [ "$TARGETARCH" = "arm" ]; then \
echo ${TARGETVARIANT}; \
if [ "$TARGETVARIANT" = "v8" ]; then \
BIN_ARCH="arm"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musleabi; \
BIN_FILE=pact-${BIN_ARCH}-linux-musleabi; \
elif [ "$TARGETVARIANT" = "v7" ]; then \
BIN_ARCH="armv7"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musleabi; \
BIN_FILE=pact-${BIN_ARCH}-linux-musleabi; \
elif [ "$TARGETVARIANT" = "v6" ]; then \
BIN_ARCH="arm"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musleabihf; \
BIN_FILE=pact-${BIN_ARCH}-linux-musleabihf; \
elif [ "$TARGETVARIANT" = "v5" ]; then \
BIN_ARCH="armv5te"; \
BIN_FILE=pact-cli-${BIN_ARCH}-linux-musleabi; \
BIN_FILE=pact-${BIN_ARCH}-linux-musleabi; \
else \
echo "Invalid TARGETVARIANT: ${TARGETVARIANT}"; \
exit 1; \
Expand All @@ -43,12 +43,12 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
echo "Invalid TARGETARCH: ${TARGETARCH}"; \
exit 1; \
fi \
&& wget -O pact-cli https://github.com/you54f/pact-cli/releases/download/v${VERSION}/${BIN_FILE} && \
chmod +x pact-cli
&& wget -O pact https://github.com/you54f/pact-cli/releases/download/v${VERSION}/${BIN_FILE} && \
chmod +x pact

FROM --platform=linux/${TARGETARCH}${TARGETVARIANT:+/${TARGETVARIANT}} ${BASE_IMAGE}
WORKDIR /app
COPY --from=builder /pact-cli /app/
COPY --from=builder /pact /app/
EXPOSE 8080
ENTRYPOINT ["./pact-cli"]
ENTRYPOINT ["./pact"]
CMD ["--help"]
4 changes: 2 additions & 2 deletions docker/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
build a single arch image

```sh
docker buildx build -t you54f/pact-cli:$DOCKER_TAG-alpine --build-arg VERSION=$DOCKER_TAG --platform linux/arm . -f Dockerfile.alpine --load
docker buildx build -t you54f/pact:$DOCKER_TAG-alpine --build-arg VERSION=$DOCKER_TAG --platform linux/arm . -f Dockerfile.alpine --load
```

Run the image

```sh
docker run --platform=linux/arm -p 8080:8080 --rm --init you54f/pact-cli:0.0.9-alpine mock start
docker run --platform=linux/arm -p 8080:8080 --rm --init you54f/pact:0.0.9-alpine mock start
```

Docker multi arch available args
Expand Down
10 changes: 5 additions & 5 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
To build a single architecture docker image (change the version as required):

```shell
> docker build -t pactfoundation/pact-cli:0.6.0 --build-arg VERSION=0.6.0 .
> docker build -t pactfoundation/pact:0.6.0 --build-arg VERSION=0.6.0 .
```

To build a multi-architecture docker image:
Expand All @@ -20,14 +20,14 @@ Build images

```shell
export DOCKER_TAG=0.6.0
docker buildx build -t you54f/pact-cli:$DOCKER_TAG --build-arg VERSION=$DOCKER_TAG --platform linux/amd64,linux/arm64 .
docker buildx build -t you54f/pact-cli:latest --build-arg VERSION=$DOCKER_TAG --platform linux/amd64,linux/arm64 .
docker buildx build -t you54f/pact:$DOCKER_TAG --build-arg VERSION=$DOCKER_TAG --platform linux/amd64,linux/arm64 .
docker buildx build -t you54f/pact:latest --build-arg VERSION=$DOCKER_TAG --platform linux/amd64,linux/arm64 .
```

Build & Push images - will use cached images if available

```shell
export DOCKER_TAG=0.6.0
docker buildx build -t you54f/pact-cli:$DOCKER_TAG --build-arg VERSION=$DOCKER_TAG --platform linux/amd64,linux/arm64 --push .
docker buildx build -t you54f/pact-cli:latest --build-arg VERSION=$DOCKER_TAG --platform linux/amd64,linux/arm64 --push .
docker buildx build -t you54f/pact:$DOCKER_TAG --build-arg VERSION=$DOCKER_TAG --platform linux/amd64,linux/arm64 --push .
docker buildx build -t you54f/pact:latest --build-arg VERSION=$DOCKER_TAG --platform linux/amd64,linux/arm64 --push .
```
2 changes: 1 addition & 1 deletion docker/test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ platforms=("linux/amd64" "linux/arm64")
for platform in "${platforms[@]}"
do

image="${1:-you54f/pact-cli}"
image="${1:-you54f/pact}"
tag="${2:-latest}"
echo "Running $image:$tag on $platform"
docker run --rm --platform "$platform" "$image:$tag"
Expand Down
12 changes: 6 additions & 6 deletions install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ if ($architecture -eq "x64") {
Write-Host "Unsupported architecture: $architecture"
exit 1
}
$url = "https://github.com/you54f/pact-cli/releases/download/$tag/pact-cli-$architecture-windows-msvc.exe"
$url = "https://github.com/you54f/pact-cli/releases/download/$tag/pact-$architecture-windows-msvc.exe"


Write-Host "Downloading $url to $pactDir"
$exe = Join-Path $pactDir "pact-cli.exe"
$exe = Join-Path $pactDir "pact.exe"
if (Test-Path "$exe") {
Remove-Item $exe
}

$downloader = new-object System.Net.WebClient
$downloader.DownloadFile($url, $exe)
Write-Host "--> Downloaded pact-cli to $exe"
# Write-Host "--> Setting executable permissions for pact-cli"
Write-Host "--> Downloaded pact to $exe"
# Write-Host "--> Setting executable permissions for pact"
# chmod +x $exe
Write-Host "--> Adding pact-cli to path"
Write-Host "--> Adding pact to path"
$pactBinariesPath = "$pactDir"
$env:PATH += ";$pactBinariesPath"
Write-Host $env:PATH
pact-cli.exe --help
pact.exe --help
Loading