Can we upload multiple files (not entire folder) to S3 using s3Upload
in Jenkins file?
I was trying to upload all rpm files (*.rpm
) in the root directory to S3 using the s3Upload
function.
You can upload all the files with following command in one line.
s3Upload(bucket:"my-bucket", path:'path/to/targetFolder/', includePathPattern:'**/*.svg', workingDir:'dist')
Further explaining, You can create own filtering based on following two possibilities;
1.Include all the files of a certain extention.
s3Upload(bucket:"my-bucket", path:'path/to/targetFolder/', includePathPattern:'**/*.svg', workingDir:'dist')
2.Include all the files except certain file extention.
s3Upload(bucket:"my-bucket", path:'path/to/targetFolder/', includePathPattern:'**/*', workingDir:'dist', excludePathPattern:'**/*.svg')
Reference: https://github.com/jenkinsci/pipeline-aws-plugin (Check under s3Upload)
findFiles solved the issue. Below is the snippet used for the same.
files = findFiles(glob: '*.rpm')
files.each {
println "RPM: ${it}"
withAWS(credentials: '****************'){
s3Upload(file:"${it}", bucket:'rpm-repo', path:"${bucket_path}")
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With