Pulse Beta

User guide

How-to guide

Jenkins

Scan each build of a Jenkins pipeline, and fail a pull request build only on the findings that it adds.

Before you start #

Add the stage #

Add the token under Manage Jenkins › Credentials as Secret text, with the ID tuxcarectl-portal-token. Then add a stage to the Jenkinsfile:

stage('tuxcarectl') {
  environment {
    TUXCARE_PORTAL_TOKEN = credentials('tuxcarectl-portal-token')
  }
  steps {
    sh '''
      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
    '''
  }
}

Fail a pull request only on new findings #

compare --fail-on-new fails a pull request build only on the findings that it adds. The base branch needs a scan of its own, so scan it on each build. See Pull and merge requests.

In a multibranch pipeline, CHANGE_TARGET is set for a pull request build.

sh '''
  npm ci              # the install step of your project
  curl -fsSL https://securechain.tuxcare.com/get/tuxcarectl | sh
  export PATH="$HOME/.local/bin:$PATH"
  if [ -n "$CHANGE_TARGET" ]; then
    tuxcarectl compare --base "$CHANGE_TARGET" --fail-on-new
  else
    tuxcarectl sca --fail-on high
  fi
'''

More #

Next: Other CI