Jenkins
Prerequisites
The following needs to be setup on the Jenkins machine:
- The packages
cmake
,clang
,llvm
,lcov
needs to be installed, e.g.:Install dependenciesapt install cmake clang llvm lcov`.
- For corpus synchronisation with rclone, the package
clone
needs to be installed, e.g.:Install rcloneapt install rclone
- In the Jenkins' project's "Build environment", add the "Secret text"
CIFUZZ_DOWNLOAD_TOKEN
with the value of your download token from downloads.code-intelligence.com.
For more details on what you can do with CI Fuzz and its outputs in your pipeline, check the general CI/CD-Setup page.
Example Workflow
The following Jenkins shell script shows an example of how you can run CI Fuzz in Jenkins.
# Install CI Fuzz. CI Fuzz needs to be installed on the host system or install it during the CI/CD run
sh -c "$(curl -fsSL http://downloads.code-intelligence.com/assets/install-cifuzz.sh)" ${CIFUZZ_DOWNLOAD_TOKEN} 3.15.0
cifuzz --version
# rclone needs to be installed on the host system or install it during the CI/CD run
rclone --version
# Copy corpus from cloud storage
mkdir -p .cifuzz-corpus
rclone copy -v cloud-storage:corpora/PROJECT_NAME .cifuzz-corpus
# Run Fuzz Test(s)
cifuzz run -v --interactive=false || true
# Copy corpus to cloud storage
rclone copy -v .cifuzz-corpus cloud-storage:corpora/PROJECT_NAME
# Calculate coverage
cifuzz coverage --format=html --output coverage_report --plain
cifuzz coverage --format=lcov --output lcov.info --plain
# Findings overview
cifuzz findings --plain > findings.txt
# Fail pipeline if findings are present
cifuzz run -v --interactive=false --regression-only