Matt Kagan
Matt Kagan

Reputation: 719

How do I use Jenkins s3 publish plugin to the same location for every build?

I am using Jenkins to build my application, which I then need to publish to s3. One of the outputs is an installation exe file that I then provide as a link to users of the application. Because of this I need this installer file to always be in the same place, for every build. However, no matter how I set up my S3 Publishing post-build step the the artifacts are uploaded to a separate folder for every build, like so s3 structure

Is there a way for me to set up the publish to the root of the directory/bucket every time, overwriting the old file if neccesary? This would eliminate the jobs/TestTrayApp/{buildnumber} directories. This is my s3 publish post-build step setup:

enter image description here

Upvotes: 7

Views: 1845

Answers (3)

Ashan Priyadarshana
Ashan Priyadarshana

Reputation: 3649

Unselect both Manage artifacts and Flatten directories checkboxes. And as per the Source give the directory name followed by a / which contains your executable. For example:

enter image description here

This way your latest executable will always be placed in bucket/blahblahblah/executable/executable.exe location no matter how many times your job runs.

Upvotes: 0

Brian Ogden
Brian Ogden

Reputation: 19232

You simply need another build step that copies the published .exe artifact to the permanent location for users to download.

I think you are confusing "publishing an app to your production environment" and publishing build artifacts. I believe the intent of this Jenkins S3 publish plugin is not to be used for your final release production version but as a build step to archive build artifacts, archive might have the same meaning as publishing in this context regarding your build artifacts. See this article for why I am thinking the Jenkins S3 publish plugin is not meant to be used to actually publish the final release version of your application.

Use a Jenkins Pipeline or add another build step to your Freestyle to copy the exe from S3 build artifact archive to your final permanent storage container for users to download from your website/app.

Upvotes: 0

rohit thomas
rohit thomas

Reputation: 2322

I'm not sure I fully understand what exactly what you want, but based on what I could gather up,you have an .exe file which needs to be in a particular location before publishing to s3 ?

Why not add a another post build action before your actual post build(publishing to s3) copy .exe to the destination location and then initiate publish build.

wont that be easier :)

Upvotes: 1

Related Questions