Update Jenkinsfile

This commit is contained in:
saisrinisrinivas 2023-07-04 13:13:46 +05:30 committed by GitHub
parent 26e6ef6fa6
commit 099b5a86b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

45
Jenkinsfile vendored
View file

@ -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'
}
}
}
}
}
}