Jenkins
Utilisez ce pipeline déclaratif sur un agent Linux disposant de Docker :
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
}
}
}
L'espace de travail est monté en lecture seule. Le répertoire de sortie distinct reste accessible en écriture afin que Jenkins puisse archiver le rapport SARIF après qu'un résultat a fait échouer l'étape d'analyse. Le pipeline conserve les rapports pendant 30 jours.