We have around 5000 projects (various technologies) managed in StartTeam. Client moving to a new stack Bitbucket, JFrog, Bamboo & UrbanCode.
Bitbucket: It will be used for source control and underlying GIT will be used as revision control systems.
JFrog: Will manage the binaries for maven repository.
Bamboo: Will be used for build server.
UrbanCode: It will be used to automate the code deployment process.
I am taking JAVA project as reference for my questions. Currently StartTeam project contains source code as well as all required binaries and its not a maven project. ANT script is used for project build.
Requirement is migrating project like this to Bitbucket with minimal effort. the Bitbucket should not contain any binaries it would only manage the source code. Client also has setup an artifactory JFrog which will manage binaries for maven.
As part of this migration I am thinking a hybrid approach something like:
Step 1: Project will be downloaded from StartTeam.
Step 2: All binaries will be added to a new pom.xml as dependencies
Step 3: Code will be checkin to Bibucket
Step 4: In bamboo build server the build will be configured in two steps
a. First it will download all the required jars into a folder by executing the pom.xml
b. Then the existing ant script will be called to build the project by adding all the jars downloaded in previous step into CLASSPATH
Step5: UrbanCode will be configured to automate the deployment process
Already migrated few projects using this approach.
If time permits may be we will consider first fully mavenized the project (secondary approach) before importing into Bitbucket.
Questions:
1) There are approximately 5000 projects that need to be migrated so I am looking for expert suggestions how to proceed with approach 1 (hybrid approach)?
2) Please suggest is there any other approaches which can make this migration with less effort?
3) Any tools which can accelerate this migration?
Finally I have automated this migrations process as much as possible in the following way:
1) Download the project from StarTeam
2) I have Developed a JAVA utility which will scan the project workspace and dump all the jar details into an excel sheet. For each jar it will calculate the checksum (SHA-1) using the below code
Then it will query the Artifactory using the checksum value for the matching jar details like groupId, artifactId, version etc...If the jar details not found in Artifactory, then it will query MAVEN central repository for the matching jar details. Finally all the existing project jar details and the corresponding MAVEN compatible jar details will be dumped in the excel sheet.
Sample code for querying the MAVEN central repository
Sample code for querying the Artifactory
There could be a chance that project may contain custom jars which may not be available either in Artifactory or MAVEN central. In such cases the generated excel sheet will be shared with AD team for corresponding jar details. The jar will be installed in Artifactory and the AD team will update the excel sheet with the groupId, arfactId, version.
Once the excel sheet having all the jar details the JAVA utility will generate the pom.xml by reading the corresponding MAVEN details. The "copy-rename-maven-plugin" plugin is used here to copy all the maven downloaded jars from "target/dependency" folder to respective project folder. This pom will be configured as the first build steps in Bamboo server followed by build.xml which will build the project. Note I am using hybrid approach in build process.
Below is the code snippets for the same
Next steps is cleanup: It will delete all the jars from the project and will keep a track of the jar locations.
Created a shell script which will connect the bitbucket server and will push the code using git command. I am using "GIT Bash" to execute the script. Note, I am using Bitbucket rest API to create the project and repositories remotely before pushing the code.
REST service details for creating the project:
REST service details for creating repository under the above Project
Git commands for pushing the project into Bitbucket
Using this approach we have automated 80% of the migration activity.