mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 00:05:50 +00:00
spc added
This commit is contained in:
parent
2c0466c72a
commit
21c15675f5
3 changed files with 75 additions and 18 deletions
11
Dockerfile
11
Dockerfile
|
@ -1,9 +1,8 @@
|
|||
FROM ubuntu:20.04 as build
|
||||
FROM ubuntu20.04
|
||||
RUN apt update && \
|
||||
apt install openjdk-17-jdk -y && \
|
||||
apt install git -y && \
|
||||
git clone https://github.com/spring-projects/spring-petclinic.git && \
|
||||
apt install openjdk-11-jdk -y && \
|
||||
git clone https://github.com/lahari104/spring-petclinic.git && \
|
||||
cd spring-petclinic && \
|
||||
./mvnw package
|
||||
./mvn package
|
||||
EXPOSE 8080
|
||||
CMD [ "java", "-jar", "/spring-petclinic/target/spring-petclinic-3.0.0-SNAPSHOT.jar" ]
|
||||
CMD [ "java", "-jar", "spring-petclinic" ]
|
65
Jenkinsfile
vendored
65
Jenkinsfile
vendored
|
@ -1,25 +1,66 @@
|
|||
pipeline{
|
||||
agent{
|
||||
label 'docker'
|
||||
label 'lahari'
|
||||
}
|
||||
triggers{
|
||||
pollSCM('* * * * *')
|
||||
}
|
||||
parameters{
|
||||
choice(name: 'branch_name', choices: ['main', 'two', 'three'], description: 'selecting branch')
|
||||
}
|
||||
environment{
|
||||
dockerhub_registry_name = "lahari104"
|
||||
image_name = "spc"
|
||||
choice(name: 'Branch_Name', choices: ['develop', 'main', 'lahari'], description: 'selecting branch')
|
||||
}
|
||||
stages{
|
||||
stage('docker image build'){
|
||||
stage('clone'){
|
||||
steps{
|
||||
sh """
|
||||
docker image build -t ${image_name}:${BUILD_NUMBER}-${NODE_NAME} .
|
||||
docker image ls
|
||||
"""
|
||||
git url: 'https://github.com/lahari104/spring-petclinic.git',
|
||||
branch: "${params.Branch_Name}"
|
||||
}
|
||||
}
|
||||
stage('build'){
|
||||
steps{
|
||||
sh "./mvnw clean package"
|
||||
}
|
||||
}
|
||||
stage('archive_artifacts'){
|
||||
steps{
|
||||
archiveArtifacts artifacts: '**/target/*.jar'
|
||||
}
|
||||
}
|
||||
stage('junit_reports'){
|
||||
steps{
|
||||
junit '**/surefire-reports/*.xml'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post{
|
||||
always{
|
||||
echo 'Pipeline is triggered'
|
||||
mail to: 'goruputivenkatalahari@gmail.com',
|
||||
subject: 'The pipeline is started',
|
||||
body: """pipeline is started for $env.BUILD_URL
|
||||
and the build number is $env.BUILD_NUMBER"""
|
||||
}
|
||||
aborted{
|
||||
echo 'Pipeline is aborted'
|
||||
mail to: 'goruputivenkatalahari@gmail.com',
|
||||
subject: 'The pipeline is aborted',
|
||||
body: """pipeline is aborted for $env.BUILD_URL
|
||||
and the build number is $env.BUILD_NUMBER
|
||||
and jenkins url is $env.JENKINS_URL"""
|
||||
}
|
||||
failure{
|
||||
echo 'Pipeline is falied'
|
||||
mail to: 'goruputivenkatalahari@gmail.com',
|
||||
subject: 'The pipeline is failed',
|
||||
body: """pipeline is falied for $env.BUILD_URL
|
||||
and the build number is $env.BUILD_NUMBER
|
||||
and jenkins url is $env.JENKINS_URL"""
|
||||
}
|
||||
success{
|
||||
echo 'Pipeline is success'
|
||||
mail to: 'goruputivenkatalahari@gmail.com',
|
||||
subject: 'The pipeline is success',
|
||||
body: """pipeline is success for $env.BUILD_URL
|
||||
and the build number is $env.BUILD_NUMBER"""
|
||||
}
|
||||
}
|
||||
}
|
17
azure-spc-pipelines.yaml
Normal file
17
azure-spc-pipelines.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
pool: 'Default'
|
||||
trigger:
|
||||
- main
|
||||
stages:
|
||||
- stage: 'build'
|
||||
displayName: 'build stage'
|
||||
jobs:
|
||||
- job: 'build'
|
||||
displayName: 'build job'
|
||||
steps:
|
||||
- task: Docker@2
|
||||
inputs:
|
||||
containerRegistry: Docker_hub
|
||||
repository: lahari23/springpetclinic
|
||||
command: 'buildAndPush'
|
||||
Dockerfile: '**/Dockerfile'
|
||||
|
Loading…
Reference in a new issue