Not do checkout for second stage

Rick Waugh August 18, 2015

I have set up a build of a node.js application on AWS. We create a dev environment, run tests against that. Then in the second stage, we build the production environment, if there was no failure in the first stage.

This takes a while, and I have come to realize that after the check out for the dev build, there is quite a bit of time for someone to save code before the production build starts, thus allowing untested code to get pushed to production. I thought that maybe I would not have to do a checkout for the second stage, that the checkout would still be there, but it failed on the first task, it couldn't find one of my scripts.

So I can make the second stage part of the first stage, that's easy enough - it's just going to have a lot of steps in it. But is there a way to not check the code out fresh? We are doing this on the cloud, and there is no way to specify revision number that I can see.

2 answers

0 votes
shari_anderson August 25, 2015

It would be best to tag the code upon successful build in the first step, then in the 2nd build (for production) would build from the tag or from the prior checkout. No need to checkout again if it succeeds.

 

0 votes
Daniel Wester
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2015

In the first stage, make sure to compress the source code into a zip or tar file. Then set up a shared artifact see https://confluence.atlassian.com/display/BAMBOO/Bamboo+Best+Practice+-+Sharing+artifacts for more details on it.

Now you shouldn't have to worry about code slipping in as long as you have Bamboo doing the checkout (and not using git yourself). Bamboo will save the the revisions/sha's it's using and then reuse it for any downstream jobs.

Rick Waugh August 18, 2015

Thanks, Daniel. I was wondering about whether it would save the revision. If I have multiple stages though, will it use the same revision in the second stage that it used in the first. I note that you said "jobs" and I don't know whether that means jobs in the next stage.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events