mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-19 14:05:50 +00:00
Added script to deploy to tomcat
This commit is contained in:
parent
ae19cced5f
commit
9731ff7a67
2 changed files with 24 additions and 2 deletions
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
|
@ -23,8 +23,8 @@ pipeline {
|
|||
}
|
||||
}
|
||||
steps {
|
||||
sh 'scp -P 2223 -r test.sh vagrant@192.168.0.18:/home/vagrant/.'
|
||||
sh 'ssh -p 2223 vagrant@192.168.0.18 < test.sh'
|
||||
sh 'scp -P 2223 -r script.sh vagrant@192.168.0.18:/home/vagrant/.'
|
||||
sh 'ssh -p 2223 vagrant@192.168.0.18 < script.sh'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
22
script.sh
Normal file
22
script.sh
Normal file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
wget http://192.168.0.18:8081/artifactory/libs-snapshot-local/org/springframework/samples/spring-petclinic/maven-metadata.xml
|
||||
VERSION=$(cat maven-metadata.xml | grep -m 1 -oP '(?<=<version>).*(?=</version>)')
|
||||
rm -f maven-metadata.xml
|
||||
wget http://192.168.0.18:8081/artifactory/libs-snapshot-local/org/springframework/samples/spring-petclinic/$VERSION/maven-metadata.xml
|
||||
|
||||
AID=$(cat maven-metadata.xml | grep -m 1 -oP '(?<=<artifactId>).*(?=</artifactId>)')
|
||||
VALUE=$(cat maven-metadata.xml | grep -m 1 -oP '(?<=<value>).*(?=</value>)')
|
||||
echo $AID-$VALUE.war > version
|
||||
#echo "curl \"http://192.168.0.56:8081/repository/maven-snapshots/org/springframework/samples/spring-petclinic/$VERSION/" > command
|
||||
|
||||
echo "curl \"http://192.168.0.18:8081/artifactory/libs-snapshot-local/org/springframework/samples/spring-petclinic/$VERSION/" > command
|
||||
|
||||
paste -d '' command version > firsthalf
|
||||
echo "\" -o /usr/share/tomcat/webapps/petclinic.war" > secondhalf
|
||||
paste -d '' firsthalf secondhalf > fullcmd
|
||||
chmod 755 fullcmd
|
||||
./fullcmd
|
||||
service tomcat restart
|
||||
#rm -f command firsthalf fullcmd maven-metadata.xml secondhalf version
|
||||
rm -f command firsthalf maven-metadata.xml secondhalf version
|
Loading…
Reference in a new issue