From cc73c9b5f2d990fe51d091924983fe4ab5127c8d Mon Sep 17 00:00:00 2001 From: "gulnaramosch@outlook.de" Date: Sat, 1 Aug 2026 08:50:18 +0200 Subject: [PATCH 1/6] DRY: added Stages from shared library --- Jenkinsfile | 127 ++++++++++++++-------------------------------------- 1 file changed, 33 insertions(+), 94 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e6fe484f0..6fe7419d7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,5 @@ +@Library('jenkins-ci-library') _ + pipeline { agent any @@ -13,123 +15,60 @@ pipeline { stages { stage('Clean') { - steps { - withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) { - sh 'mvn clean' - } - } + steps { ciMaven( + goal: "clean") } } stage('Format Check') { - options { - timeout(activity: true, time: 60, unit: 'SECONDS') - } - steps { - withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) { - sh 'mvn spotless:check' - } - } + steps { ciMaven( + goal: "spotless:check", + timeout: 60) } } stage('Build') { - options { - timeout(activity: true, time: 120, unit: 'SECONDS') - } steps { - withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) { - sh 'mvn -DskipTests=true package' - } - } - - post { - success { - archiveArtifacts artifacts: '**/target/*.jar' - } + ciMaven( + goal: "package", + args: "-DskipTests=true", + timeout: 120) } } - stage('Code Analysis') { + stage('Static Analysis & Unit Tests') { when { - anyOf { - branch 'main' - tag 'v*' - changeRequest() - } - } - options { - timeout(activity: true, time: 240, unit: 'SECONDS') - } - steps { - withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) { - // `package` goal is required here to load modules in reactor and avoid dependency resolve conflicts - sh 'mvn -DskipTests=true package pmd:pmd pmd:cpd spotbugs:spotbugs' - } - } - post { - always { - recordIssues enabledForFailure: true, tools: [spotBugs(), cpd(pattern: '**/target/cpd.xml'), pmdParser(pattern: '**/target/pmd.xml')] - } + expression { pipelineUtils.isMainTagOrChangeRequest() } } - } - stage('Unit Tests') { - when { - anyOf { - branch 'main' - tag 'v*' - changeRequest() - } - } - options { - timeout(activity: true, time: 180, unit: 'SECONDS') - } - steps { - withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) { - sh 'mvn -P coverage -Dskip.failsafe.tests=true test' + parallel { + + stage('Code Analysis') { + steps { ciStepStaticAnalysis() } } - } - post { - always { - junit testResults: '**/target/surefire-reports/TEST-*.xml' + + stage('Unit Tests') { + steps { ciUnitTests(profile: "coverage") } + post { + always { + junit testResults: '**/target/surefire-reports/TEST-*.xml', + allowEmptyResults: true + } + } } } } stage('Integration Tests') { when { - anyOf { - branch 'main' - tag 'v*' - changeRequest() - } - } - options { - timeout(activity: true, time: 600, unit: 'SECONDS') + expression { pipelineUtils.isMainTagOrChangeRequest() } } steps { - withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) { - sh 'mvn -P coverage -Dskip.surefire.tests=true verify' - } - } - post { - always { - junit testResults: '**/target/failsafe-reports/TEST-*.xml', allowEmptyResults: true - } - success { - discoverReferenceBuild() - recordCoverage(tools: [[ parser: 'JACOCO' ]], - id: 'jacoco', name: 'JaCoCo Coverage', - sourceCodeRetention: 'LAST_BUILD') - } + ciIntegrationTests(profile: "coverage", timeout: 600) } } stage('Deploy to Internal Nexus Repository') { when { - anyOf { - branch 'main' - tag 'v*' - } + expression { pipelineUtils.shouldDeploy() } } steps { - withMaven(jdk: env.JDK_TOOL_NAME, maven: env.MAVEN_TOOL_NAME) { - // Tests were already executed separately, so disable tests within this step - sh 'mvn -DskipTests=true deploy' - } + ciMaven( + goal: "deploy", + profile: "internal-releases", + args: "-DskipTests=true") } } stage('Make Github Release') { From 3dad79229795fe76dd8fed984671ff804d67f1ba Mon Sep 17 00:00:00 2001 From: "gulnaramosch@outlook.de" Date: Sun, 2 Aug 2026 13:29:10 +0200 Subject: [PATCH 2/6] DRY: use standard pipeline declarativ --- Jenkinsfile | 173 ++++++++++++++++------------------------------------ 1 file changed, 51 insertions(+), 122 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6fe7419d7..b00e1d119 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,137 +1,66 @@ @Library('jenkins-ci-library') _ -pipeline { - agent any +standardPipeline( + buildTimeout: 600, + testTimeout: 900, - environment { - JDK_TOOL_NAME = 'JDK 21' - MAVEN_TOOL_NAME = 'Maven 3.9.9' - } - - options { - skipStagesAfterUnstable() - disableConcurrentBuilds abortPrevious: true - } - - stages { - stage('Clean') { - steps { ciMaven( - goal: "clean") } - } - stage('Format Check') { - steps { ciMaven( - goal: "spotless:check", - timeout: 60) } - } - stage('Build') { - steps { - ciMaven( - goal: "package", - args: "-DskipTests=true", - timeout: 120) - } - } - stage('Static Analysis & Unit Tests') { - when { - expression { pipelineUtils.isMainTagOrChangeRequest() } - } - parallel { - - stage('Code Analysis') { - steps { ciStepStaticAnalysis() } + extraStages: { + stage('Make Github Release') { + when { + tag 'v*' } - - stage('Unit Tests') { - steps { ciUnitTests(profile: "coverage") } - post { - always { - junit testResults: '**/target/surefire-reports/TEST-*.xml', - allowEmptyResults: true - } + steps { + writeFile file: 'release_description.md', text: 'A new version of TLS-Scanner was released. You can download the artifacts (executable .jar) below. \n\n## Changelog:\n - TODO' + sh "zip -r TLS-Scanner-${TAG_NAME}.zip apps" + script { + def draftRelease = createGitHubRelease( + credentialId: '1522a497-e78a-47ee-aac5-70f071fa6714', + repository: GIT_URL.tokenize("/.")[-3, -2].join("/"), + draft: true, + tag: TAG_NAME, + name: TAG_NAME, + bodyFile: 'release_description.md', + commitish: GIT_COMMIT) + uploadGithubReleaseAsset( + credentialId: '1522a497-e78a-47ee-aac5-70f071fa6714', + repository: GIT_URL.tokenize("/.")[-3, -2].join("/"), + tagName: draftRelease.htmlUrl.tokenize("/")[-1], + uploadAssets: [ + [filePath: "TLS-Scanner-${TAG_NAME}.zip"] + ] + ) } } } - } - stage('Integration Tests') { - when { - expression { pipelineUtils.isMainTagOrChangeRequest() } - } - steps { - ciIntegrationTests(profile: "coverage", timeout: 600) - } - } - stage('Deploy to Internal Nexus Repository') { - when { - expression { pipelineUtils.shouldDeploy() } - } - steps { - ciMaven( - goal: "deploy", - profile: "internal-releases", - args: "-DskipTests=true") - } - } - stage('Make Github Release') { - when { - tag 'v*' - } - steps { - writeFile file: 'release_description.md', text: 'A new version of TLS-Scanner was released. You can download the artifacts (executable .jar) below. \n\n## Changelog:\n - TODO' - sh "zip -r TLS-Scanner-${TAG_NAME}.zip apps" - script { - def draftRelease = createGitHubRelease( - credentialId: '1522a497-e78a-47ee-aac5-70f071fa6714', - repository: GIT_URL.tokenize("/.")[-3,-2].join("/"), - draft: true, - tag: TAG_NAME, - name: TAG_NAME, - bodyFile: 'release_description.md', - commitish: GIT_COMMIT) - uploadGithubReleaseAsset( - credentialId: '1522a497-e78a-47ee-aac5-70f071fa6714', - repository: GIT_URL.tokenize("/.")[-3,-2].join("/"), - tagName: draftRelease.htmlUrl.tokenize("/")[-1], - uploadAssets: [ - [filePath: "TLS-Scanner-${TAG_NAME}.zip"] - ] - ) + stage('Public Docker Images') { + when { + tag 'v*' + environment name: 'GIT_URL', value: 'https://github.com/tls-attacker/TLS-Scanner.git' } - } - } - stage('Public Docker Images') { - when { - tag 'v*' - environment name: 'GIT_URL', value: 'https://github.com/tls-attacker/TLS-Scanner.git' - } - steps { - script { - docker.withRegistry('https://ghcr.io','github-docker-token') { - def image = docker.build("ghcr.io/tls-attacker/tlsscanner:${TAG_NAME}", "-f Dockerfile_Jenkins .") - image.push() - image.push('latest') + steps { + script { + docker.withRegistry('https://ghcr.io', 'github-docker-token') { + def image = docker.build("ghcr.io/tls-attacker/tlsscanner:${TAG_NAME}", "-f Dockerfile_Jenkins .") + image.push() + image.push('latest') + } } } } - } - stage('Internal Docker Images') { - when { - tag 'v*' - environment name: 'GIT_URL', value: 'https://github.com/tls-attacker/TLS-Scanner-Development.git' - } - steps { - script { - docker.withRegistry('https://hydrogen.cloud.nds.rub.de','Jenkins-User-Nexus-Repository') { - def image = docker.build("hydrogen.cloud.nds.rub.de/tls-attacker/tlsscanner:${TAG_NAME}", "-f Dockerfile_Jenkins .") - image.push() - image.push('latest') - } + stage('Internal Docker Images') { + when { + tag 'v*' + environment name: 'GIT_URL', value: 'https://github.com/tls-attacker/TLS-Scanner-Development.git' + } + steps { + script { + docker.withRegistry('https://hydrogen.cloud.nds.rub.de', 'Jenkins-User-Nexus-Repository') { + def image = docker.build("hydrogen.cloud.nds.rub.de/tls-attacker/tlsscanner:${TAG_NAME}", "-f Dockerfile_Jenkins .") + image.push() + image.push('latest') } } } - } - post { - always { - recordIssues enabledForFailure: true, tools: [mavenConsole(), java(), javaDoc()] + } } - } -} +) \ No newline at end of file From 4f2519ef484d33c59c1fcc480b841dbb23a21932 Mon Sep 17 00:00:00 2001 From: "gulnaramosch@outlook.de" Date: Sun, 2 Aug 2026 14:49:01 +0200 Subject: [PATCH 3/6] DRY: use standard pipeline declarativ --- Jenkinsfile | 59 ++--------------------------------------------------- 1 file changed, 2 insertions(+), 57 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b00e1d119..df6de473a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,62 +5,7 @@ standardPipeline( testTimeout: 900, extraStages: { - stage('Make Github Release') { - when { - tag 'v*' - } - steps { - writeFile file: 'release_description.md', text: 'A new version of TLS-Scanner was released. You can download the artifacts (executable .jar) below. \n\n## Changelog:\n - TODO' - sh "zip -r TLS-Scanner-${TAG_NAME}.zip apps" - script { - def draftRelease = createGitHubRelease( - credentialId: '1522a497-e78a-47ee-aac5-70f071fa6714', - repository: GIT_URL.tokenize("/.")[-3, -2].join("/"), - draft: true, - tag: TAG_NAME, - name: TAG_NAME, - bodyFile: 'release_description.md', - commitish: GIT_COMMIT) - uploadGithubReleaseAsset( - credentialId: '1522a497-e78a-47ee-aac5-70f071fa6714', - repository: GIT_URL.tokenize("/.")[-3, -2].join("/"), - tagName: draftRelease.htmlUrl.tokenize("/")[-1], - uploadAssets: [ - [filePath: "TLS-Scanner-${TAG_NAME}.zip"] - ] - ) - } - } - } - stage('Public Docker Images') { - when { - tag 'v*' - environment name: 'GIT_URL', value: 'https://github.com/tls-attacker/TLS-Scanner.git' - } - steps { - script { - docker.withRegistry('https://ghcr.io', 'github-docker-token') { - def image = docker.build("ghcr.io/tls-attacker/tlsscanner:${TAG_NAME}", "-f Dockerfile_Jenkins .") - image.push() - image.push('latest') - } - } - } - } - stage('Internal Docker Images') { - when { - tag 'v*' - environment name: 'GIT_URL', value: 'https://github.com/tls-attacker/TLS-Scanner-Development.git' - } - steps { - script { - docker.withRegistry('https://hydrogen.cloud.nds.rub.de', 'Jenkins-User-Nexus-Repository') { - def image = docker.build("hydrogen.cloud.nds.rub.de/tls-attacker/tlsscanner:${TAG_NAME}", "-f Dockerfile_Jenkins .") - image.push() - image.push('latest') - } - } - } - } + gitHubRelease() + dockerBuild() } ) \ No newline at end of file From 3736113a4842619963414b7e58ad58800da781b3 Mon Sep 17 00:00:00 2001 From: "gulnaramosch@outlook.de" Date: Sun, 2 Aug 2026 19:24:27 +0200 Subject: [PATCH 4/6] DRY: use standard pipeline declarativ --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index df6de473a..c5311fbf4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,9 @@ standardPipeline( testTimeout: 900, extraStages: { - gitHubRelease() + gitHubRelease( + nameApp: 'TLS-Scanner' + ) dockerBuild() } ) \ No newline at end of file From 6fb98f3551fe9875e4ff8f4e93824fcf7cb561c5 Mon Sep 17 00:00:00 2001 From: "gulnaramosch@outlook.de" Date: Sun, 2 Aug 2026 19:33:13 +0200 Subject: [PATCH 5/6] DRY: use standard pipeline declarativ --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c5311fbf4..e328890ad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,9 @@ standardPipeline( gitHubRelease( nameApp: 'TLS-Scanner' ) - dockerBuild() + dockerBuild( + nameApp: 'tlsscanner', + dockerfile: 'Dockerfile_Jenkins' + ) } ) \ No newline at end of file From e4a3d5a1eaf1461eabf4b31612a563bd94a64cfd Mon Sep 17 00:00:00 2001 From: "gulnaramosch@outlook.de" Date: Sun, 2 Aug 2026 20:14:07 +0200 Subject: [PATCH 6/6] DRY: use standard pipeline declarativ --- Jenkinsfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e328890ad..47bb9a349 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,13 @@ @Library('jenkins-ci-library') _ standardPipeline( - buildTimeout: 600, - testTimeout: 900, + jdkTool: 'JDK 21', + mavenTool: 'Maven 3.9.9', + spotlessTimeout: 60, + buildTimeout: 120, + intTestTimeout: 600, + codeAnalyseTimeout: 240, + uniTestTimeout: 180, extraStages: { gitHubRelease(