mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-24 00:35:49 +00:00
Update Jenkinsfile
This commit is contained in:
parent
26e6ef6fa6
commit
099b5a86b0
1 changed files with 27 additions and 18 deletions
45
Jenkinsfile
vendored
45
Jenkinsfile
vendored
|
@ -1,22 +1,31 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('S3Download') {
|
||||
steps {
|
||||
withAWS(region:'ap-south-1',credentials:'iamuser1')
|
||||
{
|
||||
// Download the S3 object
|
||||
sh 'aws s3 cp s3://myjenkinsbucket001/Jenkinsfile /tmp/bucketfile'
|
||||
// Execute the downloaded script
|
||||
sh 'chmod +x /tmp/bucketfile'
|
||||
sh '/tmp/bucketfile'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
stages {
|
||||
stage('Download Jenkinsfile') {
|
||||
steps {
|
||||
withAWS(region: 'ap-south-1', credentials: 'iamuser1') {
|
||||
script {
|
||||
// Download the Jenkinsfile from S3
|
||||
sh 'aws s3 cp s3://myjenkinsbucket001/Jenkinsfile /tmp/Jenkinsfile'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Execute Jenkinsfile') {
|
||||
steps {
|
||||
// Execute the downloaded Jenkinsfile
|
||||
script {
|
||||
def downloadedJenkinsfile = readFile('/tmp/Jenkinsfile')
|
||||
node {
|
||||
deleteDir() // Clean workspace before executing downloaded Jenkinsfile
|
||||
writeFile(file: 'Jenkinsfile', text: downloadedJenkinsfile)
|
||||
load 'Jenkinsfile'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue