From 8a9d620ca1eccc6f3e06848d5a0a4ba38685e159 Mon Sep 17 00:00:00 2001 From: mrcz88 <42491063+mrcz88@users.noreply.github.com> Date: Wed, 17 Jun 2026 14:56:04 +0200 Subject: [PATCH 01/24] commit di esempio --- ee | 1 + 1 file changed, 1 insertion(+) create mode 100644 ee diff --git a/ee b/ee new file mode 100644 index 0000000..02dc432 --- /dev/null +++ b/ee @@ -0,0 +1 @@ +eeee From 9c5e9bc44b2ffe22c8593ae66ae098b7bd2bb543 Mon Sep 17 00:00:00 2001 From: mrcz88 <42491063+mrcz88@users.noreply.github.com> Date: Wed, 17 Jun 2026 15:29:38 +0200 Subject: [PATCH 02/24] Create Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1 @@ + From 0ba842a4e115e9726e3a6396f469e6dad5c13d60 Mon Sep 17 00:00:00 2001 From: mrcz88 <42491063+mrcz88@users.noreply.github.com> Date: Wed, 17 Jun 2026 16:43:51 +0200 Subject: [PATCH 03/24] Add Jenkins pipeline content --- Jenkinsfile | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8b13789..bc76d08 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1 +1,28 @@ - +pipeline { + agent any + stages { + stage("one"){ + steps{ + echo 'step 1' + sleep 3 + } + } + stage("two"){ + steps{ + echo 'step 2' + sleep 9 + } + } + stage("three"){ + steps{ + echo 'step 3' + sleep 5 + } + } + } + post { + always { + echo 'This pipeline is completed..' + } + } +} From 8565e10a1b9234c3f48034da8dbf3a8dd7fef8a7 Mon Sep 17 00:00:00 2001 From: mrcz88 <42491063+mrcz88@users.noreply.github.com> Date: Wed, 17 Jun 2026 16:52:05 +0200 Subject: [PATCH 04/24] compile in jenkinfile --- Jenkinsfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bc76d08..486b4a2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,13 @@ pipeline { agent any + tools{ + maven 'Maven 3.9.6' + } stages { - stage("one"){ + stage("build"){ steps{ - echo 'step 1' - sleep 3 + echo 'Compiling sysfoo app' + sh 'mvn compile' } } stage("two"){ From 4019964eabb93a24f97dcfce4b41a813418cdb58 Mon Sep 17 00:00:00 2001 From: mrcz88 <42491063+mrcz88@users.noreply.github.com> Date: Fri, 26 Jun 2026 06:18:54 +0200 Subject: [PATCH 05/24] Create ciao --- ciao | 1 + 1 file changed, 1 insertion(+) create mode 100644 ciao diff --git a/ciao b/ciao new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/ciao @@ -0,0 +1 @@ + From 703d4f6b100c35bdfe0178f235fec6c073c5b67d Mon Sep 17 00:00:00 2001 From: mrcz88 <42491063+mrcz88@users.noreply.github.com> Date: Fri, 26 Jun 2026 06:27:52 +0200 Subject: [PATCH 06/24] Create qq --- qq | 1 + 1 file changed, 1 insertion(+) create mode 100644 qq diff --git a/qq b/qq new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/qq @@ -0,0 +1 @@ + From a312f69e92ecf2710326b98c8a6f11b2b6e8df72 Mon Sep 17 00:00:00 2001 From: mrcz88 <42491063+mrcz88@users.noreply.github.com> Date: Fri, 26 Jun 2026 06:48:27 +0200 Subject: [PATCH 07/24] Create GG --- GG | 1 + 1 file changed, 1 insertion(+) create mode 100644 GG diff --git a/GG b/GG new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/GG @@ -0,0 +1 @@ + From daa5cccde11db6a969059b019ae4f602726930eb Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 06:49:41 +0200 Subject: [PATCH 08/24] add yy --- yy | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 yy diff --git a/yy b/yy new file mode 100644 index 0000000..e69de29 From 99c552c46b9351a5fecf25c46cfc6a86f6bf04bd Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 06:52:47 +0200 Subject: [PATCH 09/24] add dd --- dd | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 dd diff --git a/dd b/dd new file mode 100644 index 0000000..e69de29 From 65bb53545e06db254126e3befb3e12448eb09c7c Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 06:59:00 +0200 Subject: [PATCH 10/24] add tt --- tt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tt diff --git a/tt b/tt new file mode 100644 index 0000000..e69de29 From ad483ad97fbfa7b101482b0096fe8a2edb8aa739 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 07:28:07 +0200 Subject: [PATCH 11/24] add ghgh --- ghgh | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ghgh diff --git a/ghgh b/ghgh new file mode 100644 index 0000000..e69de29 From c10f7b9aeb1bdac7727b609d468e34e79a718c01 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 07:29:33 +0200 Subject: [PATCH 12/24] add tyty --- tyty | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tyty diff --git a/tyty b/tyty new file mode 100644 index 0000000..e69de29 From 2e3688b34e51a78b91d29fcc6d1917a95dbfe2ee Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 07:34:48 +0200 Subject: [PATCH 13/24] add rrr --- rrr | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 rrr diff --git a/rrr b/rrr new file mode 100644 index 0000000..e69de29 From 3c85fcb4b5948f613d766eab5a1acaa5e5bd2b1f Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 08:12:10 +0200 Subject: [PATCH 14/24] add dds --- dds | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 dds diff --git a/dds b/dds new file mode 100644 index 0000000..e69de29 From e98b361b51f19319a48d103fe143ea3d9c5896af Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 08:12:38 +0200 Subject: [PATCH 15/24] nuovo file --- Jenkinsfile | 122 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 94 insertions(+), 28 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 486b4a2..de26e9e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,31 +1,97 @@ pipeline { - agent any - tools{ - maven 'Maven 3.9.6' - } - stages { - stage("build"){ - steps{ - echo 'Compiling sysfoo app' - sh 'mvn compile' + agent { label 'docker' } + + options { + // Aggiunge il timestamp alle righe della console output della pipeline + timestamps() + // Tutta la pipeline ha un timeout di 30 minuti + timeout(time: 30, unit: 'MINUTES') + disableConcurrentBuilds() + } + + environment { + IMAGE_NAME = 'registry.example.com/sysfoo' + } + + parameters { + booleanParam( + name: 'SKIP_TESTS', + defaultValue: false, + description: 'Skip unit tests' + ) + } + + stages { + stage('Checkout') { + steps { + checkout scm + } + } + + stage('Build') { + steps { + sh 'mvn clean package -DskipTests' + } + } + + stage('Test') { + when { + expression { return !params.SKIP_TESTS } + } + steps { + timeout(time: 5, unit: 'MINUTES') { + retry(2) { + sh 'mvn test' + } + } + } + post { + always { + // Prova a pubblicare i report JUnit + junit 'target/surefire-reports/*.xml' + } + } + } + + stage('Build Docker Image') { + steps { + sh 'docker build -t $IMAGE_NAME:$BUILD_NUMBER .' + } + } + + stage('Push Image') { + steps { + withCredentials([usernamePassword( + credentialsId: 'docker-registry-creds', + usernameVariable: 'USER', + passwordVariable: 'PASS' + )]) { + sh ''' + echo "$PASS" | docker login registry.example.com -u "$USER" --password-stdin + docker push $IMAGE_NAME:$BUILD_NUMBER + ''' + } + } + } + + stage('Deploy') { + steps { + // Aggiorna il deployment Kubernetes con la nuova immagine e il relativo build number. + // Kubernetes esegue poi il rollout; lo stato si verifica con: kubectl rollout status + sh 'kubectl set image deployment/sysfoo sysfoo=$IMAGE_NAME:$BUILD_NUMBER' + } + } + } + + post { + success { + echo 'Pipeline completata' + } + failure { + echo 'Pipeline fallita' + } + always { + cleanWs() + } } - } - stage("two"){ - steps{ - echo 'step 2' - sleep 9 - } - } - stage("three"){ - steps{ - echo 'step 3' - sleep 5 - } - } - } - post { - always { - echo 'This pipeline is completed..' - } - } } From 101270b234837c01ce68d76294f071e0a0065d72 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 08:53:11 +0200 Subject: [PATCH 16/24] creo dockerfile --- Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ab64204 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM eclipse-temurin:17-jre-alpine + +WORKDIR /app + +RUN addgroup -S spring && adduser -S spring -G spring +USER spring:spring + +COPY target/sysfoo-*.jar app.jar + +EXPOSE 8080 + +ENTRYPOINT ["java", "-jar", "app.jar"] From 1ce2eef6beb81d800d8f79ab0f9907bc60816195 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 08:53:24 +0200 Subject: [PATCH 17/24] jenkinfile: utilizzo dockerhub --- Jenkinsfile | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index de26e9e..787579b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,33 +4,39 @@ pipeline { options { // Aggiunge il timestamp alle righe della console output della pipeline timestamps() - // Tutta la pipeline ha un timeout di 30 minuti + /* Tutta la pipeline ha un timeout di 30 minuti */ timeout(time: 30, unit: 'MINUTES') disableConcurrentBuilds() } - environment { - IMAGE_NAME = 'registry.example.com/sysfoo' - } - parameters { booleanParam( name: 'SKIP_TESTS', defaultValue: false, description: 'Skip unit tests' ) + string( + name: 'DOCKERHUB_USER', + defaultValue: 'your-dockerhub-username', + description: 'Username Docker Hub (es. mariorossi → mariorossi/sysfoo)' + ) + } + + environment { + IMAGE_NAME = "${params.DOCKERHUB_USER}/sysfoo" } stages { stage('Checkout') { steps { - checkout scm + checkout scm // Checkout the source code from the repository } } stage('Build') { steps { - sh 'mvn clean package -DskipTests' + // Solo compilazione: fallisce in fretta su errori di sintassi + sh 'mvn clean compile -DskipTests' } } @@ -53,6 +59,13 @@ pipeline { } } + stage('Package') { + steps { + // Crea il JAR solo dopo i test (o subito se SKIP_TESTS è attivo) + sh 'mvn package -DskipTests' + } + } + stage('Build Docker Image') { steps { sh 'docker build -t $IMAGE_NAME:$BUILD_NUMBER .' @@ -67,7 +80,8 @@ pipeline { passwordVariable: 'PASS' )]) { sh ''' - echo "$PASS" | docker login registry.example.com -u "$USER" --password-stdin + # echo "$PASS" | docker login registry.example.com -u "$USER" --password-stdin + echo "$PASS" | docker login -u "$USER" --password-stdin docker push $IMAGE_NAME:$BUILD_NUMBER ''' } From ac31ab59ff37cb3fbe88eabc85db6fa2fb6759e1 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 09:08:31 +0200 Subject: [PATCH 18/24] jenkinfile agente any --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 787579b..2c39591 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,7 @@ pipeline { - agent { label 'docker' } + // Alternativa: agent { label 'docker' } — esegue la pipeline su un agent Jenkins con Docker + // installato, utile per gli stage di build/push dell'immagine senza dipendere dal nodo master. + agent any options { // Aggiunge il timestamp alle righe della console output della pipeline From 006f959249caa79dbf7eae329594df80fa39c664 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 09:09:44 +0200 Subject: [PATCH 19/24] user di default --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2c39591..21459f9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,7 +19,7 @@ pipeline { ) string( name: 'DOCKERHUB_USER', - defaultValue: 'your-dockerhub-username', + defaultValue: 'marcoz88', description: 'Username Docker Hub (es. mariorossi → mariorossi/sysfoo)' ) } From ec6e34d3474c5a7c6b89f922a6207549fda4226d Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 09:13:26 +0200 Subject: [PATCH 20/24] fix jenkinsfile: add maven tool --- Jenkinsfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 21459f9..f0a102c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -27,7 +27,12 @@ pipeline { environment { IMAGE_NAME = "${params.DOCKERHUB_USER}/sysfoo" } - + /* manage jenkins> tools> maven installation> metti stesso nome che usi qua + cioè ( Maven 3.9.6 ) + */ + tools{ + maven 'Maven 3.9.6' + } stages { stage('Checkout') { steps { From c763f27eadd4099ee1c5b0c1f2c7f44c06ec9b1d Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 09:46:06 +0200 Subject: [PATCH 21/24] eseguo kubectl con withcredentials --- Jenkinsfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f0a102c..b7b5082 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -95,14 +95,19 @@ pipeline { } } - stage('Deploy') { - steps { - // Aggiorna il deployment Kubernetes con la nuova immagine e il relativo build number. - // Kubernetes esegue poi il rollout; lo stato si verifica con: kubectl rollout status - sh 'kubectl set image deployment/sysfoo sysfoo=$IMAGE_NAME:$BUILD_NUMBER' + stage('Deploy') { + steps { + withCredentials([file(credentialsId: 'kubeconfig-docker-desktop', variable: 'KUBECONFIG')]) { + sh ''' + kubectl config current-context + kubectl get nodes + kubectl set image deployment/sysfoo sysfoo=$IMAGE_NAME:$BUILD_NUMBER + kubectl rollout status deployment/sysfoo --timeout=120s + ''' } } } + } post { success { From 86dbdc34c1dfedf35a70e5a2284d9af4183c95b0 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 12:55:32 +0200 Subject: [PATCH 22/24] add gy --- gy | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 gy diff --git a/gy b/gy new file mode 100644 index 0000000..e69de29 From fd8522c0195911c2b7adc249edc6d2b9b44dde46 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 12:57:48 +0200 Subject: [PATCH 23/24] add gu --- gu | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 gu diff --git a/gu b/gu new file mode 100644 index 0000000..e69de29 From 39d173918a1e7bced7643498df4b0f98b2256c14 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 26 Jun 2026 13:11:30 +0200 Subject: [PATCH 24/24] aggiunti checks --- Jenkinsfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index b7b5082..8ca3968 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -40,6 +40,17 @@ pipeline { } } + stage('Start') { + steps { + publishChecks( + name: 'jenkins/ci', + title: 'Jenkins CI', + summary: 'Build avviata da Jenkins.', + status: 'IN_PROGRESS' + ) + } + } + stage('Build') { steps { // Solo compilazione: fallisce in fretta su errori di sintassi @@ -111,9 +122,25 @@ pipeline { post { success { + publishChecks( + name: 'jenkins/ci', + title: 'Jenkins CI', + summary: 'Build completata con successo.', + status: 'COMPLETED', + conclusion: 'SUCCESS', + detailsURL: env.BUILD_URL + ) echo 'Pipeline completata' } failure { + publishChecks( + name: 'jenkins/ci', + title: 'Jenkins CI', + summary: 'Build fallita.', + status: 'COMPLETED', + conclusion: 'FAILURE', + detailsURL: env.BUILD_URL + ) echo 'Pipeline fallita' } always {