Matthew Rhoden
Matthew Rhoden

Reputation: 728

Deploy Build from Separate Job in Jenkins

I have anywhere from 5 to 15 jobs in jenkins (varies from week to week) that deploy essentially the same code to our environments, but with different configurations. Is there a way to have one job do the building and separate jobs to do the deploying?

I have seen people suggest a custom workspace, but I have other builds I still want to deploy normally.

I'm still somewhat new to jenkins, I'm hoping there's some convention/best practice for this situation before I delve into hard coding the paths.

Upvotes: 2

Views: 5060

Answers (2)

DevD
DevD

Reputation: 664

better use a multi-configuration job with axis as deployment types(5-15). even you can restrict the choice of deployment type by build parameterised.

Even you have a freedom of choosing customized or common work space

you can configure build code as a upstream project for deployment job.

Upvotes: 0

Bruno Lavit
Bruno Lavit

Reputation: 10382

If I understand correctly, you want to build your code one time with a dedicated job and next, deploy multiple configurations using other Jenkins jobs?

If your build job delivers some artifacts (war, zip, ...), you can archive these artifacts (at the build job level). And next, use the Copy Artifact Plugin to get these artifacts in your deployment jobs (it's a build step).

The other solution is to archive the built workspace (at the build job level), and next uses this archive as a SCM source for your deployment jobs. You can use the Clone Workspace SCM Plugin for that.

Upvotes: 3

Related Questions