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
10b182786a
commit
b857705df1
1 changed files with 17 additions and 22 deletions
39
Jenkinsfile
vendored
39
Jenkinsfile
vendored
|
@ -1,34 +1,29 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
|
||||
stages {
|
||||
stage('Checkout SCM') {
|
||||
stage('Download and Execute Shell Script') {
|
||||
steps {
|
||||
checkout scm
|
||||
withAWS(region: 'ap-south-1', credentials: 'iamuser1') {
|
||||
script {
|
||||
// Download the shell script from S3
|
||||
sh 'aws s3 cp s3://myjenkinsbucket001/checkout/checkout.sh /tmp/script.sh'
|
||||
}
|
||||
}
|
||||
|
||||
script {
|
||||
// Make the downloaded script executable
|
||||
sh 'chmod +x /tmp/script.sh'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Download and Execute Jenkinsfile') {
|
||||
|
||||
stage('Execute Downloaded Shell Script') {
|
||||
steps {
|
||||
script {
|
||||
// Download the Jenkinsfile from S3
|
||||
sh 'aws s3 cp s3://myjenkinsbucket001/Jenkinsfile $WORKSPACE/tmp/Jenkinsfile'
|
||||
|
||||
// Read the downloaded Jenkinsfile
|
||||
def downloadedJenkinsfile = readFile("$WORKSPACE/tmp/Jenkinsfile")
|
||||
|
||||
// Clean workspace before executing downloaded Jenkinsfile
|
||||
deleteDir()
|
||||
|
||||
// Write the downloaded Jenkinsfile to the workspace
|
||||
writeFile(file: 'Jenkinsfile', text: downloadedJenkinsfile)
|
||||
|
||||
// Load and execute the downloaded Jenkinsfile
|
||||
load 'Jenkinsfile'
|
||||
}
|
||||
// Execute the downloaded shell script
|
||||
sh '/tmp/script.sh'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue