Pin the CLI version in CI and upgrade on purpose

npx @requestarium/cli runs whatever version is newest at that moment. That's fine on your laptop. In CI it means a release can change your pipeline between two pushes with nobody touching it. Pin the version and upgrade when you choose.

Why pin

A new CLI version can:

  • add a column to the JSON report that a script parses,
  • change how a value is printed in the JUnit file,
  • start enforcing a limit or a check that was missing before.

None of these break the API you test. They break the pipeline around it, at a random moment, and someone loses an hour finding out that "nothing changed" isn't true. With a pinned version, the same commit always runs the same CLI.

How to pin, wherever you run it

Plain command line:

Terminal
npx --yes @requestarium/[email protected] run-collection "Users API" --env Staging

GitHub Action:

YAML
      - uses: ./.github/actions/requestarium-run
        with:
          token: ${{ secrets.REQUESTARIUM_TOKEN }}
          suite: Smoke
          cli-version: 0.7.0

GitLab template:

YAML
include:
  - local: ci/requestarium-run.yml
    inputs:
      suite: Smoke
      cli-version: 0.7.0

Docker image:

DOCKERFILE
RUN npm install -g @requestarium/[email protected]

A Node.js project: add it as a dev dependency and let the lockfile pin it:

Terminal
npm install --save-dev --save-exact @requestarium/[email protected]
package.json
{
  "scripts": {
    "test:api": "requestarium run-collection \"Users API\" --env Staging --junit results.xml"
  }
}

In CI, npm ci && npm run test:api. Every developer and every pipeline now runs the same version, and Renovate or Dependabot can propose upgrades.

Check what's running

Terminal
requestarium --version
requestarium update        # is there a newer one, and how to install it

The CLI prints a "newer version available" notice only at a terminal, never in CI, so a pinned pipeline stays quiet.

Upgrade on purpose

A routine that takes five minutes:

  1. Read the CLI section of the changelog between your version and the new one.
  2. Change the version in one place, in a PR of its own.
  3. Let the pipeline run. If reports or scripts depend on output formats, look at one report.
  4. Merge. If something breaks later, reverting that one PR puts the old version back.

Don't let the pinned version get years old, though: newer versions fix bugs and add things like cookie jars, retries and secret managers. Once a month or once a quarter is a fine rhythm.

What doesn't need pinning

The collections themselves live in Requestarium, not in the CLI. Pinning the CLI doesn't freeze your requests or tests: a test added in the app runs in the next pipeline. If you want the test definitions versioned with your code too, use Git sync.