From a46c59b8f4a9eced7a080df45a0f03fc5be6c7b8 Mon Sep 17 00:00:00 2001 From: Chris Hoban Date: Sun, 21 Jul 2019 22:05:10 -0700 Subject: [PATCH] Moving sample-app-jenkinsfile In order to be accessed by context directory --- .../jenkins/sample-app-jenkinsfile | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 jrcc-access-spring-boot-sample-app/jenkins/sample-app-jenkinsfile diff --git a/jrcc-access-spring-boot-sample-app/jenkins/sample-app-jenkinsfile b/jrcc-access-spring-boot-sample-app/jenkins/sample-app-jenkinsfile new file mode 100644 index 00000000..61370eb6 --- /dev/null +++ b/jrcc-access-spring-boot-sample-app/jenkins/sample-app-jenkinsfile @@ -0,0 +1,42 @@ +try { + timeout(time: 20, unit: 'MINUTES') { + + node { + stage("Initialize") { + project = env.BUILD + } + } + + node('maven') { + + stage("Checkout") { + git url: "${GIT_SOURCE_URL}", branch: "${GIT_SOURCE_REF}" + } + + stage("Build JARs") { + sh "mvn clean package -Psample-app -Dmaven.test.skip=true" + sh "ls" + + //stash name:"jars", includes:"target/*.jar" + } + + stage('Push to Nexus'){ + // Read POM xml file using 'readMavenPom' step , this step 'readMavenPom' is included in: https://plugins.jenkins.io/pipeline-utility-steps + pom = readMavenPom file: "pom.xml"; + // Find built artifact under target folder + filesByGlob = findFiles(glob: "**/target/*.jar"); + + echo "Found ${filesByGlob.length} files" + for(file in filesByGlob){ + echo "${file.name} ${file.path} ${file.directory} ${file.length} ${file.lastModified}" + } + } + + } + } +} catch (err) { + echo "in catch block" + echo "Caught: ${err}" + currentBuild.result = 'FAILURE' + throw err +}