diff --git a/Jenkinsfile b/Jenkinsfile index 066c4bb79..01998321b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -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' } } } } -