Run a flow in CI/CD

View as Markdown

You can generate a Postman CLI command from an open flow and add it to your CI/CD pipeline to run local and deployed flows. You can include collections and an environment in the same configuration to run them alongside the flow.

Cloud runs vs. local runs

The generated Postman CLI configuration runs the flow in one of two ways, depending on whether you select Run locally:

  • Run locally not selected (default) — The command uses postman flows trigger to run a deployed flow in the Postman cloud. The flow must be deployed before you generate the configuration.
  • Run locally selected — The command uses postman flows run to run the flow’s local files directly on your machine. The flow’s local files must be accessible to the CI/CD runner, typically by including them in the same repo as your build configuration. You can use this option if the flow calls private APIs that aren’t reachable from the Postman cloud. To create a flow’s local files, use Local View in the Postman desktop app. This option is available with Postman Enterprise plans.

Generate the Postman CLI configuration

To generate the Postman CLI configuration for a flow, do the following:

  1. Open the flow you want to run in your CI/CD pipeline.

  2. In the upper right, click Options icon More options and select Run in CI. The Generate Postman CLI Configuration page opens with the current flow already selected under Flows.

  3. (Optional) Under Choose the items you want to run, do any of the following:

    • Select a Collection to run during pipeline builds, and select an Environment to use. Click Add icon Add Another Collection to include multiple collections.
    • Under Flows, click Add icon Add Another Flow to include additional flows.
  4. (Optional) To run the flow’s local files on your CI/CD machine instead of triggering the deployed flow in the Postman cloud, select Run locally. See Cloud runs vs. local runs for the differences between the two modes.

  5. Under CI/CD configuration, select a CI/CD Provider and an Operating system for CI/CD.

  6. Review the generated command under Postman CLI command preview.

  7. Click Copy Postman CLI Command to copy the command to your clipboard.

  8. Paste the command into your build configuration file. This process depends on your CI tool.

To learn more about the underlying commands and their options, see postman flows trigger and postman flows run. To learn more about running other Postman elements in CI/CD, see Run tests in CI/CD pipelines.