mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-24 16:55: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 && \
|
RUN apt update && \
|
||||||
apt install openjdk-17-jdk -y && \
|
apt install openjdk-11-jdk -y && \
|
||||||
apt install git -y && \
|
git clone https://github.com/lahari104/spring-petclinic.git && \
|
||||||
git clone https://github.com/spring-projects/spring-petclinic.git && \
|
|
||||||
cd spring-petclinic && \
|
cd spring-petclinic && \
|
||||||
./mvnw package
|
./mvn package
|
||||||
EXPOSE 8080
|
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{
|
pipeline{
|
||||||
agent{
|
agent{
|
||||||
label 'docker'
|
label 'lahari'
|
||||||
}
|
}
|
||||||
triggers{
|
triggers{
|
||||||
pollSCM('* * * * *')
|
pollSCM('* * * * *')
|
||||||
}
|
}
|
||||||
parameters{
|
parameters{
|
||||||
choice(name: 'branch_name', choices: ['main', 'two', 'three'], description: 'selecting branch')
|
choice(name: 'Branch_Name', choices: ['develop', 'main', 'lahari'], description: 'selecting branch')
|
||||||
}
|
|
||||||
environment{
|
|
||||||
dockerhub_registry_name = "lahari104"
|
|
||||||
image_name = "spc"
|
|
||||||
}
|
}
|
||||||
stages{
|
stages{
|
||||||
stage('docker image build'){
|
stage('clone'){
|
||||||
steps{
|
steps{
|
||||||
sh """
|
git url: 'https://github.com/lahari104/spring-petclinic.git',
|
||||||
docker image build -t ${image_name}:${BUILD_NUMBER}-${NODE_NAME} .
|
branch: "${params.Branch_Name}"
|
||||||
docker image ls
|
}
|
||||||
"""
|
}
|
||||||
|
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