Vendored
+31
-5
@@ -35,10 +35,20 @@ pipeline {
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Remove stale files') {
|
||||
steps {
|
||||
echo "Remove stale files"
|
||||
sh "rm -f $CHANGED_FILES_FILE"
|
||||
sh "rm -f $TEXT_FILES_FILE"
|
||||
sh "rm -f $SCAN_JSON_FILE"
|
||||
sh "rm -f $REPORT_FILE"
|
||||
}
|
||||
}
|
||||
|
||||
stage('List folder content') {
|
||||
steps {
|
||||
echo "List folder content"
|
||||
sh "ls -l"
|
||||
sh "ls -la"
|
||||
sh "export"
|
||||
}
|
||||
}
|
||||
@@ -46,6 +56,7 @@ pipeline {
|
||||
stage('Change to unix files') {
|
||||
steps {
|
||||
echo "Change to unix files"
|
||||
sh "! which dos2unix || sudo apt-get install -y dos2unix"
|
||||
sh "/bin/dos2unix .workflow/* .workflow/*"
|
||||
sh "/bin/chmod +x .workflow/* .workflow/*"
|
||||
}
|
||||
@@ -86,7 +97,9 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Scan with Ollama') {
|
||||
when { expression { branch 'Security' && fileExists('text_files.txt') && sh(script: "test -s text_files.txt", returnStatus: true) == 0 } }
|
||||
when {
|
||||
branch 'Security'
|
||||
}
|
||||
steps {
|
||||
sh ".workflow/scan_with_ollama.sh \"$TEXT_FILES_FILE\" \"$SCAN_JSON_FILE\" \"$OLLAMA_MODEL\" \"$MAX_FILE_BYTES\" \"$REQUEST_TIMEOUT_SEC\""
|
||||
archiveArtifacts artifacts: "$SCAN_JSON_FILE", allowEmptyArchive: true
|
||||
@@ -94,7 +107,9 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Build Markdown Report') {
|
||||
when { expression { branch 'Security' && fileExists('text_files.txt') && sh(script: "test -s text_files.txt", returnStatus: true) == 0 } }
|
||||
when {
|
||||
branch 'Security'
|
||||
}
|
||||
steps {
|
||||
sh ".workflow/build_markdown_report.sh \"$SCAN_JSON_FILE\" \"$REPORT_FILE\""
|
||||
archiveArtifacts artifacts: "$REPORT_FILE", allowEmptyArchive: true
|
||||
@@ -102,14 +117,18 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Report to Gitea (Issue)') {
|
||||
when { expression { branch 'Security' && fileExists('text_files.txt') && sh(script: "test -s text_files.txt", returnStatus: true) == 0 } }
|
||||
when {
|
||||
branch 'Security'
|
||||
}
|
||||
steps {
|
||||
sh ".workflow/create_gitea_issue.sh \"$REPORT_FILE\""
|
||||
}
|
||||
}
|
||||
|
||||
stage('Quality Gate') {
|
||||
when { expression { branch 'Security' && fileExists('text_files.txt') && sh(script: "test -s text_files.txt", returnStatus: true) == 0 } }
|
||||
when {
|
||||
branch 'Security'
|
||||
}
|
||||
steps {
|
||||
sh ".workflow/evaluate_threshold.sh \"$SCAN_JSON_FILE\" \"$FAIL_ON_MEDIUM_OR_HIGH\""
|
||||
}
|
||||
@@ -128,6 +147,13 @@ pipeline {
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts allowEmptyArchive: true, artifacts: "${CHANGED_FILES_FILE}, ${TEXT_FILES_FILE}, ${SCAN_JSON_FILE}, ${REPORT_FILE}"
|
||||
// Cleanup after build (if success)
|
||||
cleanWs(cleanWhenNotBuilt: false,
|
||||
deleteDirs: true,
|
||||
disableDeferredWipeout: true,
|
||||
notFailBuild: true,
|
||||
patterns: [[pattern: '.gitignore', type: 'INCLUDE'],
|
||||
[pattern: '.propsfile', type: 'EXCLUDE']])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user