mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Jenkins CI pipeline
This commit is contained in:
parent
25221b5271
commit
7bfbe1376b
1 changed files with 67 additions and 0 deletions
67
README.md
67
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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue