diff --git a/README.md b/README.md index 29c6510..9767b6c 100644 --- a/README.md +++ b/README.md @@ -237,6 +237,7 @@ iex "& { $(iwr 'https://github.com/AikidoSec/safe-chain/releases/latest/download - ✅ **GitHub Actions** - ✅ **Azure Pipelines** - ✅ **CircleCI** +- ✅ **Jenkins** ## GitHub Actions Example @@ -288,4 +289,70 @@ workflows: - build ``` +## Jenkins Example + +```groovy +pipeline { + agent any + + environment { + // Jenkins does not automatically persist PATH updates from setup-ci, + // so add the shims + binary directory explicitly for all stages. + PATH = "${env.HOME}/.safe-chain/shims:${env.HOME}/.safe-chain/bin:${env.PATH}" + } + + stages { + stage('Install Node.js') { + steps { + sh ''' + set -euo pipefail + + # install Node.js + npm (requires root, or passwordless sudo on the agent) + sudo -n apt-get update + sudo -n apt-get install -y nodejs npm + + node -v + npm -v + ''' + } + } + + stage('Install safe-chain') { + steps { + sh ''' + set -euo pipefail + + # Install Safe Chain for CI + curl -fsSL https://github.com/AikidoSec/safe-chain/releases/latest/download/install-safe-chain.sh | sh -s -- --ci + ''' + } + } + + stage('Verify safe-chain on PATH') { + steps { + sh ''' + set -euo pipefail + + command -v safe-chain + command -v npm + + # Test: npm should resolve to the safe-chain shim + test "$(command -v npm)" = "$HOME/.safe-chain/shims/npm" + ''' + } + } + + stage('Install project dependencies etc...') { + steps { + sh ''' + set -euo pipefail + npm ci + ''' + } + } + } +} +``` + + After setup, all subsequent package manager commands in your CI pipeline will automatically be protected by Aikido Safe Chain's malware detection.