Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ pipeline {
agent any

environment {
JDK_TOOL_NAME = 'JDK 11'
MAVEN_TOOL_NAME = 'Maven 3.8.6'
JDK_TOOL_NAME = 'JDK 21'
MAVEN_TOOL_NAME = 'Maven 3.9.9'
}

options {
Expand Down Expand Up @@ -48,7 +48,7 @@ pipeline {
stage('Code Analysis') {
when {
anyOf {
branch 'master'
branch 'main'
tag 'v*'
changeRequest()
}
Expand All @@ -58,7 +58,7 @@ pipeline {
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
sh 'mvn pmd:pmd pmd:cpd spotbugs:spotbugs'
sh 'mvn -DskipTests=true package pmd:pmd pmd:cpd spotbugs:spotbugs'
}
}
post {
Expand All @@ -70,7 +70,7 @@ pipeline {
stage('Unit Tests') {
when {
anyOf {
branch 'master'
branch 'main'
tag 'v*'
changeRequest()
}
Expand All @@ -92,13 +92,13 @@ pipeline {
stage('Integration Tests') {
when {
anyOf {
branch 'master'
branch 'main'
tag 'v*'
changeRequest()
}
}
options {
timeout(activity: true, time: 120, unit: 'SECONDS')
timeout(activity: true, time: 1800, unit: 'SECONDS')
}
steps {
withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) {
Expand All @@ -110,14 +110,17 @@ pipeline {
junit testResults: '**/target/failsafe-reports/TEST-*.xml', allowEmptyResults: true
}
success {
publishCoverage adapters: [jacoco(mergeToOneReport: true, path: '**/target/site/jacoco/jacoco.xml')]
discoverReferenceBuild()
recordCoverage(tools: [[ parser: 'JACOCO' ]],
id: 'jacoco', name: 'JaCoCo Coverage',
sourceCodeRetention: 'LAST_BUILD')
}
}
}
stage('Deploy Jar to Internal Nexus Repository') {
when {
anyOf {
branch 'master'
branch 'main'
tag 'v*'
}
}
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>de.rub.nds</groupId>
<artifactId>protocol-toolkit-bom</artifactId>
<version>4.4.0</version>
<version>5.2.0</version>
</parent>

<artifactId>crawler-core</artifactId>
Expand Down Expand Up @@ -80,8 +80,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<!-- The following variables are required for Jenkins CI -->
<skipTests>false</skipTests>
<skip.surefire.tests>${skipTests}</skip.surefire.tests>
Expand Down Expand Up @@ -222,11 +222,11 @@
<spacesPerTab>4</spacesPerTab>
</indent>
<googleJavaFormat>
<version>1.15.0</version>
<version>1.25.2</version>
<style>AOSP</style>
</googleJavaFormat>
<licenseHeader>
<file>${project.basedir}/license_header_plain.txt</file>
<file>${basedir}/license_header_plain.txt</file>
</licenseHeader>
</java>
</configuration>
Expand Down
26 changes: 18 additions & 8 deletions src/main/java/de/rub/nds/crawler/core/jobs/PublishBulkScanJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,22 @@ public void execute(JobExecutionContext context) throws JobExecutionException {
long submittedJobs = parsedJobStatuses.getOrDefault(JobStatus.TO_BE_EXECUTED, 0L);
long unresolvedJobs = parsedJobStatuses.getOrDefault(JobStatus.UNRESOLVABLE, 0L);
long denylistedJobs = parsedJobStatuses.getOrDefault(JobStatus.DENYLISTED, 0L);
long resolutionErrorJobs = parsedJobStatuses.getOrDefault(JobStatus.RESOLUTION_ERROR, 0L);
long resolutionErrorJobs =
parsedJobStatuses.getOrDefault(JobStatus.RESOLUTION_ERROR, 0L);
bulkScan.setScanJobsPublished(submittedJobs);
bulkScan.setScanJobsResolutionErrors(unresolvedJobs+resolutionErrorJobs);
bulkScan.setScanJobsResolutionErrors(unresolvedJobs + resolutionErrorJobs);
bulkScan.setScanJobsDenylisted(denylistedJobs);
persistenceProvider.updateBulkScan(bulkScan);

if (controllerConfig.isMonitored() && submittedJobs == 0) {
progressMonitor.stopMonitoringAndFinalizeBulkScan(bulkScan.get_id());
}
LOGGER.info("Submitted {} scan jobs to RabbitMq (Not submitted: {} Unresolvable, {} Denylisted, {} unhandled Error)", submittedJobs,unresolvedJobs, denylistedJobs, resolutionErrorJobs);
LOGGER.info(
"Submitted {} scan jobs to RabbitMq (Not submitted: {} Unresolvable, {} Denylisted, {} unhandled Error)",
submittedJobs,
unresolvedJobs,
denylistedJobs,
resolutionErrorJobs);
} catch (Exception e) {
LOGGER.error("Exception while publishing BulkScan: ", e);
JobExecutionException e2 = new JobExecutionException(e);
Expand Down Expand Up @@ -124,17 +130,21 @@ public JobStatus apply(String targetString) {
var targetInfo =
ScanTarget.fromTargetString(targetString, defaultPort, denylistProvider);
jobDescription =
new ScanJobDescription(targetInfo.getLeft(), bulkScan, targetInfo.getRight());
}catch (Exception e){
jobDescription = new ScanJobDescription(new ScanTarget(), bulkScan, JobStatus.RESOLUTION_ERROR);
new ScanJobDescription(
targetInfo.getLeft(), bulkScan, targetInfo.getRight());
} catch (Exception e) {
jobDescription =
new ScanJobDescription(
new ScanTarget(), bulkScan, JobStatus.RESOLUTION_ERROR);
errorResult = ScanResult.fromException(jobDescription, e);
LOGGER.error("Error while creating ScanJobDescription for target '{}'", targetString, e);
LOGGER.error(
"Error while creating ScanJobDescription for target '{}'", targetString, e);
}

if (jobDescription.getStatus() == JobStatus.TO_BE_EXECUTED) {
orchestrationProvider.submitScanJob(jobDescription);
} else {
if(errorResult == null){
if (errorResult == null) {
errorResult = new ScanResult(jobDescription, null);
}
persistenceProvider.insertScanResult(errorResult, jobDescription);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ public List<String> getTargetList() {
List<String> targetList;
try (Stream<String> lines = Files.lines(Paths.get(filename))) {
// remove comments and empty lines
targetList = lines.filter(line -> !(line.startsWith("#") || line.isEmpty()))
.collect(Collectors.toList());
targetList =
lines.filter(line -> !(line.startsWith("#") || line.isEmpty()))
.collect(Collectors.toList());
} catch (IOException ex) {
throw new RuntimeException("Could not load " + filename, ex);
}
Expand Down