Upload multiple files using s3upload in Jenkins pipeline
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}") } }
Refer to the following link AWS s3 documentation. In that, refer section 'Use of Exclude and Include Filters'
Here is a way to upload multiple files of a particular type.
If you only want to upload files with a particular extension, you need to first exclude all files, then re-include the files with the particular extension. This command will upload only files ending with .jpg:
aws s3 cp /tmp/foo/ s3://bucket/ --recursive --exclude "*" --include "*.jpg"
This works for AWS Command Line Interface.