mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-25 00:25:50 +00:00
stages
This commit is contained in:
parent
6382078475
commit
52d68fa930
2 changed files with 60 additions and 60 deletions
116
Jenkinsfile
vendored
116
Jenkinsfile
vendored
|
@ -40,65 +40,65 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
// stage("publish to nexus") {
|
||||
// steps {
|
||||
// script {
|
||||
// // 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/*.${pom.packaging}");
|
||||
// // Print some info from the artifact found
|
||||
// echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}"
|
||||
// // Extract the path from the File found
|
||||
// artifactPath = filesByGlob[0].path;
|
||||
// // Assign to a boolean response verifying If the artifact name exists
|
||||
// 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: [
|
||||
// // Artifact generated such as .jar, .ear and .war files.
|
||||
// [artifactId: pom.artifactId,
|
||||
// classifier: '',
|
||||
// file: artifactPath,
|
||||
// type: pom.packaging],
|
||||
//
|
||||
// // Lets upload the pom.xml file for additional information for Transitive dependencies
|
||||
// [artifactId: pom.artifactId,
|
||||
// classifier: '',
|
||||
// file: "pom.xml",
|
||||
// type: "pom"]
|
||||
// ]
|
||||
// );
|
||||
//
|
||||
// } else {
|
||||
// error "*** File: ${artifactPath}, could not be found";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
stage('run') {
|
||||
steps {
|
||||
script {
|
||||
withCredentials([usernameColonPassword(credentialsId: 'nexus-deployment-user', variable: 'DEPLOYMENT')]) {
|
||||
sh '''
|
||||
curl -u "$DEPLOYMENT" http://${NEXUS_URL}/repository/${NEXUS_REPOSITORY}/org/springframework/samples/spring-petclinic/2.4.2/spring-petclinic-2.4.2.jar >output
|
||||
(java -jar spring-petclinic-2.4.2.jar --server.port=8083>> server.log 2>&1&)
|
||||
nohup java -jar spring-petclinic-2.4.2.jar --server.port=8083>> server.log 2>&1&
|
||||
'''
|
||||
}
|
||||
stage("publish to nexus") {
|
||||
steps {
|
||||
script {
|
||||
// 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/*.${pom.packaging}");
|
||||
// Print some info from the artifact found
|
||||
echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}"
|
||||
// Extract the path from the File found
|
||||
artifactPath = filesByGlob[0].path;
|
||||
// Assign to a boolean response verifying If the artifact name exists
|
||||
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: [
|
||||
// Artifact generated such as .jar, .ear and .war files.
|
||||
[artifactId: pom.artifactId,
|
||||
classifier: '',
|
||||
file: artifactPath,
|
||||
type: pom.packaging],
|
||||
|
||||
// Lets upload the pom.xml file for additional information for Transitive dependencies
|
||||
[artifactId: pom.artifactId,
|
||||
classifier: '',
|
||||
file: "pom.xml",
|
||||
type: "pom"]
|
||||
]
|
||||
);
|
||||
|
||||
} else {
|
||||
error "*** File: ${artifactPath}, could not be found";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// stage('run') {
|
||||
// steps {
|
||||
// script {
|
||||
// withCredentials([usernameColonPassword(credentialsId: 'nexus-deployment-user', variable: 'DEPLOYMENT')]) {
|
||||
// sh '''
|
||||
// curl -u "$DEPLOYMENT" http://${NEXUS_URL}/repository/${NEXUS_REPOSITORY}/org/springframework/samples/spring-petclinic/2.4.2/spring-petclinic-2.4.2.jar >output
|
||||
// (java -jar spring-petclinic-2.4.2.jar --server.port=8083>> server.log 2>&1&)
|
||||
// nohup java -jar spring-petclinic-2.4.2.jar --server.port=8083>> server.log 2>&1&
|
||||
// '''
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -350,14 +350,14 @@
|
|||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository> -->
|
||||
<repository>
|
||||
<!-- <repository>
|
||||
<id>maven-central</id>
|
||||
<name>maven-central</name>
|
||||
<url>https://172.19.0.3:8081/repository/maven-central/</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repository> -->
|
||||
|
||||
</repositories>
|
||||
|
||||
|
|
Loading…
Reference in a new issue