I have done using credentails it working , I have to upload a file from a Jenkins pipeline script to S3 without storing keys in credentials. I have already configured an Amazon S3 profile in Jenkins under System Configuration. Can you guys provide a sample pipeline script for this
pipeline {
agent any
stages {
stage('Build') {
steps {
script {
sh 'echo "hello" >> hello.txt'
echo 'Building...'
}
}
}
}
post {
always {
script {
withAWS(region: 'us-east-1', credentials: 'awscred') {
s3Upload(
bucket: 'jenkinstest',
file: 'hello.txt',
path: ''
)
}
echo 'Cleaning up...'
}
}
}
3