mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-26 01:15:50 +00:00
added s3bucket
This commit is contained in:
parent
949f5af92d
commit
423c711534
4 changed files with 154 additions and 17 deletions
27
Jenkinsfile
vendored
27
Jenkinsfile
vendored
|
@ -1,31 +1,17 @@
|
|||
pipeline {
|
||||
agent { label 'MAVEN_JDK8' }
|
||||
triggers { pollSCM ('* * * * *') }
|
||||
parameters {
|
||||
choice(name: 'MAVEN_GOAL', choices: ['package', 'install', 'clean'], description: 'Maven Goal')
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('vcs') {
|
||||
steps {
|
||||
git url: 'https://github.com/Nanditha54/spring-petclinic.git',
|
||||
branch: 'declarative'
|
||||
branch: 'develop'
|
||||
}
|
||||
}
|
||||
stage('package') {
|
||||
tools {
|
||||
jdk 'JDK_17'
|
||||
}
|
||||
steps {
|
||||
sh 'mvn package'
|
||||
sh "mvn ${params.MAVEN_GOAL}"
|
||||
}
|
||||
}
|
||||
stage('sonar analysis') {
|
||||
steps {
|
||||
// performing sonarqube analysis with "withSonarQubeENV(<Name of Server configured in Jenkins>)"
|
||||
withSonarQubeEnv('SONAR_CLOUD') {
|
||||
sh 'mvn verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=nan_sonarcube'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
stage('post build') {
|
||||
|
@ -35,5 +21,12 @@ pipeline {
|
|||
junit testResults: '**/surefire-reports/TEST-*.xml'
|
||||
}
|
||||
}
|
||||
stage('craeting folder') {
|
||||
steps {
|
||||
sh "mkdir -p /tmp/${JOB_NAME}/${BUILD_ID}"
|
||||
sh "cp -r **/spring-petclinic-*.jar /tmp/${JOB_NAME}/${BUILD_ID}"
|
||||
sh "aws s3 sync /tmp/${JOB_NAME}/${BUILD_ID} s3://rajurani123 --acl public-read-write"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
113
awsconfig/spc
Normal file
113
awsconfig/spc
Normal file
|
@ -0,0 +1,113 @@
|
|||
pipeline {
|
||||
agent { label 'MAVEN_8' }
|
||||
triggers { pollSCM ('* * * * *') }
|
||||
parameters {
|
||||
choice(name: 'MAVEN_GOAL', choices: ['package', 'install', 'clean'], description: 'Maven Goal')
|
||||
}
|
||||
stages {
|
||||
stage('vcs') {
|
||||
steps {
|
||||
git url: 'https://github.com/Learningjenkinsqt/spring-petclinic.git',
|
||||
branch: 'declarative'
|
||||
}
|
||||
}
|
||||
stage('package') {
|
||||
tools {
|
||||
jdk 'JDK_17'
|
||||
}
|
||||
steps {
|
||||
sh 'mvn package'
|
||||
sh "mvn ${params.MAVEN_GOAL}"
|
||||
}
|
||||
}
|
||||
stage('post build') {
|
||||
steps {
|
||||
archiveArtifacts artifacts: '**/target/spring-petclinic-3.0.0-SNAPSHOT.jar',
|
||||
onlyIfSuccessful: true
|
||||
junit testResults: '**/surefire-reports/TEST-*.xml'
|
||||
}
|
||||
}
|
||||
stage('craeting folder') {
|
||||
steps {
|
||||
sh "mkdir -p /tmp/${JOB_NAME}/${BUILD_ID}"
|
||||
sh "cp -r **/spring-petclinic-*.jar /tmp/${JOB_NAME}/${BUILD_ID}"
|
||||
sh "aws s3 sync /tmp/${JOB_NAME}/${BUILD_ID} s3://reddyspcbucket --acl public-read-write"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
11
awsconfig/unit/sevicefile
Normal file
11
awsconfig/unit/sevicefile
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Mangae Java Service SPC
|
||||
[Service]
|
||||
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
|
||||
WorkingDirectory=/home/ubuntu
|
||||
ExecStart=java -jar spring-petclinic-3.0.0-SNAPSHOT.jar
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
20
awsconfig/unit/ymalfile/spcbucket.yml
Normal file
20
awsconfig/unit/ymalfile/spcbucket.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
- name: Download jar file
|
||||
hosts: all
|
||||
become: yes
|
||||
tasks:
|
||||
- name: install spc
|
||||
get_url:
|
||||
url: 'https://reddyspcbucket.s3.ap-south-1.amazonaws.com/spring-petclinic-3.0.0-SNAPSHOT.jar'
|
||||
dest: /home/ubuntu
|
||||
- name: copy the service the file
|
||||
copy:
|
||||
src: springpetclinic.service
|
||||
dest: /etc/systemd/system/
|
||||
mode: "777"
|
||||
- name: daemon reload
|
||||
systemd:
|
||||
name: springpetclinic.service
|
||||
daemon_reload: yes
|
||||
state: started
|
||||
enabled: yes
|
Loading…
Reference in a new issue