Deployment Project - How to get an artifact from different build plans?
Asked by Andrew Pitt:

Quick background:

95% of our projects produce a single EAR as an artifact. Each of our projects generally have the following four builds:

* Build (Triggered upon each commit. Produces a snapshot)
* Release (Manually triggered. Produces a non-snapshot artifact)
* Site (Maven site build, run nightly)
* Deploy Dev (Deploy the most recent snapshot to DEV)

What we want to do is get rid of our "deploy dev" plans, and use "Deployment Projects". We are moving towards automated deployments to three environments (DEV, UAT, QA), so this seems like a natural fit.

The problem I'm having is that a Deployment Project can only be sourced from a single build. For us, that causes a big problem because:

* We want to be able to deploy snapshots regularly (maybe 2-3 times/day) to DEV, and sometimes to UAT
* When it's time to do a release, we want to be able to promote the release through all environments

Ideally, when you generate your next "Release" for your Deployment Project, you would be able to pick from more than one source plan (perhaps provided the plan produces an artifact of the same name). Since we can only source from a single plan, we are either stuck with snapshots (which will never make it past UAT) or with releases (which means we can't user our deployment project to deploy snapshots to dev).

We could keep our trusty old "Deploy Dev" plans for snapshots and use a Deployment Project only for releases, but that means two things:

1. We have to duplicate the "DEV" deploment config in a normal bamboo build and in a Deployment Project.
2. The deployment history for "DEV" in the deployment plan would be useless, since most of the deploys to that env would be from a different plan.

Has anybody else run into this problem and solved it? I created a ticket with Atlassian about this a month ago, but it's still awaiting triage.

Thanks!


Answers:
author: Gretchen
body: This is a tough one, hard to say what your environment looks like. But I'll take a crack at giving you some ideas to hopefully shake ideas loose.

Think outside the bamboo box. Since you're using maven you presumably have a nexus (artifactory, whatever) repository where your snapshots are stored. You could create bamboo jobs to pull the artifacts from the binary repository by name. How you get the name seems like a scripting issue but it would be doable.

So build -\>maven/bamboo push snapshot to nexus

deploy \<-bamboo pull from nexus whatever artifact you want and deploy to environment

The deployment projects could either just be a build plan (that does rcp or xcopy to your destination), or it could be a deployment plan off a build plan that pulls from the binary repository. You might be able to figure out a way to create branches for each environment and use variables to on those branches to tweak destinations. This may or may not be possible. We don't use maven or nexus but you could variabilize URL's pointing to your binary repo.

The advantage here is that you break from the tight coupling of build to deploy. Instead rely on the repository to pull whatever artifacts you want to deploy to whatever environment you want.

There are so many possible variables here, that to give you a specific solution is not possible. Hopefully this will give you ideas to kick around until you come up with something that will work in your situation.


Tags: bamboo-administration