mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-26 00:45:50 +00:00
nexus stage added
This commit is contained in:
parent
ad43e78804
commit
02c9380a8c
1 changed files with 46 additions and 13 deletions
59
Jenkinsfile
vendored
59
Jenkinsfile
vendored
|
@ -1,5 +1,12 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
environment {
|
||||||
|
NEXUS_VERSION = "nexus3"
|
||||||
|
NEXUS_PROTOCOL = "http"
|
||||||
|
NEXUS_URL = "172.19.0.3:8081"
|
||||||
|
NEXUS_REPOSITORY = "maven-nexus-repo"
|
||||||
|
NEXUS_CREDENTIAL_ID = "nexus-user-credentials"
|
||||||
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('pull') {
|
stage('pull') {
|
||||||
steps {
|
steps {
|
||||||
|
@ -12,19 +19,45 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
docker.image('maven:3.8.1-jdk-8').inside {
|
docker.image('maven:3.8.1-jdk-8').inside {
|
||||||
// /var/jenkins_home/workspace/MeFirstPipelineJob
|
|
||||||
sh 'mvn -B clean package'
|
sh 'mvn -B clean package'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
stage('push') {
|
||||||
// // stage('push') {
|
steps {
|
||||||
// // steps {
|
script {
|
||||||
// // echo 'Pushing ...'
|
pom = readMavenPom file: "pom.xml";
|
||||||
// //
|
filesByGlob = findFiles(glob: "target/*.${pom.packaging}");
|
||||||
// // }
|
echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}"
|
||||||
// // }
|
artifactPath = filesByGlob[0].path;
|
||||||
// }
|
artifactExists = fileExists artifactPath;
|
||||||
}
|
if(artifactExists) {
|
||||||
}
|
echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}";
|
||||||
|
nexusArtifactUploader(
|
||||||
|
nexusVersion: NEXUS_VERSION,
|
||||||
|
protocol: NEXUS_PROTOCOL,
|
||||||
|
nexusUrl: NEXUS_URL,
|
||||||
|
groupId: pom.groupId,
|
||||||
|
version: pom.version,
|
||||||
|
repository: NEXUS_REPOSITORY,
|
||||||
|
credentialsId: NEXUS_CREDENTIAL_ID,
|
||||||
|
artifacts: [
|
||||||
|
[artifactId: pom.artifactId,
|
||||||
|
classifier: '',
|
||||||
|
file: artifactPath,
|
||||||
|
type: pom.packaging],
|
||||||
|
[artifactId: pom.artifactId,
|
||||||
|
classifier: '',
|
||||||
|
file: "pom.xml",
|
||||||
|
type: "pom"]
|
||||||
|
]
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
error "*** File: ${artifactPath}, could not be found";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue