Jenkins Pipeline - How to upload folder to S3?

 ̄綄美尐妖づ 提交于 2019-12-24 08:55:21

问题


I have, as I think, simple use case, when jenkins builds static website, so in the end of the build, I have a folder like $WORKSPACE/site-result.

Now I want to upload this folder to S3 (and clean bucket if something already there). How can I do it?

I'm using pipeline, but can switch to freestyle project if necessary. So far I installed S3 Plugin (S3 publisher plugin). Created IAM user. Added credentials to "Configure system" section. And can't find any further info. Thanks!


回答1:


If the answer suggesting the Pipeline AWS Plugin doesn't work, you could always have an upload step in your pipeline where you use sh call the AWS CLI:

aws s3 cp $WORKSPACE/site-result s3://your/bucket --recursive --include "*"

Source: http://docs.aws.amazon.com/cli/latest/reference/s3/




回答2:


You have to use s3Upload plugin and set the sourceFile parameter as '*/*'



来源:https://stackoverflow.com/questions/42744366/jenkins-pipeline-how-to-upload-folder-to-s3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!