Jenkins
Docker उपलब्ध होने वाले Linux एजेंट पर इस डिक्लेरेटिव पाइपलाइन का उपयोग करें:
pipeline {
agent any
options {
buildDiscarder(logRotator(daysToKeepStr: '30', artifactDaysToKeepStr: '30'))
}
stages {
stage('Scan for malware') {
steps {
sh '''
mkdir -p amwscan-output
docker run --rm \
--volume "$WORKSPACE:/scan:ro" \
--volume "$WORKSPACE/amwscan-output:/output" \
marcocesarato/php-antimalware-scanner:latest /scan \
--lite --report-only --report-format=sarif \
--path-report=/output/amwscan-report.sarif \
--disable-checksum --disable-definitions-update
'''
}
}
}
post {
always {
archiveArtifacts artifacts: 'amwscan-output/amwscan-report.sarif', allowEmptyArchive: true
}
}
}
वर्कस्पेस को केवल पढ़ने के लिए माउंट किया जाता है। अलग आउटपुट डायरेक्टरी लिखने योग्य रहती है, इसलिए किसी परिणाम के कारण स्कैन स्टेज विफल होने के बाद Jenkins SARIF रिपोर्ट को आर्काइव कर सकता है। पाइपलाइन रिपोर्ट को 30 दिनों तक रखती है।