The connector for Git can link to and modify tasks, defects, and
stories contained in CA Agile Central. To change the
of a CA Agile Central artifact, enter the ID for the artifact, followed by the state you wish to change to in your commit message.
The connector, upon a push to a remote repository, will:
- Inspect the contents of all commit comments and create a changeset object in CA Agile Central associated to the CA Agile Central artifact for each comment
- Create a change object for each affected file
- Optionally update the state of the CA Agile Central artifact
For example, if you check in two files with the commit message Fixed DE17, upon the push to a remote repository the Git connector:
- Creates a changeset object for the commit
- Creates two change objects for the affected files
- Links the changeset object to the defect object
- Sets the state of defect 17 to Fixed
The diagram below shows the objects that are created and modified when a check-in occurs with a CA Agile Central ID in the commit message (such as S123, DE17, TA123). No objects are created if the formatted ID in the change message is not found in CA Agile Central.
The connector makes the following changes to CA Agile Central:
- Change the Status
(depending up the artifact type) to the new status specified in the commit message (note Completed in the above example). The Status fields on the artifacts are:
- Defect: State
- Story: ScheduleState
- Task: State
- Create an SCMRepository object if one does not exist in CA Agile Central based on the <RallySCMRepositoryName> value in the configuration file.
- Create a changeset object in CA Agile Central associated to the artifact with message, revision, commit timestamp, and URI populated.
- Creates change object in CA Agile Central for each affected file associated to the changeset object with action, filename path, base, extension, and URI fields populated.
The connector automatically sets the ToDo value of a task to 0 if the commit message contains a task ID and a state of Completed.
This install guide includes:
Basic Installation Steps
- Install Ruby and the CA Agile Central connector for Git code.
- Set up the provided config.xml file with your customizations for Git.
- Run the config_test.rb to validate the configuration file.
- Set up git2rally.rb to be executed by the Git post-receive hook.
Get the Connector
The CA Agile Central connector for Git runs as a hook into a remote Git repository to create changeset objects in CA Agile Central from the message in your Git commit.
Connector download: RallyConnectorForGit-3.7.zip
This zip file contains the source code and Ruby scripts to plug into your hook for Git.
Software and Hardware Requirements
- A CA Agile Central
. Most build and changeset data will not display in CA Agile Central until a
enables the build and changeset flag by editing the
- Access to your Git server.
- Ruby programming language and Ruby gems (libraries) installed on the Git server. Note: You must use Ruby REST API version 1.0.3 as the connector will not work with earlier versions.
- Currently, cgit is the only supported Git web front-end client.
- The connector should work with the latest version of Git. Beta testing included running the connector as a post-receive hook with Git version 126.96.36.199 and 188.8.131.52 on a Linux server using these clients:
- Mac OS X
- Windows XP
Install the Connector
- Install the Ruby programming language.
- Install the required Ruby gems by entering the following from a command window:
gem install builder -y # Will be 3.0.0 or later.
gem install rally_rest_api -y # Will be 1.0.3 or later.
gem install rally_api -y # Will be 0.4.1 or later.<br />
- Answer yes to any questions about installing required dependencies.
- The rally_api gem will cause the gems mime-types (1.18 or later) and rest-client (1.6.7 or later) to be installed as well.
- Save the RallyConnectorForGit.zip file on your machine in a directory of your choosing, for example, /opt/Rally. Go to this directory and extract the RallyConnectorForGit.zip file. This should create a GitToRally subdirectory.
- For the connector to run successfully, git users must have execute
on the install directory and write access to the connector's log file, Rally_Connector_Error.log. To set these permissions, enter these commands in the directory above GitToRally:
chmod a+rx GitToRally
chmod a+rw GitToRally/Rally_Connector_Error.log
The Git post-receive hook is set up so the CA Agile Central connector process runs in the background for optimal performance. After you check in code, the CA Agile Central connector immediately runs and updates the appropriate objects in CA Agile Central without having to wait for the CA Agile Central web services requests to complete. Consequently, check the CA Agile Central log file for any errors.
Set Up the post-receive Hook on Unix:
The steps below assume you are running in a bash shell and that all files are saved in the /opt/integrations directory. Your file paths may vary depending on your installation.
- Create a bash script called RallyWrapper.sh that contains the command to run the git2rally script. Ensure you specify the full path to Ruby and the git2rally.rb file.
/usr/bin/ruby /opt/integrations/GitToRally/git2rally.rb $1 $2
- Verify the RallyWrapper.sh file is executable by entering this command:
chmod u+x RallyWrapper.sh
- Go to the Git server hooks directory.
- Open the post-receive file for editing (create this file if it does not exist) and add the line below. This command runs the child process in the background and redirects standard output and standard error to the Rally_Connector_Error.log file.
while read oldrev newrev refname
bash RallyWrapper.sh $oldrev $newrev > Rally_Connector_Error.log 2>1 &
- Verify the post-receive file is executable by entering this command:
chmod u+x post-receive
Configure the Connector
Set Up the config.xml File
Edit and save the provided config.xml file contained in the GitToRally directory, entering the appropriate values between each begin and end
. The XML is commented throughout to provide details on expected values for each tag.
- <RallyUserName>: The CA Agile Central user's login name you want to use for the updates in CA Agile Central.
- <RallyPassword>: The CA Agile Central user's password. The first time the connector runs, it will encode your password in the XML file for added security.
- <RallyBaseUrl>: The URL you use to log into CA Agile Central. For most users, the expected URL is rally1.rallydev.com or trial.rallydev.com.
- <RallyWorkspaceName>: The name of the CA Agile Central workspace where you want to update artifacts.
- <SourceControlUrl>: The URL you use to reference the Git web front-end (optional). The connector only supports cgit at this time. Usually, the format is: <git_server>/cgit/<path_to_repo>. For example, git/cgit/integrations_test.
- <RallySCMRepositoryName>: Any name of your choosing for the CA Agile Central SCMRepository object. The first time the connector runs, the connector automatically creates a new CA Agile Central SCMRepository object with Name set to the specified name.
- <UserDomain>: Your company domain name such as acme.com. This tag determines what CA Agile Central user is used to populate the author field when creating the changeset object.
- Optional—<CommitterUserLookupField>: A field name on the User Object in CA Agile Central. This will look up a commit user through that User field in CA Agile Central to link the changset Author to a user in CA Agile Central. For example, committer is user123 and the CA Agile Central user is [email protected] with MiddleName set to user123. If no users are found and the UserDomain element is set, the search will also try that association.
If set, the connector searches the CA Agile Central user based on the map to the Git user name such as [email protected] username in CA Agile Central to myuser Git user name.
If not set, the connector searches the CA Agile Central user based on the Git user email such as [email protected] username in CA Agile Central to [email protected] Git user email.
The <Prefixes> element is used to specify any custom prefixes you have specified for your artifacts.
- <Defect> is DE (default)
- <Story> is US (default)
- <Task> is TA (default)
Example config.xml file:
<!-- The following is used to determine how to translate a commit author to a CA Agile Central user.
Example: "user" to "[email protected]"
<!-- The following section is for specifying if you have configured CA Agile Central to use
custom prefixes for the FormattedIDs. NOTE: If your custom prefix
ends with a digit, this connector will not function properly.
After the first check-in comment which includes a CA Agile Central ID, the connector will rewrite the config.xml file to include the allowed state values for user stories, defects, and tasks. This will happen automatically as long as the connector script has write access to the file. This re-write will also add the <CachedStates> element to the file.
The <CachedStates> content in the config.xml file can remain untouched unless your CA Agile Central administrator modifies the allowed state values for user stories and defects. To force the next run of the connector to update the values stored in the config.xml file, modify it by deleting the text from the <CachedStates> tag to the closing tag </CachedStates>. The <CachedStates> content will be functionally equivalent to the following:
<!-- State field on the Defect artifact.-->
<!-- ScheduleState field on the User Story artifact.-->
<!-- State field on the Task artifact.-->
Test the Configuration File
To test the your config.xml file for completeness, issue this command: ruby config_test.rb
The above script will test the network settings and the connection information in your config.xml file. The output from the command should be:
- Log file write Passed
- Rally Url Passed
- Successfully connected to Rally
- Rally Workspace found
Troubleshoot the Connector
Changesets not Displaying in CA Agile Central
Verify your workspace administrator has selected the Enable Build and Changeset option on the Edit Workspace editor and verify there are no unexpected messages in the Rally_Connector_Error.log file. No errors are written to the console.
You can change the level of logging from the connector by including the following information in your configuration file:
Log level 0 will produce the maximum amount of output, with log level 5 producing the least. These levels are documented at http://corelib.rubyonrails.org/classes/Logger/Severity.html:
- DEBUG = 0
- INFO = 1
- WARN = 2
- ERROR = 3
- FATAL = 4
- UNKNOWN = 5
- 3.7.0 - Jun 2012
- Added support for multiple artifacts of the same type and multiple types
- Now the artifact's State and ScheduleState are identified dynamically, no longer requiring the <CachedStates> section in the configuration file
- Updated build environment so that Ruby 1.9.2 (or greater) is required
- 2.4.0 - Jan 2012
- Added support for mapping Git user name to CA Agile Central username through the MiddleName field in CA Agile Central
- 2.2.0b - Jun 2011
- Added support for mapping Git user email to CA Agile Central username on changeset object
- Added ability to specify prefix (https or http) on SourceControlUrl
- 2.1.0b - Jan 2011
- Added support for mapping Git author to CA Agile Central user on changeset object
- Added instructions on running connector as background process for optimal performance
- 2.0.0b - Jun 2010
- 1.0.3b - Jan 2010
- Original version of the connector