What you need to know and do before you start
From this article, you will learn how to write an adaptor to integrate the Mercurial distributed version control tool with IBM® Rational® Build Forge® build and release management software, how to parse and extract the detail information into the Bill of Materials, or BOM, and how to determine whether there are new changesets coming.
- For this purpose, we assume that the agent, which will run the adaptor, is running in a Linux or UNIX environment, because you need some command of Linux or UNIX to parse the command.
- You have made a clone in the server where the Rational Build Forge agent is running
Objective of this example
Using this example, you can get a quick start in integrating Mercurial with Build Forge. And using this example as a template, you can add more features based on it.
This example will connect a project by using a project name, which is passed in as an environment variable and checked if there are new changesets coming. If there are new changesets coming, the adaptor will download them from repository. If there are not, the adaptor will set the flag to "FAILED." It is easy to create a continuous build based on this adaptor.
Table: Variables used in this adaptor example
|projects_root||The root directory for projects of your Mercurial local clone||projects_root=/code/mercurial/projects|
|project||Your project name under whatever you named the projects_root|| project=testProjectOne|
This means that your project is located in:
Use the example
Here is the procedure to use the example:
- Download the example code from the Downloads section of this article.
- Create an adaptor using this example code, and give it a name, for
- Create a test project.
- Integrate the adaptor in either of these two ways:
- Use the Create an adaptor link to link the project with the adaptor.
- Use the
.sourcecommand in a step, for example:
- Run the project.
Note:If you are using the adaptor link, don't forget to click the check box for Use adaptor link.
Output of the adaptor
In the adaptor, there are two steps.
- Use the
hg incommand to check whether there is any new changeset coming.
- Use the
hg pull/hg updatecommand to pull and update the changeset on the local server.
If there is no changeset coming, the adaptor will return "FAIL," but if there is new changeset coming, it will pull and update it. If successful, the adaptor will return a "Successful" response code. If it encounters any problem, it returns "FAIL" code.
After running, the changeset details (such as file name list, author, change date, and description) will be recorded in the Bill of Materials, or BOM.
- Compare Rational Build Forge editions and check the developerWorks Build Forge page for technical articles, product information, related products, and links to other resources.
- See the Rational Build Forge information center for complete Build Forge documentation, which includes a section about Integrating with a subsection about Adaptor integrations.
- Be sure to browse the Build Forge page on Jazz.net, too.
- For in-depth information, read Mercurial: The Definitive Guide, by Bryan O'Sullivan.
- Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
- Stay current with developerWorks technical events and webcasts focused on a variety of IBM products and IT industry topics.
- Improve your skills. Check the Rational training and certification catalog, which includes many types of courses on a wide range of topics. You can take some of them anywhere, any time, and many of the "Getting Started" ones are free.
Get products and technologies
- Check the Trials and Demos page for Rational software.
- Evaluate IBM software in the way that suits you best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.
- Rate or review Rational software products. It's quick and easy. Really.
- Join the Using Rational Build Forge forum on Jazz.net to ask questions and share your experiences with other developers.
- Join the Rational software forums to ask questions and participate in discussions.
- Share your knowledge and help others who use Rational software by writing a developerWorks article. You'll get worldwide exposure, RSS syndication, a byline and a bio, and the benefit of professional editing and production on the developerWorks Rational website. Find out what makes a good developerWorks article and how to proceed.
- Follow Rational software on Facebook, Twitter (@ibmrational), and YouTube, and add your comments and requests.
- Ask and answer questions and increase your expertise when you get involved in the Rational forums, cafés, and wikis.
- Connect with others who share your interests by joining the developerWorks community and responding to the developer-driven blogs.