This commit is contained in:
VSAzima 2021-04-27 13:49:37 +04:00
parent 6382078475
commit 52d68fa930
2 changed files with 60 additions and 60 deletions

116
Jenkinsfile vendored
View file

@ -40,65 +40,65 @@ pipeline {
} }
} }
} }
// stage("publish to nexus") { stage("publish to nexus") {
// steps { steps {
// script { script {
// // Read POM xml file using 'readMavenPom' step , this step 'readMavenPom' is included in: https://plugins.jenkins.io/pipeline-utility-steps // 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"; pom = readMavenPom file: "pom.xml";
// // Find built artifact under target folder // Find built artifact under target folder
// filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); filesByGlob = findFiles(glob: "target/*.${pom.packaging}");
// // Print some info from the artifact found // Print some info from the artifact found
// echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}"
// // Extract the path from the File found // Extract the path from the File found
// artifactPath = filesByGlob[0].path; artifactPath = filesByGlob[0].path;
// // Assign to a boolean response verifying If the artifact name exists // Assign to a boolean response verifying If the artifact name exists
// artifactExists = fileExists artifactPath; artifactExists = fileExists artifactPath;
//
// if(artifactExists) { if(artifactExists) {
// echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}"; echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version}";
//
// nexusArtifactUploader( nexusArtifactUploader(
// nexusVersion: NEXUS_VERSION, nexusVersion: NEXUS_VERSION,
// protocol: NEXUS_PROTOCOL, protocol: NEXUS_PROTOCOL,
// nexusUrl: NEXUS_URL, nexusUrl: NEXUS_URL,
// groupId: pom.groupId, groupId: pom.groupId,
// version: pom.version, version: pom.version,
// repository: NEXUS_REPOSITORY, repository: NEXUS_REPOSITORY,
// credentialsId: NEXUS_CREDENTIAL_ID, credentialsId: NEXUS_CREDENTIAL_ID,
// artifacts: [ artifacts: [
// // Artifact generated such as .jar, .ear and .war files. // Artifact generated such as .jar, .ear and .war files.
// [artifactId: pom.artifactId, [artifactId: pom.artifactId,
// classifier: '', classifier: '',
// file: artifactPath, file: artifactPath,
// type: pom.packaging], type: pom.packaging],
//
// // Lets upload the pom.xml file for additional information for Transitive dependencies // Lets upload the pom.xml file for additional information for Transitive dependencies
// [artifactId: pom.artifactId, [artifactId: pom.artifactId,
// classifier: '', classifier: '',
// file: "pom.xml", file: "pom.xml",
// type: "pom"] type: "pom"]
// ] ]
// ); );
//
// } else { } else {
// error "*** File: ${artifactPath}, could not be found"; 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('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&
// '''
// }
// }
// }
// }
} }
} }

View file

@ -350,14 +350,14 @@
<enabled>true</enabled> <enabled>true</enabled>
</snapshots> </snapshots>
</repository> --> </repository> -->
<repository> <!-- <repository>
<id>maven-central</id> <id>maven-central</id>
<name>maven-central</name> <name>maven-central</name>
<url>https://172.19.0.3:8081/repository/maven-central/</url> <url>https://172.19.0.3:8081/repository/maven-central/</url>
<snapshots> <snapshots>
<enabled>false</enabled> <enabled>false</enabled>
</snapshots> </snapshots>
</repository> </repository> -->
</repositories> </repositories>