Not do checkout for second stage

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
Daniel Wester Community Champion Aug 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.

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.

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.

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Thursday in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

123 views 3 4
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you