From f115787ef6582cee22724fa10d9998c30b1f0692 Mon Sep 17 00:00:00 2001 From: Dion Moustos Date: Thu, 7 May 2026 18:57:09 +0930 Subject: [PATCH] more --- Jenkinsfile | 60 ++++++++++++++--------------------------------------- 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a9ad70e..0980d51 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,20 +36,12 @@ pipeline { stages { stage('Build Java & Frontend') { - agent { - docker { - image 'eclipse-temurin:21-jdk' - args '--network=host' - } - } + agent any steps { script { echo "Building Java and Frontend..." } sh ''' - apt-get update && apt-get install -y curl - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - - apt-get install -y nodejs chmod +x ./gradlew ./gradlew clean build -x test --build-cache ''' @@ -62,12 +54,7 @@ pipeline { } stage('Run Unit Tests') { - agent { - docker { - image 'eclipse-temurin:21-jdk' - args '--network=host' - } - } + agent any steps { script { echo "Running unit tests..." @@ -80,11 +67,6 @@ pipeline { post { always { junit 'backend/build/test-results/test/**/*.xml' - publishHTML([ - reportDir: 'backend/build/reports', - reportFiles: 'index.html', - reportName: 'Test Report' - ]) } } } @@ -100,12 +82,7 @@ pipeline { anyOf { branch 'main' branch 'develop' - branch 'master' - } - } - steps { - script { - echo "Running integration tests..." + any echo "Running integration tests..." } sh ''' chmod +x ./gradlew @@ -125,12 +102,7 @@ pipeline { image 'eclipse-temurin:21-jdk' args '--network=host' } - } - when { - changeRequest() - } - steps { - script { + }any script { echo "Running code quality checks..." } sh ''' @@ -152,6 +124,11 @@ pipeline { args '--network=host' } } + when { + anyOf { + changeRequest() + branch 'main' + any when { anyOf { changeRequest() @@ -165,17 +142,10 @@ pipeline { echo "Running SonarQube analysis..." } withSonarQubeEnv('SonarQube') { - sh 'gradle sonar' - } - } - post { - failure { - echo "SonarQube analysis failed - continuing pipeline with warning" - } - } - } - - stage('Build Docker Image') { + sh ''' + chmod +x ./gradlew + ./gradlew sonar + ''{ agent { docker { image 'docker:latest' @@ -187,7 +157,7 @@ pipeline { branch 'main' branch 'develop' branch 'master' - tag "*" + buildingTag() } } steps { @@ -233,7 +203,7 @@ pipeline { branch 'main' expression { params.DEPLOY_TO_PRODUCTION == true } } - tag "*" + buildingTag() } } steps {