diff --git a/.github/workflows/release_gem.yml b/.github/workflows/release_gem.yml index c186f94d..97f21356 100644 --- a/.github/workflows/release_gem.yml +++ b/.github/workflows/release_gem.yml @@ -10,12 +10,12 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-ruby@v1 + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 with: - ruby-version: '2.6' + ruby-version: '3.2' - run: | - gem install bundler -v 2.1 + gem install bundler -v 2.4 bundle install - name: Test run: bundle exec rake @@ -28,7 +28,7 @@ jobs: version: ${{ steps.release.outputs.version }} increment: ${{ steps.release.outputs.increment }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: pact-foundation/release-gem@v0.0.13 diff --git a/.github/workflows/smartbear-issue-label-added.yml b/.github/workflows/smartbear-issue-label-added.yml new file mode 100644 index 00000000..8b68fed7 --- /dev/null +++ b/.github/workflows/smartbear-issue-label-added.yml @@ -0,0 +1,11 @@ +name: SmartBear Supported Issue Label Added + +on: + issues: + types: + - labeled + +jobs: + call-workflow: + uses: pact-foundation/.github/.github/workflows/smartbear-issue-label-added.yml@master + secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4162030..022bea11 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,15 +4,14 @@ on: [push, pull_request] jobs: test: - runs-on: "ubuntu-latest" - continue-on-error: ${{ matrix.experimental }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - ruby_version: ["2.7", "3.0", "3.1"] - experimental: [false] + ruby_version: ["2.7", "3.0", "3.1", "3.2"] + os: ["ubuntu-latest","windows-latest","macos-latest"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby_version }} @@ -26,10 +25,10 @@ jobs: matrix: feature: [""] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: "2.7" + ruby-version: "3.2" - run: "bundle install" - run: | rm -rf spec/pacts/* diff --git a/.github/workflows/trigger_pact_docs_update.yml b/.github/workflows/trigger_pact_docs_update.yml index 40530b81..05a88e7f 100644 --- a/.github/workflows/trigger_pact_docs_update.yml +++ b/.github/workflows/trigger_pact_docs_update.yml @@ -9,6 +9,7 @@ on: repository_dispatch: types: - gem-released + workflow_dispatch: jobs: build: diff --git a/.ruby-version b/.ruby-version index e6b7b623..4fe56315 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7 \ No newline at end of file +3.2 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ad001c14..f622e765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,53 @@ + +### v1.68.0 (2023-07-08) + +#### Features + +* support Cirrus CI environment ([7610f28](/../../commit/7610f28)) + +#### Bug Fixes + +* pact-broker --help command failed with Could not find command "__broker_base_url" (#135) ([7edfd58](/../../commit/7edfd58)) + + +### v1.67.0 (2023-05-04) + +#### Features + +* colour first url in magenta for ease of reading ([90e8f51](/../../commit/90e8f51)) +* output provider contract link on publish (#118) ([132b024](/../../commit/132b024)) +* add helper text for Docker usage when pact file not found ([2aab2d5](/../../commit/2aab2d5)) + +#### Bug Fixes + +* trim trailing slash from base url ([ccd6417](/../../commit/ccd6417)) +* do not allow an empty environment name to be used in the can-i-deploy command ([a3bfe8a](/../../commit/a3bfe8a)) + + +### v1.66.1 (2023-01-11) + +#### Bug Fixes + +* **deps** + * update httparty for https://github.com/jnunemaker/httparty/security/advisories/GHSA-5pq7-52mg-hr42 ([08597c2](/../../commit/08597c2)) + + +### v1.66.0 (2022-12-01) + +#### Features + +* **can-i-deploy** + * support specifying --ignore using the environment variable PACT_BROKER_CAN_I_DEPLOY_IGNORE ([04a0894](/../../commit/04a0894)) + +* refactor can-i-deploy to use HAL Client instead of HTTParty ([d21efe6](/../../commit/d21efe6)) + +#### Bug Fixes + +* found the missing computer arm when computer says no (#120) ([7b8ea24](/../../commit/7b8ea24)) + +* **publish-provider-contract** + * raise validation error when pact broker base URL is missing or blank ([2d719c3](/../../commit/2d719c3)) + ### v1.65.0 (2022-06-24) @@ -189,7 +239,7 @@ #### Features -* support specifying team UUID when creating a webhook in Pactflow ([c4201e1](/../../commit/c4201e1)) +* support specifying team UUID when creating a webhook in PactFlow ([c4201e1](/../../commit/c4201e1)) ### v1.45.0 (2021-06-16) diff --git a/Dockerfile b/Dockerfile index a5f86a8c..9bbdb782 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.1-alpine +FROM ruby:3.2-alpine RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing hub RUN apk add --update --no-cache git openssh bash diff --git a/README.md b/README.md index e705fd7d..51d27eb4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Pact Broker Client -A client for the [Pact Broker](https://docs.pact.io/pact_broker/) and [Pactflow](https://pactflow.io/?utm_source=ossdocs&utm_campaign=pact_broker_client_readme). Publishes and retrieves pacts, pacticipants, pacticipant versions, environments, deployments and releases. Supports publishing provider contracts for Pactflow. The functionality is available via a CLI, or via Ruby Rake tasks. You can also use the [Pact CLI Docker image](https://hub.docker.com/r/pactfoundation/pact-cli). +A client for the [Pact Broker](https://docs.pact.io/pact_broker/) and [PactFlow](https://pactflow.io/?utm_source=ossdocs&utm_campaign=pact_broker_client_readme). Publishes and retrieves pacts, pacticipants, pacticipant versions, environments, deployments and releases. Supports publishing provider contracts for PactFlow. The functionality is available via a CLI, or via Ruby Rake tasks. You can also use the [Pact CLI Docker image](https://hub.docker.com/r/pactfoundation/pact-cli). ![Build status](https://github.com/pact-foundation/pact_broker-client/workflows/Test/badge.svg) @@ -32,7 +32,7 @@ To connect to a Pact Broker that uses custom SSL cerificates, set the environmen ## Usage - CLI -All commands prefixed with `pact-broker` can be used with the OSS Pact Broker and Pactflow. Commands prefixed with `pactflow` can only be used with Pactflow. +All commands prefixed with `pact-broker` can be used with the OSS Pact Broker and PactFlow. Commands prefixed with `pactflow` can only be used with PactFlow. The Pact Broker base URL can be specified either using the environment variable `$PACT_BROKER_BASE_URL` or the `-b` or `--broker-base-url` parameters. @@ -40,7 +40,7 @@ Pact Broker authentication can be performed either using basic auth or a bearer Basic auth parameters can be specified using the `$PACT_BROKER_USERNAME` and `$PACT_BROKER_PASSWORD` environment variables, or the `-u` or `--broker-username` and `-p` or `--broker-password` parameters. -Authentication using a bearer token can be specified using the environment variable `$PACT_BROKER_TOKEN` or the `-k` or `--broker-token` parameters. This bearer token authentication is used by [Pactflow](https://pactflow.io) and is not available in the [OSS Pact Broker](https://docs.pact.io/pact_broker/), which only supports basic auth. +Authentication using a bearer token can be specified using the environment variable `$PACT_BROKER_TOKEN` or the `-k` or `--broker-token` parameters. This bearer token authentication is used by [PactFlow](https://pactflow.io) and is not available in the [OSS Pact Broker](https://docs.pact.io/pact_broker/), which only supports basic auth. @@ -434,6 +434,13 @@ Options: -e, [--version=VERSION] # The pacticipant version. Must be entered after the --pacticipant that it relates to. + [--ignore=IGNORE] + # The pacticipant name to ignore. Use once for each pacticipant + being ignored. A specific version can be ignored by also + specifying a --version after the pacticipant name option. The + environment variable PACT_BROKER_CAN_I_DEPLOY_IGNORE may also + be used to specify a pacticipant name to ignore, with commas to + separate multiple pacticipant names if necessary. -l, [--latest=[TAG]] # Use the latest pacticipant version. Optionally specify a TAG to use the latest version with the specified tag. @@ -523,6 +530,12 @@ Description: $ pact-broker can-i-deploy --pacticipant Foo 173153ae0 \ --pacticipant Bar --latest main +##### Polling + +If the verification process takes a long time and there are results missing when the can-i-deploy command runs in your CI/CD pipeline, you can configure the +command to poll and wait for the missing results to arrive. The arguments to specify are `--retry-while-unknown TIMES` and `--retry-interval SECONDS`, set to +appropriate values for your pipeline. + ### Pacticipants #### create-or-update-pacticipant @@ -651,8 +664,8 @@ Options: # Trigger this webhook when a contract is published that requires verification [--team-uuid=UUID] - # UUID of the Pactflow team to which the webhook should be - assigned (Pactflow only) + # UUID of the PactFlow team to which the webhook should be + assigned (PactFlow only) -b, --broker-base-url=BROKER_BASE_URL # The base URL of the Pact Broker -u, [--broker-username=BROKER_USERNAME] @@ -714,8 +727,8 @@ Options: # Trigger this webhook when a contract is published that requires verification [--team-uuid=UUID] - # UUID of the Pactflow team to which the webhook should be - assigned (Pactflow only) + # UUID of the PactFlow team to which the webhook should be + assigned (PactFlow only) -b, --broker-base-url=BROKER_BASE_URL # The base URL of the Pact Broker -u, [--broker-username=BROKER_USERNAME] @@ -876,7 +889,7 @@ Options: Generate a UUID for use when calling create-or-update-webhook -### Provider contracts (Pactflow only) +### Provider contracts (PactFlow only) #### publish-provider-contract @@ -932,7 +945,7 @@ Options: # Verbose output. Default: false ``` -Publish provider contract to Pactflow +Publish provider contract to PactFlow diff --git a/doc/pacts/markdown/Pact Broker Client - Pactflow.md b/doc/pacts/markdown/Pact Broker Client - Pactflow.md index d1a2e672..e092e37e 100644 --- a/doc/pacts/markdown/Pact Broker Client - Pactflow.md +++ b/doc/pacts/markdown/Pact Broker Client - Pactflow.md @@ -1,11 +1,13 @@ -### A pact between Pact Broker Client and Pactflow +### A pact between Pact Broker Client and PactFlow -#### Requests from Pact Broker Client to Pactflow +#### Requests from Pact Broker Client to PactFlow * [A request for the index resource](#a_request_for_the_index_resource) * [A request to create a provider contract](#a_request_to_create_a_provider_contract) +* [A request to create a provider contract](#a_request_to_create_a_provider_contract_given_there_is_a_pf:ui_href_in_the_response) given there is a pf:ui href in the response + * [A request to create a webhook for a team](#a_request_to_create_a_webhook_for_a_team_given_a_team_with_UUID_2abbc12a-427d-432a-a521-c870af1739d9_exists) given a team with UUID 2abbc12a-427d-432a-a521-c870af1739d9 exists #### Interactions @@ -21,7 +23,7 @@ Upon receiving **a request for the index resource** from Pact Broker Client, wit } } ``` -Pactflow will respond with: +PactFlow will respond with: ```json { "status": 200, @@ -68,12 +70,53 @@ Upon receiving **a request to create a provider contract** from Pact Broker Clie } } ``` +PactFlow will respond with: +```json +{ + "status": 201, + "headers": { + "Content-Type": "application/hal+json;charset=utf-8" + } +} +``` + +Given **there is a pf:ui href in the response**, upon receiving **a request to create a provider contract** from Pact Broker Client, with +```json +{ + "method": "put", + "path": "/contracts/provider/Bar/version/1", + "headers": { + "Content-Type": "application/json", + "Accept": "application/hal+json" + }, + "body": { + "content": "LS0tCjpzb21lOiBjb250cmFjdAo=", + "contractType": "oas", + "contentType": "application/yaml", + "verificationResults": { + "success": true, + "content": "c29tZSByZXN1bHRz", + "contentType": "text/plain", + "format": "text", + "verifier": "my custom tool", + "verifierVersion": "1.0" + } + } +} +``` Pactflow will respond with: ```json { "status": 201, "headers": { "Content-Type": "application/hal+json;charset=utf-8" + }, + "body": { + "_links": { + "pf:ui": { + "href": "http://localhost:1235/contracts/bi-directional/provider/Bar/version/1/provider-contract" + } + } } } ``` @@ -109,7 +152,7 @@ Given **a team with UUID 2abbc12a-427d-432a-a521-c870af1739d9 exists**, upon rec } } ``` -Pactflow will respond with: +PactFlow will respond with: ```json { "status": 201, diff --git a/doc/pacts/markdown/README.md b/doc/pacts/markdown/README.md index 0b68df21..5ba4433b 100644 --- a/doc/pacts/markdown/README.md +++ b/doc/pacts/markdown/README.md @@ -1,4 +1,4 @@ ### Pacts for Pact Broker Client * [Pact Broker](Pact%20Broker%20Client%20-%20Pact%20Broker.md) -* [Pactflow](Pact%20Broker%20Client%20-%20Pactflow.md) +* [PactFlow](Pact%20Broker%20Client%20-%20Pactflow.md) diff --git a/example/scripts/oas.yml b/example/scripts/oas.yml new file mode 100644 index 00000000..6440c644 --- /dev/null +++ b/example/scripts/oas.yml @@ -0,0 +1,116 @@ +openapi: 3.0.1 +info: + title: Product API + description: Pactflow Product API demo + version: 1.0.0 +paths: + /products: + post: + summary: Create a product + description: Creates a new product + operationId: createProduct + requestBody: + description: Create a new Product + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/Product' + examples: + application/json: + value: + id: "1234" + type: "food" + price: 42 + responses: + "200": + description: successful operation + content: + "application/json; charset=utf-8": + schema: + $ref: '#/components/schemas/Product' + examples: + application/json: + value: + id: "1234" + type: "food" + price: 42 + get: + summary: List all products + description: Returns all products + operationId: getAllProducts + responses: + "200": + description: successful operation + content: + "application/json; charset=utf-8": + schema: + type: "array" + items: + $ref: '#/components/schemas/Product' + examples: + application/json: + value: + - id: "1234" + type: "food" + price: 42 + # name: "pizza" + # version: "1.0.0" + # see https://github.com/apiaryio/dredd/issues/1430 for why + "400": + description: Invalid ID supplied + content: {} + /product/{id}: + get: + summary: Find product by ID + description: Returns a single product + operationId: getProductByID + parameters: + - name: id + in: path + description: ID of product to get + schema: + type: string + required: true + example: 10 + responses: + "200": + description: successful operation + content: + "application/json; charset=utf-8": + schema: + $ref: '#/components/schemas/Product' + examples: + application/json: + value: + id: "1234" + type: "food" + price: 42 + # name: "pizza" + # version: "1.0.0" + # see https://github.com/apiaryio/dredd/issues/1430 for why + "400": + description: Invalid ID supplied + content: {} + "404": + description: Product not found + content: {} +components: + schemas: + Product: + type: object + required: + - id + - name + - price + properties: + id: + type: string + type: + type: string + name: + type: string + version: + type: string + price: + type: number diff --git a/example/scripts/publish-provider-contract.sh b/example/scripts/publish-provider-contract.sh new file mode 100755 index 00000000..9fa4b595 --- /dev/null +++ b/example/scripts/publish-provider-contract.sh @@ -0,0 +1,12 @@ +# assumes you've set PACT_BROKER_BASE_URL, PACT_BROKER_USERNAME and PACT_BROKER_PASSWORD already + +bundle exec bin/pactflow publish-provider-contract $(dirname "$0")/oas.yml \ + --provider pactflow-cli-test-provider \ + --provider-app-version 1.0.0 \ + --branch master \ + --tag master \ + --content-type application/yaml \ + --verification-exit-code=0 \ + --verification-results $(dirname "$0")/oas.yml \ + --verification-results-content-type application/yaml \ + --verifier pactflow-cli-test-provider diff --git a/lib/pact_broker/client/base_client.rb b/lib/pact_broker/client/base_client.rb index 0cda57a9..20087bfd 100644 --- a/lib/pact_broker/client/base_client.rb +++ b/lib/pact_broker/client/base_client.rb @@ -125,7 +125,7 @@ def url_for_relation relation_name, params end url else - raise PactBroker::Client::RelationNotFound.new("Could not find relation #{relation_name} in index resource. Try upgrading your Pact Broker as the feature you require may not exist in your version. If you are using Pactflow, you may not have the permissions required for this action.") + raise PactBroker::Client::RelationNotFound.new("Could not find relation #{relation_name} in index resource. Try upgrading your Pact Broker as the feature you require may not exist in your version. If you are using PactFlow, you may not have the permissions required for this action.") end end end diff --git a/lib/pact_broker/client/base_command.rb b/lib/pact_broker/client/base_command.rb index 560306a0..109fb0c7 100644 --- a/lib/pact_broker/client/base_command.rb +++ b/lib/pact_broker/client/base_command.rb @@ -90,9 +90,21 @@ def green(text) ::Term::ANSIColor.green(text) end + def blue(text) + ::Term::ANSIColor.blue(text) + end + + def magenta(text) + ::Term::ANSIColor.magenta(text) + end + def red(text) ::Term::ANSIColor.red(text) end + + def yellow(text) + ::Term::ANSIColor.yellow(text) + end end end end diff --git a/lib/pact_broker/client/can_i_deploy.rb b/lib/pact_broker/client/can_i_deploy.rb index ea690890..85ea4112 100644 --- a/lib/pact_broker/client/can_i_deploy.rb +++ b/lib/pact_broker/client/can_i_deploy.rb @@ -77,7 +77,7 @@ def computer_says(success) if dry_run? "Computer says no ¯\\_(ツ)_/¯ (but you're ignoring this by enabling dry run)" else - Term::ANSIColor.red("Computer says no ¯\_(ツ)_/¯") + Term::ANSIColor.red("Computer says no ¯\\_(ツ)_/¯") end end end diff --git a/lib/pact_broker/client/cli/can_i_deploy_long_desc.txt b/lib/pact_broker/client/cli/can_i_deploy_long_desc.txt index f1677f47..423d74ee 100644 --- a/lib/pact_broker/client/cli/can_i_deploy_long_desc.txt +++ b/lib/pact_broker/client/cli/can_i_deploy_long_desc.txt @@ -22,3 +22,7 @@ Can-i-deploy can also be used to check if arbitrary versions have a successful v $ pact-broker can-i-deploy --pacticipant Foo 173153ae0 \ --pacticipant Bar --latest main + +##### Polling + +If the verification process takes a long time and there are results missing when the can-i-deploy command runs in your CI/CD pipeline, you can configure the command to poll and wait for the missing results to arrive. The arguments to specify are `--retry-while-unknown TIMES` and `--retry-interval SECONDS`, set to appropriate values for your pipeline. diff --git a/lib/pact_broker/client/cli/custom_thor.rb b/lib/pact_broker/client/cli/custom_thor.rb index 833ea08c..76bdfbc7 100644 --- a/lib/pact_broker/client/cli/custom_thor.rb +++ b/lib/pact_broker/client/cli/custom_thor.rb @@ -28,7 +28,7 @@ def self.massage_args argv end def self.add_broker_config_from_environment_variables argv - return argv if argv[0] == 'help' || argv.empty? + return argv if argv[0] == '--help' || argv[0] == 'help' || argv.empty? add_option_from_environment_variable(argv, 'broker-base-url', 'b', 'PACT_BROKER_BASE_URL') end @@ -116,7 +116,7 @@ def params_from_options(keys) end def pact_broker_client_options - client_options = { verbose: options.verbose, pact_broker_base_url: options.broker_base_url } + client_options = { verbose: options.verbose, pact_broker_base_url: options.broker_base_url&.chomp('/') } client_options[:token] = options.broker_token || ENV['PACT_BROKER_TOKEN'] if options.broker_username || ENV['PACT_BROKER_USERNAME'] client_options[:basic_auth] = { diff --git a/lib/pact_broker/client/cli/matrix_commands.rb b/lib/pact_broker/client/cli/matrix_commands.rb index 9dd79586..e83899c4 100644 --- a/lib/pact_broker/client/cli/matrix_commands.rb +++ b/lib/pact_broker/client/cli/matrix_commands.rb @@ -13,6 +13,7 @@ def self.included(thor) method_option :pacticipant, required: true, aliases: "-a", desc: "The pacticipant name. Use once for each pacticipant being checked." method_option :version, required: false, aliases: "-e", desc: "The pacticipant version. Must be entered after the --pacticipant that it relates to." + method_option :ignore, required: false, desc: "The pacticipant name to ignore. Use once for each pacticipant being ignored. A specific version can be ignored by also specifying a --version after the pacticipant name option. The environment variable PACT_BROKER_CAN_I_DEPLOY_IGNORE may also be used to specify a pacticipant name to ignore, with commas to separate multiple pacticipant names if necessary." method_option :latest, required: false, aliases: "-l", banner: "[TAG]", desc: "Use the latest pacticipant version. Optionally specify a TAG to use the latest version with the specified tag." method_option :branch, required: false, desc: "The branch of the version for which you want to check the verification results.", default: nil method_option :main_branch, required: false, type: :boolean, desc: "Use the latest version of the configured main branch of the pacticipant as the version for which you want to check the verification results", default: false @@ -33,8 +34,9 @@ def can_i_deploy(*ignored_but_necessary) validate_credentials selectors = VersionSelectorOptionsParser.call(ARGV).select { |s| !s[:ignore] } - ignore_selectors = VersionSelectorOptionsParser.call(ARGV).select { |s| s[:ignore] } + ignore_selectors = VersionSelectorOptionsParser.call(ARGV).select { |s| s[:ignore] } + ignore_selectors_from_environment_variable validate_can_i_deploy_selectors(selectors) + validate_can_i_deploy_options dry_run = options.dry_run || ENV["PACT_BROKER_CAN_I_DEPLOY_DRY_RUN"] == "true" can_i_deploy_options = { output: options.output, retry_while_unknown: options.retry_while_unknown, retry_interval: options.retry_interval, dry_run: dry_run, verbose: options.verbose } result = CanIDeploy.call(selectors, { to_tag: options.to, to_environment: options.to_environment, limit: options.limit, ignore_selectors: ignore_selectors }, can_i_deploy_options, pact_broker_client_options) @@ -110,6 +112,16 @@ def validate_can_i_deploy_selectors(selectors) pacticipants_without_versions = selectors.select{ |s| s[:version].nil? && s[:latest].nil? && s[:tag].nil? && s[:branch].nil? }.collect{ |s| s[:pacticipant] } raise ::Thor::RequiredArgumentMissingError, "The version must be specified using `--version VERSION`, `--branch BRANCH` `--latest`, `--latest TAG`, or `--all TAG` for pacticipant #{pacticipants_without_versions.join(", ")}" if pacticipants_without_versions.any? end + + def validate_can_i_deploy_options + if options[:to_environment] && options[:to_environment].blank? + raise ::Thor::RequiredArgumentMissingError, "The environment name cannot be blank" + end + end + + def ignore_selectors_from_environment_variable + ENV.fetch("PACT_BROKER_CAN_I_DEPLOY_IGNORE", "").split(",").collect(&:strip).collect{ |i| { pacticipant: i } } + end end end end diff --git a/lib/pact_broker/client/cli/pact_commands.rb b/lib/pact_broker/client/cli/pact_commands.rb index 3c7620df..e41f3b4f 100644 --- a/lib/pact_broker/client/cli/pact_commands.rb +++ b/lib/pact_broker/client/cli/pact_commands.rb @@ -93,7 +93,7 @@ def validate_pact_path_list(paths) elsif path.start_with?("-") raise Thor::Error.new("ERROR: pact-broker publish was called with invalid arguments #{[path]}") else - raise Thor::Error.new("Specified pact file '#{path}' does not exist. This sometimes indicates one of the arguments has been specified with the wrong name and has been incorrectly identified as a file path.") + raise Thor::Error.new("Specified pact file '#{path}' does not exist. This sometimes indicates one of the arguments has been specified with the wrong name and has been incorrectly identified as a file path. If you are using Docker, check that you have mounted the pact file or directory into the container correctly using `-v`, and have specified the location of the pact file or directory in the *Docker container*, not the *host*.") end end end diff --git a/lib/pact_broker/client/cli/webhook_commands.rb b/lib/pact_broker/client/cli/webhook_commands.rb index 685f62c1..68552374 100644 --- a/lib/pact_broker/client/cli/webhook_commands.rb +++ b/lib/pact_broker/client/cli/webhook_commands.rb @@ -25,7 +25,7 @@ def self.shared_options_for_webhook_commands method_option :provider_verification_failed, type: :boolean, desc: "Trigger this webhook when a failed provider verification result is published" method_option :provider_verification_succeeded, type: :boolean, desc: "Trigger this webhook when a successful provider verification result is published" method_option :contract_requiring_verification_published, type: :boolean, desc: "Trigger this webhook when a contract is published that requires verification" - method_option :team_uuid, banner: "UUID", desc: "UUID of the Pactflow team to which the webhook should be assigned (Pactflow only)" + method_option :team_uuid, banner: "UUID", desc: "UUID of the PactFlow team to which the webhook should be assigned (PactFlow only)" shared_authentication_options end end diff --git a/lib/pact_broker/client/colorize_notices.rb b/lib/pact_broker/client/colorize_notices.rb index fa694415..69335aa8 100644 --- a/lib/pact_broker/client/colorize_notices.rb +++ b/lib/pact_broker/client/colorize_notices.rb @@ -1,5 +1,5 @@ require 'term/ansicolor' - +require "uri" module PactBroker module Client class ColorizeNotices @@ -11,16 +11,27 @@ def self.call(notices) def self.colorized_message(notice) color = color_for_type(notice.type) - if color + uri_strings = ::URI.extract(notice.text, %w(http https)) + if color && uri_strings.any? + color_for_url(::Term::ANSIColor.color(color, notice.text || ''), uri_strings) + elsif color ::Term::ANSIColor.color(color, notice.text || '') + elsif uri_strings.any? + color_for_url(notice.text, uri_strings) else notice.text end end + def self.color_for_url(text, uris) + uris.inject(text) do | new_text, uri | + new_text.gsub(uri, ::Term::ANSIColor.magenta(uri)) + end + end + def self.color_for_type(type) case type - when "warning", "prompt" then "yellow" + when "warning", "prompt" then :yellow when "error", "danger" then :red when "success" then :green else nil diff --git a/lib/pact_broker/client/deployments/record_release.rb b/lib/pact_broker/client/deployments/record_release.rb index 65edcd2a..f10bfcc9 100644 --- a/lib/pact_broker/client/deployments/record_release.rb +++ b/lib/pact_broker/client/deployments/record_release.rb @@ -31,7 +31,7 @@ def action_relation_name def not_supported_message if is_pactflow? - "This version of Pactflow does not support recording #{action}s, or you do not have the required permission to read environments. Please upgrade to the latest version if using Pactflow On-Premises, and ensure the user has the environment read permission." + "This version of PactFlow does not support recording #{action}s, or you do not have the required permission to read environments. Please upgrade to the latest version if using PactFlow On-Premises, and ensure the user has the environment read permission." else "This version of the Pact Broker does not support recording #{action}s. Please upgrade to version 2.80.0 or later." end diff --git a/lib/pact_broker/client/environments/environment_command.rb b/lib/pact_broker/client/environments/environment_command.rb index 2076c583..642ceedc 100644 --- a/lib/pact_broker/client/environments/environment_command.rb +++ b/lib/pact_broker/client/environments/environment_command.rb @@ -8,7 +8,7 @@ class EnvironmentCommand < PactBroker::Client::BaseCommand using PactBroker::Client::HashRefinements NOT_SUPPORTED_MESSAGE = "This version of the Pact Broker does not support environments. Please upgrade to version 2.80.0 or later." - PACTFLOW_NOT_SUPPORTED_MESSAGE = "This version of Pactflow does not support environments or you do not have the required permission to read them. Please upgrade to the latest version if using Pactflow On-Premises and ensure the user has the environment read permission." + PACTFLOW_NOT_SUPPORTED_MESSAGE = "This version of PactFlow does not support environments or you do not have the required permission to read them. Please upgrade to the latest version if using PactFlow On-Premises and ensure the user has the environment read permission." private diff --git a/lib/pact_broker/client/git.rb b/lib/pact_broker/client/git.rb index 659f3bca..d12efd80 100644 --- a/lib/pact_broker/client/git.rb +++ b/lib/pact_broker/client/git.rb @@ -14,6 +14,7 @@ bamboo.repository.git.branch https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html BITBUCKET_BRANCH BITBUCKET_COMMIT https://confluence.atlassian.com/bitbucket/variables-in-pipelines-794502608.html BUILD_SOURCEBRANCHNAME BUILD_SOURCEVERSION Azure +CIRRUS_BRANCH CIRRUS_CHANGE_IN_REPO https://cirrus-ci.org/guide/writing-tasks/#environment-variables =end # Keep in sync with pact-provider-verifier/lib/pact/provider_verifier/git.rb @@ -25,8 +26,8 @@ module Git using PactBroker::Client::HashRefinements COMMAND = 'git rev-parse --abbrev-ref HEAD'.freeze - BRANCH_ENV_VAR_NAMES = %w{GITHUB_HEAD_REF GITHUB_REF BUILDKITE_BRANCH CIRCLE_BRANCH TRAVIS_BRANCH GIT_BRANCH GIT_LOCAL_BRANCH APPVEYOR_REPO_BRANCH CI_COMMIT_REF_NAME BITBUCKET_BRANCH BUILD_SOURCEBRANCHNAME}.freeze - COMMIT_ENV_VAR_NAMES = %w{GITHUB_SHA BUILDKITE_COMMIT CIRCLE_SHA1 TRAVIS_COMMIT GIT_COMMIT APPVEYOR_REPO_COMMIT CI_COMMIT_ID BITBUCKET_COMMIT BUILD_SOURCEVERSION} + BRANCH_ENV_VAR_NAMES = %w{GITHUB_HEAD_REF GITHUB_REF BUILDKITE_BRANCH CIRCLE_BRANCH TRAVIS_BRANCH GIT_BRANCH GIT_LOCAL_BRANCH APPVEYOR_REPO_BRANCH CI_COMMIT_REF_NAME BITBUCKET_BRANCH BUILD_SOURCEBRANCHNAME CIRRUS_BRANCH}.freeze + COMMIT_ENV_VAR_NAMES = %w{GITHUB_SHA BUILDKITE_COMMIT CIRCLE_SHA1 TRAVIS_COMMIT GIT_COMMIT APPVEYOR_REPO_COMMIT CI_COMMIT_ID BITBUCKET_COMMIT BUILD_SOURCEVERSION CIRRUS_CHANGE_IN_REPO} BUILD_URL_ENV_VAR_NAMES = %w{BUILDKITE_BUILD_URL CIRCLE_BUILD_URL TRAVIS_BUILD_WEB_URL BUILD_URL } def self.commit diff --git a/lib/pact_broker/client/hal/entity.rb b/lib/pact_broker/client/hal/entity.rb index d5790f90..5ebbffc9 100644 --- a/lib/pact_broker/client/hal/entity.rb +++ b/lib/pact_broker/client/hal/entity.rb @@ -163,7 +163,7 @@ def self_href(entity_hash) end def relation_not_found_error_message(key, href) - "Could not find relation '#{key}' in resource at #{href}. The most likely reason for this is that you are on an old version of the Pact Broker and you need to upgrade, or you are using Pactflow and you don't have the permissions required for this action." + "Could not find relation '#{key}' in resource at #{href}. The most likely reason for this is that you are on an old version of the Pact Broker and you need to upgrade, or you are using PactFlow and you don't have the permissions required for this action." end end diff --git a/lib/pact_broker/client/hal_client_methods.rb b/lib/pact_broker/client/hal_client_methods.rb index dc6ba6b3..a312475e 100644 --- a/lib/pact_broker/client/hal_client_methods.rb +++ b/lib/pact_broker/client/hal_client_methods.rb @@ -29,7 +29,7 @@ def is_pactflow? end def pact_broker_name - is_pactflow? ? "Pactflow" : "the Pact Broker" + is_pactflow? ? "PactFlow" : "the Pact Broker" end end end diff --git a/lib/pact_broker/client/string_refinements.rb b/lib/pact_broker/client/string_refinements.rb index ac391f65..9344aa16 100644 --- a/lib/pact_broker/client/string_refinements.rb +++ b/lib/pact_broker/client/string_refinements.rb @@ -5,6 +5,10 @@ module StringRefinements def blank? true end + + def not_blank? + false + end end refine String do diff --git a/lib/pact_broker/client/version.rb b/lib/pact_broker/client/version.rb index 02baa3b0..91f8a39a 100644 --- a/lib/pact_broker/client/version.rb +++ b/lib/pact_broker/client/version.rb @@ -1,5 +1,5 @@ module PactBroker module Client - VERSION = '1.65.0' + VERSION = '1.68.0' end end diff --git a/lib/pactflow/client/cli/provider_contract_commands.rb b/lib/pactflow/client/cli/provider_contract_commands.rb index 2276cdcd..66e82569 100644 --- a/lib/pactflow/client/cli/provider_contract_commands.rb +++ b/lib/pactflow/client/cli/provider_contract_commands.rb @@ -10,7 +10,7 @@ module ProviderContractCommands def self.included(thor) thor.class_eval do - desc 'publish-provider-contract CONTRACT_FILE ...', "Publish provider contract to Pactflow" + desc 'publish-provider-contract CONTRACT_FILE ...', "Publish provider contract to PactFlow" method_option :provider, required: true, desc: "The provider name" method_option :provider_app_version, required: true, aliases: "-a", desc: "The provider application version" method_option :branch, aliases: "-h", desc: "Repository branch of the provider version" diff --git a/lib/pactflow/client/provider_contracts/publish.rb b/lib/pactflow/client/provider_contracts/publish.rb index b25052b7..dfb5acf0 100644 --- a/lib/pactflow/client/provider_contracts/publish.rb +++ b/lib/pactflow/client/provider_contracts/publish.rb @@ -1,5 +1,6 @@ require "pact_broker/client/base_command" require "pact_broker/client/versions/create" +require 'pact_broker/client/colorize_notices' require "base64" module Pactflow @@ -22,8 +23,33 @@ def initialize(params, options, pact_broker_client_options) def do_call create_branch_version_and_tags - create_contract - PactBroker::Client::CommandResult.new(true, green("Successfully published provider contract for #{provider_name} version #{provider_version_number} to Pactflow")) + render_response(create_contract) + end + + def render_response(res) + notices = [ + { type: 'success', text: "Successfully published provider contract for #{provider_name} version #{provider_version_number} to PactFlow"}, + ] + if res.body && res.body['_links'] && res.body['_links']['pf:ui']['href'] + notices.concat([{ text: "View the uploaded contract at #{res.body['_links']['pf:ui']['href']}" }]) + end + notices.concat(next_steps) + PactBroker::Client::CommandResult.new(true, PactBroker::Client::ColorizeNotices.call(notices.collect do |n| + OpenStruct.new(n) + end).join("\n")) + end + + def next_steps + [ + { type: 'prompt', text: 'Next steps:' }, + { type: 'prompt', + text: ' * Check your application is safe to deploy - https://docs.pact.io/can_i_deploy' }, + { text: " pact-broker can-i-deploy --pacticipant #{provider_name} --version #{provider_version_number} --to-environment " }, + { type: 'prompt', + text: ' * Record deployment or release to specified environment (choose one) - https://docs.pact.io/go/record-deployment' }, + { text: " pact-broker record-deployment --pacticipant #{provider_name} --version #{provider_version_number} --environment " }, + { text: " pact-broker record-release --pacticipant #{provider_name} --version #{provider_version_number} --environment " } + ] end def create_branch_version_and_tags @@ -44,7 +70,7 @@ def create_branch_version_and_tags def create_contract contract_path = "#{pact_broker_base_url}/contracts/provider/{provider}/version/{version}" entrypoint = create_entry_point(contract_path, pact_broker_client_options) - entrypoint.expand(provider: provider_name, version: provider_version_number).put!(contract_params) + entrypoint.expand(provider: provider_name, version: provider_version_number).put!(contract_params).response end def contract_params @@ -56,7 +82,7 @@ def contract_params verifier: verification_results[:verifier], verifierVersion: verification_results[:verifier_version] }.compact - + body_params = { content: encode_content(contract[:content]), contractType: contract[:specification], @@ -66,7 +92,6 @@ def contract_params if verification_results_params.any? body_params[:verificationResults] = verification_results_params end - body_params end diff --git a/pact-broker-client.gemspec b/pact-broker-client.gemspec index 3f22dc1f..d99cb2f2 100644 --- a/pact-broker-client.gemspec +++ b/pact-broker-client.gemspec @@ -21,18 +21,18 @@ Gem::Specification.new do |gem| gem.require_paths = ["lib"] gem.license = 'MIT' - gem.add_runtime_dependency 'httparty', '~>0.18.1' # https://github.com/jnunemaker/httparty/issues/733 + gem.add_runtime_dependency 'httparty', ">= 0.21.0", "< 1.0.0" gem.add_runtime_dependency 'term-ansicolor', '~> 1.7' gem.add_runtime_dependency 'table_print', '~> 1.5' gem.add_runtime_dependency 'thor', '>= 0.20', '< 2.0' gem.add_runtime_dependency 'rake', '~> 13.0' #For FileList gem.add_runtime_dependency 'dig_rb', '~> 1.0' - gem.add_development_dependency 'fakefs', '~> 0.4' + gem.add_development_dependency 'fakefs', '~> 2.4' gem.add_development_dependency 'webmock', '~> 3.0' gem.add_development_dependency 'conventional-changelog', '~>1.3' gem.add_development_dependency 'pact', '~> 1.16' gem.add_development_dependency 'pact-support', '~> 1.16' - gem.add_development_dependency 'approvals', '0.0.18' + gem.add_development_dependency 'approvals', '0.0.26' gem.add_development_dependency 'rspec-its', '~> 1.3' end diff --git a/script/update-cli-usage-in-readme.rb b/script/update-cli-usage-in-readme.rb index b0df44b7..3465256b 100755 --- a/script/update-cli-usage-in-readme.rb +++ b/script/update-cli-usage-in-readme.rb @@ -22,7 +22,7 @@ ] PACTFLOW_COMMAND_GROUPS = [ - [Pactflow::Client::CLI::Pactflow, "Provider contracts (Pactflow only)", %w[publish-provider-contract]] + [Pactflow::Client::CLI::Pactflow, "Provider contracts (PactFlow only)", %w[publish-provider-contract]] ] def print_wrapped(message, options = {}) @@ -86,12 +86,16 @@ def generate_thor_docs(command_groups) /^Usage:/ => :usage }, usage: { - /^Options:/ => :options + /^Options:/ => :options, }, options: { /^$/ => :after_options }, after_options: { + /^Usage:/ => :usage, + /^ ##### / => :section_in_usage + }, + section_in_usage: { /^Usage:/ => :usage } } @@ -126,13 +130,14 @@ def reformat_docs(generated_thor_docs, command) @current_state = transitions[line_starts_with] end - lines = if has_option_and_banner(line) option, banner = line.split("#", 2) [option] + format_banner("# " + banner) elsif has_only_banner(line) space, banner = line.split("#", 2) format_banner("# " + banner) + elsif @current_state == :section_in_usage + [line.strip] else [line] end diff --git a/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb b/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb index f56f0761..3f4ef32d 100644 --- a/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb +++ b/spec/lib/pact_broker/client/cli/broker_can_i_deploy_spec.rb @@ -70,6 +70,16 @@ module CLI expect(CanIDeploy).to receive(:call).with(anything, {to_tag: nil, to_environment: 'prod', limit: 1000, ignore_selectors: []}, anything, anything) invoke_can_i_deploy end + + context "when the environment is an empty string" do + before do + subject.options.to_environment = ' ' + end + + it "raises an error" do + expect { invoke_can_i_deploy }.to raise_error ::Thor::RequiredArgumentMissingError + end + end end context "with basic auth" do @@ -107,6 +117,18 @@ module CLI end end + context "when PACT_BROKER_CAN_I_DEPLOY_IGNORE=Some Service" do + before do + allow(ENV).to receive(:fetch).and_call_original + allow(ENV).to receive(:fetch).with("PACT_BROKER_CAN_I_DEPLOY_IGNORE", "").and_return("Some Service, Some Other Service") + end + + it "invokes the CanIDeploy service with ignore selectors" do + expect(CanIDeploy).to receive(:call).with(anything, hash_including(ignore_selectors: [ { pacticipant: "Some Service" }, { pacticipant: "Some Other Service" } ]), anything, anything) + invoke_can_i_deploy + end + end + context "when successful" do it "prints the message to stdout" do expect($stdout).to receive(:puts).with(message) diff --git a/spec/lib/pact_broker/client/cli/custom_thor_spec.rb b/spec/lib/pact_broker/client/cli/custom_thor_spec.rb index 6e69bcc1..ca128fb5 100644 --- a/spec/lib/pact_broker/client/cli/custom_thor_spec.rb +++ b/spec/lib/pact_broker/client/cli/custom_thor_spec.rb @@ -27,6 +27,15 @@ def test_using_env_vars Delegate.call(options) end + desc '', '' + method_option :broker_base_url, required: true, aliases: "-b" + method_option :broker_username, aliases: "-u" + method_option :broker_password, aliases: "-p" + method_option :broker_token, aliases: "-k" + def test_pact_broker_client_options + Delegate.call(pact_broker_client_options) + end + desc '', '' ignored_and_hidden_potential_options_from_environment_variables def test_without_parameters @@ -72,6 +81,21 @@ def test_without_parameters end end + it "removes trailing slashes from the broker base url when passed as an arg" do + expect(Delegate).to receive(:call) do | options | + expect(options[:pact_broker_base_url]).to eq 'http://bar' + end + TestThor.start(%w{test_pact_broker_client_options --broker-base-url http://bar/}) + end + + it "removes trailing slashes from the broker base url when passed as an env var" do + ENV['PACT_BROKER_BASE_URL'] = 'http://bar/' + expect(Delegate).to receive(:call) do | options | + expect(options[:pact_broker_base_url]).to eq 'http://bar' + end + TestThor.start(%w{test_pact_broker_client_options}) + end + describe ".turn_muliple_tag_options_into_array" do it "turns '--tag foo --tag bar' into '--tag foo bar'" do input = %w{--ignore this --tag foo --tag bar --wiffle --that} diff --git a/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb b/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb index 8fbbec68..2827470f 100644 --- a/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb +++ b/spec/lib/pact_broker/client/deployments/record_deployment_spec.rb @@ -96,7 +96,7 @@ module Deployments expect(subject.message).to include "does not support" end - context "when the server is Pactflow" do + context "when the server is PactFlow" do let(:index_headers) { { "Content-Type" => "application/hal+json", "Pactflow-Something" => "foo" } } it "returns an error response" do @@ -165,7 +165,7 @@ module Deployments expect(subject.message).to include "No environment found with name 'test'. Available options: prod" end - context "when the server is Pactflow" do + context "when the server is PactFlow" do let(:index_headers) { { "Content-Type" => "application/hal+json", "X-Pactflow-Sha" => "123" } } it "returns a customised message" do @@ -191,7 +191,7 @@ module Deployments end end - context "when the response headers contain Pactflow" do + context "when the response headers contain PactFlow" do before do allow_any_instance_of(RecordDeployment).to receive(:check_if_command_supported) allow_any_instance_of(RecordDeployment).to receive(:check_environment_exists) @@ -205,8 +205,8 @@ module Deployments double('PactBroker::Client::Hal::Entity', response: double('response', headers: response_headers) ) end - it "indicates the API was Pactflow" do - expect(subject.message).to include "Recorded deployment of Foo version 1 to test environment (application instance blue) in Pactflow" + it "indicates the API was PactFlow" do + expect(subject.message).to include "Recorded deployment of Foo version 1 to test environment (application instance blue) in PactFlow" end context "when application_instance is nil" do diff --git a/spec/pacts/pact_broker_client-pactflow.json b/spec/pacts/pact_broker_client-pactflow.json index 0ca7124f..8a7a970c 100644 --- a/spec/pacts/pact_broker_client-pactflow.json +++ b/spec/pacts/pact_broker_client-pactflow.json @@ -3,7 +3,7 @@ "name": "Pact Broker Client" }, "provider": { - "name": "Pactflow" + "name": "PactFlow" }, "interactions": [ { @@ -36,6 +36,44 @@ } } }, + { + "description": "a request to create a provider contract", + "providerState": "there is a pf:ui href in the response", + "request": { + "method": "put", + "path": "/contracts/provider/Bar/version/1", + "headers": { + "Content-Type": "application/json", + "Accept": "application/hal+json" + }, + "body": { + "content": "LS0tCjpzb21lOiBjb250cmFjdAo=", + "contractType": "oas", + "contentType": "application/yaml", + "verificationResults": { + "success": true, + "content": "c29tZSByZXN1bHRz", + "contentType": "text/plain", + "format": "text", + "verifier": "my custom tool", + "verifierVersion": "1.0" + } + } + }, + "response": { + "status": 201, + "headers": { + "Content-Type": "application/hal+json;charset=utf-8" + }, + "body": { + "_links": { + "pf:ui": { + "href": "http://localhost:1235/contracts/bi-directional/provider/Bar/version/1/provider-contract" + } + } + } + } + }, { "description": "a request for the index resource", "request": { diff --git a/spec/service_providers/pact_helper.rb b/spec/service_providers/pact_helper.rb index cf078974..8b22f83e 100644 --- a/spec/service_providers/pact_helper.rb +++ b/spec/service_providers/pact_helper.rb @@ -15,7 +15,7 @@ end end - has_pact_with "Pactflow" do + has_pact_with "PactFlow" do mock_service :pactflow do port 1235 pact_specification_version "2.0" diff --git a/spec/service_providers/pactflow_publish_provider_contract_spec.rb b/spec/service_providers/pactflow_publish_provider_contract_spec.rb index 8ae3ae8d..d7ffdcf0 100644 --- a/spec/service_providers/pactflow_publish_provider_contract_spec.rb +++ b/spec/service_providers/pactflow_publish_provider_contract_spec.rb @@ -2,7 +2,7 @@ require "pactflow/client/provider_contracts/publish" require "yaml" -RSpec.describe "publishing a provider contract to Pactflow", pact: true do +RSpec.describe "publishing a provider contract to PactFlow", pact: true do before do # no point re-testing this allow(PactBroker::Client::Versions::Create).to receive(:call).and_return(double("result", success: true)) @@ -87,6 +87,41 @@ expect(subject).to be_a PactBroker::Client::CommandResult expect(subject.success).to be true expect(subject.message).to include "Successfully published provider contract for Bar version 1" + expect(subject.message).not_to include pactflow.mock_service_base_url end end -end + + context "creating a provider contract with valid parameters with pf:ui return results" do + let(:success_response_with_pf_ui_url) do + { + status: response_status, + headers: pact_broker_response_headers, + body: { "_links": { + "pf:ui": { + "href": "#{pactflow.mock_service_base_url}/contracts/bi-directional/provider/Bar/version/1/provider-contract" + } + } } + } + end + before do + pactflow + .given("there is a pf:ui href in the response") + .upon_receiving("a request to create a provider contract") + .with( + method: :put, + path: "/contracts/provider/Bar/version/1", + headers: put_request_headers, + body: request_body + ) + .will_respond_with(success_response_with_pf_ui_url) + end + + it "returns a CommandResult with success = true and a provider contract ui url" do + expect(subject).to be_a PactBroker::Client::CommandResult + expect(subject.success).to be true + expect(subject.message).to include "Successfully published provider contract for Bar version 1" + expect(subject.message).to include "Next steps:" + expect(subject.message).to include success_response_with_pf_ui_url[:body][:_links][:'pf:ui'][:href] + end + end +end \ No newline at end of file diff --git a/spec/service_providers/pactflow_webhooks_create_spec.rb b/spec/service_providers/pactflow_webhooks_create_spec.rb index faa34865..bb395e05 100644 --- a/spec/service_providers/pactflow_webhooks_create_spec.rb +++ b/spec/service_providers/pactflow_webhooks_create_spec.rb @@ -1,7 +1,7 @@ require_relative 'pact_helper' require 'pact_broker/client/webhooks/create' -RSpec.describe "creating a webhook in Pactflow", pact: true do +RSpec.describe "creating a webhook in PactFlow", pact: true do include_context "pact broker" include PactBrokerPactHelperMethods diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6aa79201..9e40586c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,8 @@ require 'webmock/rspec' require 'rspec/its' +ENV["PACT_BROKER_CAN_I_DEPLOY_IGNORE"] = nil + WebMock.disable_net_connect!(allow_localhost: true) require "./spec/support/shared_context.rb"