mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-27 01:45:49 +00:00
added pipeline code
This commit is contained in:
parent
c7a9d1113b
commit
dcbcc5fdfc
1 changed files with 35 additions and 0 deletions
35
Jenkinsfile
vendored
35
Jenkinsfile
vendored
|
@ -0,0 +1,35 @@
|
||||||
|
pipeline {
|
||||||
|
agent {label 'JDK-17'}
|
||||||
|
trigger{
|
||||||
|
pollSCM('* * * * *')
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('vcm') {
|
||||||
|
steps {
|
||||||
|
git url : 'https://github.com/devops-Jenkins-assignment/spring-petclinic-1.git',
|
||||||
|
branch : 'feature'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Merge Pull Request') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
def prNumber = env.CHANGE_ID
|
||||||
|
def repoOwner = env.GIT_AUTHOR_NAME
|
||||||
|
def repoName = GIT_BRANCH
|
||||||
|
def targetBranch = 'develop'
|
||||||
|
echo "PR Number : ${prNumber} -repo owner : ${repoOwner} - repo Name : ${repoName}"
|
||||||
|
// clone the repository
|
||||||
|
checkout([$class: 'GitSCM', branches: [[name: '*/develop']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'your_credentials_id', url: 'your_repo_url']]])
|
||||||
|
// fetch the pull request
|
||||||
|
sh "git fetch origin pull/${prNumber}/head:pr-${prNumber}"
|
||||||
|
// checkout the pull request
|
||||||
|
sh "git checkout pr-${prNumber}"
|
||||||
|
// merge the pull request into the develop branch
|
||||||
|
sh "git merge origin/${targetBranch} --no-ff --no-edit"
|
||||||
|
// push the changes to the remote repository
|
||||||
|
sh "git push origin ${targetBranch}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue