https://pact.io logo
Join Slack
Powered by
# pact-broker
  • g

    Greg Tyler

    02/04/2022, 9:26 AM
    Hiya folks! I was looking for a bit of advise with webhooks, might be doing something silly. Part of my current process is: • PR against the provider tests against latest consumer Pacts tagged
    main
    (to ensure no regressions are being introduced) • Test results are published to Pact Broker • This triggers a webhook because
    provider_verification_published
    was fired ◦ The webhook is to set a “Pact verification” commit status check on GitHub • Because we’re checking against
    main
    , this updates the status of the HEAD commit Ultimately this means that my “Pact verification” status check on the main/HEAD commit reflects the last provider PR rather than the actual PR status. I have a few solution ideas: 1. Am I missing a webhook setting to only trigger when the provider build was tagged
    main
    ?
    That way I’d stop pushing commit statuses for PRs. 2. Should I not publish Pact results from PRs to the Broker? That would ensure it didn’t trigger the webhook, but would limit the amount of useful information in the Broker 3. Should I include the provider version in the GitHub commit status context? (e.g. so I have “Pact verification against main”, “Pact verification against {PR name}“) This will mean I have extra checks, potentially including failures from irrelevant provider PRs I’m erring towards the second option, but I think this is a slightly philosophical “how to use Pact” question so would be interested to hear what other users and maintainers think.
    a
    • 2
    • 4
  • t

    Thomas K

    02/04/2022, 11:47 AM
    Hello, does anyone please have an example of how they bring up a cloud postgresql instance via Terraform? I have everything working but for some reason the
    PACT_BROKER_BASIC_AUTH
    stuff doesnt seem to be working. I know I had it working before I terraformed my infra. When I made the database manually and ran the psql commands
    Copy code
    CREATE DATABASE pact_broker;
    CREATE ROLE pact_broker WITH LOGIN PASSWORD 'CHANGE_ME';
    GRANT ALL PRIVILEGES ON DATABASE pact_broker TO pact_broker;
    the basic auth stuff worked fine
    m
    • 2
    • 24
  • r

    Rafael Anachoreta

    02/07/2022, 11:29 AM
    Maybe a silly question, but how can I get the latest version of a contract deployed to an environment? Similar to
    describe-version --latest=production
    except using environments
    m
    • 2
    • 6
  • c

    Christoph Oswald

    02/09/2022, 9:55 AM
    Hi, I have a question, regarding the webhooks described here (https://docs.pact.io/pact_nirvana/step_4#e-configure-pact-to-be-verified-when-contract-changes). Would you rather 1) create a webhook to trigger a generic CI build, that takes the parameters of the pact and figures out which provider build to trigger, or 2) create a webhook for each provider/consumer combination so that the correct provider build is triggered whenever the consumer changes a pact
    m
    • 2
    • 10
  • é

    Édouard Lopez

    02/09/2022, 1:38 PM
    Is there an endpoint to check the version of pack-broker deployed ? E.g.
    <https://foo.bar/version>
    ?
    g
    • 2
    • 2
  • d

    Dean Miley

    02/09/2022, 2:17 PM
    Hi Team, we have created a PR to fix some issues identified in pact-broker that were identified by our vulnerability scanner (Black Duck). How do we go about having these changes merged into master and a new version released? The PR in question is: https://github.com/pact-foundation/pact_broker/pull/542
    🙌 1
    m
    • 2
    • 1
  • b

    Beth (pactflow.io/Pact Broker/pact-ruby)

    02/13/2022, 9:28 PM
    Hi <!channel> this is an announcement that we will be dropping support for Docker 19.03 for the Pact Broker image. This is because we need to move to a newer alpine base image to fix the many vulnerabilities that are present in alpine3.13. Docker 19.03 is official EOL now. Please update your systems if you are using Docker 19.03. https://github.com/pact-foundation/pact-broker-docker/issues/76
    ✔️ 1
    party parrot 2
    👍 14
    n
    m
    • 3
    • 3
  • a

    Ajay Kawde

    02/14/2022, 7:46 AM
    Hi Guys , if i have RequestResponseObject can i create a pact contract json file from it in java
    b
    • 2
    • 4
  • a

    andrewhiles

    02/14/2022, 12:30 PM
    Hi folks, I've got an OSS Pact Broker image deployed on AWS ECS with an NGINX reverse-proxy sitting in front of the app. Due to pre-existing conventions, the app must reside under a sub-path versus root context (e.g. /pactbroker). I have set the sub path as part of the broker base url and everything works fine except for hyperlinks on the matrix page which don't appear to respect the sub-path. I get 404s for any links on the matrix page - but if I re-add the sub-path manually in the browser the links resolve. Has anyone else experienced this before? Any information would be greatly appreciated. Thank you kindly.
    g
    b
    • 3
    • 6
  • r

    ritika arora

    02/15/2022, 8:13 AM
    Hi team, I need help understanding VersionSelector annotation. I specified my branch name in tag and still it verifies against all previous versions of that branch? annotation:
    Copy code
    @Provider("booking-server")
    @PactBroker(
        url = "<https://pact-broker.rcue102.viatorsystems.com>",
        consumerVersionSelectors = @VersionSelector(consumer = "orion", tag = "feature_COPS-8656-orion-create-v2-pact-consumer-SNAPSHOT", fallbackTag = "develop")
    )
    @Tag("Contract")
    ProviderTestRun:
    m
    d
    b
    • 4
    • 19
  • a

    Antonio Gámiz Delgado

    02/15/2022, 11:20 AM
    Hi, I’m getting this error:
    This version of the Pact Broker requires that both consumer and provider are specified for a webhook.
    running this example: https://github.com/pactflow/example-consumer/blob/master/Makefile#L114
    m
    b
    • 3
    • 23
  • s

    Simon

    02/15/2022, 5:18 PM
    Hi! Some of my pacts are presented with the following message:
    Note: this contract could not be parsed to a v1 or v2 Pact, showing raw content instead.
    However, the pact specification version registered at the bottom of the pact JSON is 2.0.0 (See screenshot). The pacts are generated by
    pact-python
    version 0.21 and I'm using OSS broker version 2.89. Any idea why this is happening?
    m
    • 2
    • 3
  • d

    Darwin Cahyadi

    02/20/2022, 8:53 PM
    Hi everyone would like to ask! if a
    Consumer A
    branch
    feat/changeField
    publishes a new pact (tagged as
    feat/changeField
    ) that changes the body attribute
    id
    to
    uuid
    , how does the Provider can merge the changes when publised pact from
    Consumer A
    branch
    master
    still use
    id
    ? (it will make the step provider verification in build pipeline always failed) Current config is consumerVersionSelectors: [{ tag: 'master', latest: true }, { deployed: true } ]
    b
    • 2
    • 3
  • y

    yuvaraj gunisetti

    02/21/2022, 8:05 AM
    I want to create Webhooks with Personal access token of Azure DevOps since the user credentials usage is disabled. I couldn't find any documentation that can help me on this in the pact docs. Please someone suggest
    m
    a
    • 3
    • 3
  • a

    Adam Rodger (pact-net)

    02/25/2022, 2:53 PM
    Looking for some advice on the broker - we currently store all of our webooks in a git repo so that we can GitOps them (i.e. they're the source of truth). However, way back when I originally made this the only way to make this work was by writing a script that first deleted every single webhook and then recreated them all. The webhooks get non-determinstic random IDs, so there's no way to check if a hook already exists. It works really nicely though, because if you create a new API then you just add an entry into the hooks repo and the CI creates all the hooks for it automatically. The only bit that's not nice is it takes a while to run because there's so many API calls deleting and recreating hooks, and once you delete a hook you lose all the history for it. Does anyone know of a better way to manage webhooks?
    m
    b
    • 3
    • 13
  • r

    Rafael Anachoreta

    03/03/2022, 5:28 PM
    For teams using a) feature branches where published pacts are tagged and have
    branch
    set, b) the new
    contract_requiring_verification_published
    webhook event to trigger new verification and c) the
    deployedOrRelease
    selector pointing to the main branch, is there any benefit to having WIP and Pending pacts enabled? From reading the docs, they seem to me more like a safeguard for teams that haven’t figured out their workflow, but maybe I’m missing something.
    b
    • 2
    • 4
  • d

    Deven Chen

    03/04/2022, 2:42 AM
    I use 'Delete Pacts' from the broker and expecting it will delete all historical interactions. however, when I run the provider test, it still picks up a very old pact test from broker. Why is that? is there a way we can find all the pact uploaded by consumers and delete them?
    b
    m
    • 3
    • 55
  • d

    Deven Chen

    03/04/2022, 8:38 AM
    we use token to access the webhook from broker, I discovered that the previous config got the token wrong in the broker. Is there a way to correct the token setting in the broker?
    m
    • 2
    • 27
  • a

    Arístides Suárez

    03/07/2022, 10:06 AM
    Hi folks, where can I find information about Pact-broker usage strategies? Right now we're using a very simple strategy: - enablePendingPacts in providers - when a breaking change in pacts is needed, consumers must create a new feature Tag in Pact-broker. - providers set pact-tests to use the new feature tag. - after development is complete, pacts are published in the main Tag and providers set pact-tests to use the main tag. - finally, pacts in the feature Tag are deleted. (We aren't using either WIP or recording deployments or releases) (We don't use branch because this is not supported in all client libraries) What do you think about this strategy? Thanks!
    b
    • 2
    • 5
  • p

    Paul

    03/07/2022, 4:55 PM
    Hi all, Got a question regarding workflow. So we have Consumer A which has PACTs with Provider B at 3 tags (dev, preprod & prod – we haven’t moved to environments yet). This is working fine. We introduce Provider C which is a provider to Consumer A. We release Provider C to dev as we have set the
    failIfNoPactsFound
    for the pact:verify and can-i-deploy. Consumer A has a new PACT created to Provider C and released to dev. This works OK. The problem we found is trying to release Provider C to ‘preprod’ where the can-i-deploy says it cannot as there isn’t Consumer A in preprod (which it is true that there isn’t this integration contract between these pacticipants in preprod). I think this though should be a valid workflow (it’s as though it found the integration, so expects the PACT to be available at all tags). We got around it 1st time by deleting the integration, then deploying the provider to all environments before introducing the new Consumer A v Provider C PACT (but think this is a bit of a blunt hammer). It would be good to understand if we are missing something here, and is it something that may be helped through moving to environments? Many thanks in advance.
    b
    • 2
    • 10
  • d

    David Van Couvering (DVC) - eBay

    03/08/2022, 10:42 PM
    Hi. I'm seeing this in the pact broker logs:
    Copy code
    [pact-broker-86f7555f4b-xsvp5] 22:31:58 I [security] -- Could not detect any credentials in cookies or headers
    This appears to happen when we submit a pact publish or a can-i-deploy from the Pact Maven plugin. Is there a way for us to debug whether or not Pact Maven is picking up the token from the environment? We set it in the environment, but perhaps we didn't set it correctly. What's weird is the pact publish succeeds, but can-i-deploy fails:
    Copy code
    [ERROR] Failed to execute goal au.com.dius.pact.provider:maven:4.2.13:can-i-deploy (default-cli) on project storefrontxs-svc: Can you deploy? Computer says no �\_(?)_/� Request to path '/matrix?q[][pacticipant]=storefrontxs-svc&latestby=cvp&q[][version]=11c8924&latest=true&tag=master&ignore[][pacticipant]=fdbkexp' failed with response 'HTTP/1.1 401 Unauthorized' -> [Help 1]
    When we run can-i-deploy locally it works fine. When I pass that path into the HAL browser it works fine. It's just a problem on Jenkins, but we can't figure out what the problem is
    u
    a
    • 3
    • 31
  • d

    Deven Chen

    03/10/2022, 4:54 AM
    Hi here, I noticed that when pact broker calls the provider webhook, it passed a couple of
    PACT_CONSUMER_TAG
    e.g.:
    PACT_CONSUMER_TAG="bugfix_COPS-8853-orion-reenable-contract, bugfix_COPS-8853-orion-reenable-contract-SNAPSHOT"
    , looks like
    @VersionSelector(consumer = "orion", tag = "${pactConsumerTag}")
    could not really handle multiple tags in that format, is that expected?
    b
    • 2
    • 14
  • p

    Pavlo Sprogis

    03/15/2022, 12:19 PM
    hi all, I’m using pact broker cli to publish pacts
    Copy code
    ./pact/bin/pact-broker version
    1.59.0
    command:
    Copy code
    ./pact/bin/pact-broker publish ./target/pacts -a <version> -h master -g -b $PACT_BROKER_URL -u $PACT_BROKER_USERNAME -p $PACT_BROKER_PASSWORD
    it works fine on my laptop, but it fails during gitlab build:
    Copy code
    PactBroker::Client::Hal::ErrorResponseReturned - Error making request to <url> status=503
    ...
    <title>ERROR: The requested URL could not be retrieved</title>
    ...
    <p id="sysmsg">The system returned: <i>(110) Connection timed out</i></p>
    <p>The remote host or network may be down. Please try the request again.</p>
    also
    Copy code
    mvn pact:publish
    works on gitlub and I can establish connection using telnet from gitlub runner to pact broker what is the difference between maven plugin and cli client and how to fix cli issue?
    b
    • 2
    • 4
  • m

    Mike

    03/15/2022, 2:00 PM
    Is pact-brocker backward compatible? e.g. 2.58 and the latest one 2.94
    b
    • 2
    • 1
  • f

    Fábio Rodrigues

    03/16/2022, 11:09 AM
    Hello there. Is there any reason why pact-broker environment name can only have numbers and letters. For context our prod/test environments ( we have several of them) have geos and so on, so it's usual to have names like <regions>-<type>-<number>
    b
    • 2
    • 5
  • f

    Fábio Rodrigues

    03/16/2022, 1:49 PM
    is there any cli command to check what is registered as deployed in a environment?
    b
    • 2
    • 4
  • j

    João Farias

    03/17/2022, 10:03 AM
    Hi folks, I am trying to follow the bi-directional contracts tutorial, but I am having trouble on Step 10. When I have to comment out the price field, I am getting a 409 - Conflict error at publishing the new OAS contract. Basically what I did was to add a # before each price: string + removing the whole entry on components.schemas.Product.properties. Here is my OAS contract. Am I doing something wrong? You can find my current contract here: https://thatsabug.pactflow.io/contracts/bi-directional/provider/pactflow-example-provid[…]ountebank/version/d1db1c-master%2Bd1db1c/provider-contract
    Copy code
    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:
                    oneOf:
                      - $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
          additionalProperties: false # WARNING! without this, a consumer can add stuff that doesn't exist! See also <https://bitbucket.org/atlassian/swagger-mock-validator/issues/84/test-incorrectly-passes-when-mock-expects>
          properties:
            id:
              type: string
            type:
              type: string
            name:
              type: string
            version:
              type: string
            # price:
              #type: number
    👋 1
    m
    • 2
    • 5
  • a

    Ankit Rawat

    03/20/2022, 7:13 AM
    @Matt (pactflow.io / pact-js / pact-go) this is my understanding of bi-directional testing. Is this correct? 1.) Provider side upload the swagger file to pact broker which is called as provider contract. If the swagger file is generated by code, recommend writing test cases but if it is hand written then recommend to do functional testing using rest assured or some other functional testing tool. 2.) Consumer side we still need to publish the contract as in CDC 3.) Can-i-Deploy step then compares the consumer contract against the swagger file(aka producer file)
    m
    • 2
    • 6
  • d

    Dmitry Munda

    03/22/2022, 3:16 PM
    hi! having this in logs (and some tests started to fail due to timeouts), any ideas ?
    Copy code
    2022-03-22T14:02:01.354538416Z stdout F /pact_broker/vendor/bundle/ruby/2.6.0/gems/sequel-5.49.0/lib/sequel/connection_pool/threaded.rb:264:in `raise_pool_timeout'
    2022-03-22T14:02:01.354486796Z stdout F 2022-03-22 14:02:01.351645 E [8:puma server threadpool 005 logging.rb:48] PactBroker::Errors::ErrorLogger -- Error reference YEkrNbMqTK -- Exception: Sequel::PoolTimeout: timeout: 5.0, elapsed: 5.000220500980504Show context
    b
    • 2
    • 13
  • m

    Mircea Ungureanu

    03/23/2022, 10:59 AM
    Good morning 👋 I have a working pact between an existing consumer and provider. I’m now trying to introduce a second consumer of the same provider/interaction but just different parts of the data. For some reason the pact doesn’t get recognised on the provider side. Could someone please help with this? All the existing pacts get verified fine and tagged appropriately, just this new one is not.
    m
    b
    • 3
    • 4
12345...14Latest