mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-25 01:05:48 +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 {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Checkout SCM') {
|
stage('Download and Execute Shell Script') {
|
||||||
steps {
|
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 {
|
steps {
|
||||||
script {
|
// Execute the downloaded shell script
|
||||||
// Download the Jenkinsfile from S3
|
sh '/tmp/script.sh'
|
||||||
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'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue