JoeCianflone
JoeCianflone

Reputation: 682

Jenkins switch build folder

I'm not even sure if I'm thinking about this correctly so I'm having difficulty googling it. I've got Jenkins set up and building a site and correctly sending the build artifacts over SSH to the live server.

My ideal workflow would be to ssh into the server, drop the new assets into a build folder, copy the old build files to a backup directory and drop all the new build files where the old build files used to be.

Not sure if that even makes sense or if there is a better way to do this. To be clear, I'm not talking about a single .war file or anything. I'm talking about a package of PHP files, images, CSS and other stuff.

I'm new to Jenkins in general so any help pointing me in the right direction is greatly appreciated.

Upvotes: 0

Views: 270

Answers (1)

Gerold Broser
Gerold Broser

Reputation: 14782

See the ArtifactDeployer Plugin:

ArtifactDeployer plugin enables you to archive build artifacts to any remote locations such as to a separate file server.

...

ArtifactDeployer is a complete alternative to the built-in Jenkins feature "Archiving artefacts' and it is aimed at providing an uniform deployment mechanism.

Add it to your project's config with Post-build ActionsAdd post-build action[ArtifactDeployer] - Deploy the artifacts from build workspace to remote locations.

or the Flexible Publish Plugin:

...
[Send build artifacts over SSH]
...

Add it to your project's config with Post-build ActionsAdd post-build actionFlexible publish.

or an idea I haven't tried myself yet, so no guarantees:

Configure your live server to be Jenkins slave node, create a project that is bound to this slave and use the Copy Artifact Plugin therein:

Adds a build step to copy artifacts from another project.

Add it to this project's config with BuildAdd build stepCopy artifacts from another project.

Upvotes: 1

Related Questions