Issue
I am trying to upload git repo through Jenkins job. I cant able to find any documentation related to file upload through Jenkins job. Can any please let me know how to upload git repo from Jenkins job to S3 bucket.
Thanks in advance.
Solution
You may use aws cli to accomplish that.
Install aws cli for on the server jenkins is hosted in and make sure jenkins user can use it.
In your Job, set the following Environment Variables:
- AWS_ACCESS_KEY_ID=
- AWS_SECRET_ACCESS_KEY=
- AWS_DEFAULT_REGION=
In your jenkins job command use:
aws s3 cp . s3://target-bucket/target-path/ --recursive
And so, your target path will have all the codebase after job completes.
Answered By - amsh
Answer Checked By - David Marino (JavaFixing Volunteer)