Bamboo artifacts sharing and updated shared artifacts if some packages get modified
Asked by abhinav_bipnesh:

I need to setup a build plan in Bamboo for an repository in which check-in happens very rarely. So currently when the build happen it the packages in that repository get re-build which consume lot of time. So we are thinking to optimize the same. Below is the use case which we want to address.

1. At the very first build of the plan we want to build the packages from that repository. So that it build the RPM's packages with some version format say name-a.b.c.d.rpm.
2. Now there could be the case that in particular folder some file get changed. So we want that bamboo should identify that and build the package for that directory. If this is not possible I have thought for this to be done through build script.
3. Now as above step will result into a limited package build, we want to update the artifacts build as part of the step 1 and step 3. So say some package in step 1 have version as name-a.b.c.d.rpm and some packages in step 3 will have version as name-a.b.c.e.rpm So we want to replace the package for which this version got changed.
4. These artifacts need to be shared across build till we have step 2 and 3 occurring.

So any thoughts how we can achieve the same?


Answers:
author: Krystian Brazulewicz
body: Bamboo can't detect what part of your source tree has changed. If your "particular folder" is an independent module/project - why not put it into a separate repository and create separate plan for it?

comments: author: abhinav_bipnesh
body: I can write an script which will check for modifications for such things. But I am not getting how to merge the artifacts and publish it for later builds.


author: Krystian Brazulewicz
body: What programming language/technologies your project uses?


author: abhinav_bipnesh
body: Let me provide more information that what I am trying to achieve.I have a repository which contain audio files for different languages. Below is sample layout/test\|---en\|---enu\|---frNow some time there will be check-in in some of the directories or may be in all directories. So the build take longer time to build. So to avoid that I can write an script which can query to repository and find which directory has modification and then can make package for those directories.But here come another issue as the version is maintained using bamboo build plan in form x.x.x.\<build no\>.rpm.Now we want to achieve below stuff1. Using the build script we build selected packages which has different version say for example en-1.0.0.100.rpm2. Now initially we would have packages like en-1.0.0.10.rpm, enu-1.0.0.10.rpm and fr-1.0.0.10.rpmSo we want to have mixed artifacts from the previous build and this build so the publish artifacts like belowen-1.0.0.100.rpm, enu-1.0.0.10.rpm, fr-1.0.0.10.rpmAny thoughts how we can achieve it. As the build host are CentOs one we can have any language support to build the framework.


author: Krystian Brazulewicz
body: Bamboo can't merge artifacts from different builds. You'd have to create some additional utility that would scan Bamboo for artifacts and then combine them elsewhere. Other solution would be creating Jobs for every subdirectory in your folder. Such Job would always produce artifact but if you have multiple agents then multiple Jobs in the same Stage can be run in parallel making total build time shorter.


author: abhinav_bipnesh
body: Hmm, seems need to set Artifact download task for downloading older artifacts. After that need to develop a script which do this merge stuff if any change happens. As I have limited agents so that will not help as need to run for 25 such directories.


author: Alex Soto
body: My concern is do the build artifacts persist across builds for you on the build agent's build directory? If you are using AWS build agents, those build artifacts may disappear between instances of build agents.

However, assuming these build artifacts are there so they do not require being rebuilt, I'd recommend using a proper Makefile to minimize the number of items being rebuilt.

comments: author: abhinav_bipnesh
body: Basically we mark an artifact as milestone to make sure it is retained even after default time for delete. So we can retain it. But seems most of the work we need to do to achieve our use case. As bamboo is just providing a UI for build file and downloads :(


author: Alex Soto
body: What you are asking for is not what a product like bamboo is designed for (IMO) so you are trying to fit a square peg in a round hole. If you pound on it enough it it will fit, but it won't be pretty ;)I recommend you refactor into multiple builds and create dependencies between them, then only the things that need re-building are built.


Tags: bamboo-administration