Pulse Beta

User guide

How-to guide

Other CI systems

Add the scan to Bitbucket Pipelines, Azure Pipelines, CircleCI, or any other CI system that runs a shell.

How the job works #

A scan from each build keeps the portal current. The job installs the CLI, reads a token from a secret variable, scans, and fails when a high or critical finding is open.

Before the install step, the job also keeps malicious packages out (CLI 0.1.94 or later). tuxcarectl guard check fails the job when the lockfile locks a known malicious version. tuxcarectl guard setup --ci puts the guard in front of the package managers, so the npm ci of the next step runs as tuxcarectl guard npm ci. Outside GitHub Actions, keep the guard lines and the install in one shell of the job, as in the examples: a later step or job does not get the guard. On a Windows runner, run each tool as tuxcarectl guard <tool>. See Malicious packages.

Run the scan after the install step of the project: see what the job needs before the scan.

The page Set up CI of your workspace (+ Add › Set up CI, or a button of Repositories) does steps 1 to 3 for one repository: it mints the token and shows the job for your CI system, with buttons that copy them. To find the repository, type a part of its name in the Repository box: the list shows only the repositories that match.

Keep the token as a secret #

Make a token for the pipeline (see Make a token for the pipeline). Store it in the secret store of your CI system with the name TUXCARE_PORTAL_TOKEN. The CLI reads it from that variable and writes it nowhere. The steps for each system follow. On GitHub Actions and GitLab CI, a job can sign in with no stored token: see CI sign-in.

Bitbucket Pipelines #

Add the token under Repository settings › Pipelines › Repository variables. Select Secured, then Add. Then add bitbucket-pipelines.yml:

image: node:22          # the image that builds your project
pipelines:
  default:
    - step:
        name: tuxcarectl
        script:
          - curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
          - tuxcarectl guard check
          - guard_path="$(tuxcarectl guard setup --ci)"
          - eval "$guard_path"
          - npm ci              # the install step of your project, through the guard
          - tuxcarectl sca --fail-on high

Bitbucket gives no secured variable to a pull request from a fork.

Azure Pipelines #

Add the token under Pipelines › your pipeline › Edit › Variables › New variable, and select Keep this value secret. Then add azure-pipelines.yml:

trigger:
  - main
pool:
  vmImage: ubuntu-latest
steps:
  - script: |
      set -e
      curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
      export PATH="$HOME/.local/bin:$PATH"
      tuxcarectl guard check
      guard_path="$(tuxcarectl guard setup --ci)"
      eval "$guard_path"
      npm ci              # the install step of your project, through the guard
      tuxcarectl sca --fail-on high
    displayName: tuxcarectl
    env:
      TUXCARE_PORTAL_TOKEN: $(TUXCARE_PORTAL_TOKEN)

Azure Pipelines gives a secret variable to a step only through env, as in the job. Keep the install in this step: a later step does not get the guard.

CircleCI #

Add the token under Project Settings › Environment Variables › Add Environment Variable. Then add .circleci/config.yml:

version: 2.1
jobs:
  tuxcarectl:
    docker:
      - image: cimg/node:lts   # the image that builds your project
    steps:
      - checkout
      - run:
          name: tuxcarectl
          command: |
            curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
            export PATH="$HOME/.local/bin:$PATH"
            tuxcarectl guard check
            guard_path="$(tuxcarectl guard setup --ci)"
            eval "$guard_path"
            npm ci              # the install step of your project, through the guard
            tuxcarectl sca --fail-on high
workflows:
  tuxcarectl:
    jobs:
      - tuxcarectl

CircleCI gives no environment variable to a pull request from a fork. Keep the install in this run step: a later step does not get the guard.

Any other CI system #

Set TUXCARE_PORTAL_TOKEN from the secret store. Then run these commands in one shell of the job, after the checkout. set -e stops the job at the first command that fails:

set -e
curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
export PATH="$HOME/.local/bin:$PATH"
tuxcarectl guard check
guard_path="$(tuxcarectl guard setup --ci)"
eval "$guard_path"
npm ci              # the install step of your project, through the guard
tuxcarectl sca --fail-on high

When the portal does not answer, the guard stops the job by default only in a CI run: the CLI reads CI=true and the variables of the common CI systems. Elsewhere it warns, and the install goes on with no filter. If your CI system does not set CI=true, add export CI=true before the guard lines. See When the portal does not answer.

The CLI reads the repository, the branch, and the commit from the variables of GitHub, GitLab, Azure Pipelines, Jenkins, CircleCI, and Bitbucket Pipelines (the last two: CLI 0.1.46 or later), else from git. On Windows, install the CLI with npm or pipx.

Name the job and its file tuxcarectl, as in the examples. The name then tells the people who read the pipeline what the job does.

Next: Gates and pull requests