CVS to GIT Migration: Invalid Change Text

While migrating one of our CVS repositories, I got the following error:

ERROR: The command 'cvs -Q -R -f -d :local:/cvsroot co -r1.1.2.1 -p -kb snapRETAIL_Archive/Server/Db/scripts/Programmability/Functions/FN_GetBinType.sql' failed with exit status=1
and the following output:
cvs checkout: Dropping data: pos>vec->text.nlines
cvs [checkout aborted]: invalid change text in /cvsroot/snapRETAIL_Archive/Server/Db/scripts/Programmability/Functions/FN_GetBinType.sql,v

After some detective work, I determined that the problem was an improperly formatted CVS(RCS) file with the following format:

...

1.1
log
@file FN_GetBinType.sql was initially added on branch Branch_1_1_0_4.
@
text
@@

1.1.2.1
log
@*** empty log message ***
@
text
@d1 1
a1 29
...

What is happening is the 1.1 version of the code has been created with an empty file.  Then the 1.1.2.1 version is attempting to update that revision by deleting one line of text and then adding the following 29 lines of new text.  However, since the 1.1 version didn’t actually have any lines of text this operation fails.  I’m not sure how this was caused, but I do recall similar issues when a file is added to a branch that is not on the main development line.

The simple solution in this case was changing the original text to be a single line.

text
@
@

I did try removing the deleted text, but this caused the same error.  Presumably the update expects existing text.

Jenkins – Create a Windows Visual Studio Project

This is a walk through of the configuration for the Jenkins Build for the Zebra Commerce Project.  As a prerequisite, the Jenkins server should already be installed and ready to build, refer to Jenkins – Windows Setup.

The Zebra Commerce build will perform the following tasks:

  • Monitor the Git repository for and changes (every 15 minutes)
  • Clone the Zebra Commerce Git Respository
  • Clean the Workspace to ensure a clean build
  • Run the Zebra Commerce Build script with the -NGIT flag (since Git is handled by the Jenkins Script)
  • Install the CoreFull version of ZebraCommerce to the local server
  • Create the Zebra Commerce Database for the Build
  • Import the Engineering Data Set

This configuration will create a full installation of the build that can then be used by the development team for testing.

Getting Started

The first step to creating a new build configuration is to create the project.  If this is the first project, simply select “create new jobs” to create the first project.  Otherwise, select “New Item”.
JenkinsZC_CreateNewJobs

Next you will enter the Project Name and type of a project.  In this case it will be a “FreeStyle project” which is the standard to start from.

JenkinsZC_1_CreateFreeStyleProject

A form is then displayed that allows you to configure all of the details of the project, starting with a description of the project. JenkinsZC_1a_ProjectNameAndDescription

Source Code Management

For this project, we are using Git for our SCM and will be monitoring the repository every 15 minutes for any changes.  If there is a change, we will automatically begin a new build.

In the Source Code Management section of the Project Configuration form, select Git for the type of SCM.  If Git is not an available option, the Git Plugin has not been installed, you will need to go back to the plug-in manager and add it.

When adding git you need to add the repository URL and the Credentials.

JenkinsZC_1b_SelectGitforSCMSource

By default Jenkins runs as the Local System Account so you can add the private key there, but I think a cleaner solution is to add the key directly through Jenkins.

JenkinsZC_1b_AddGitCredentialsNext we set up a few additional behaviors:

  • Set clone timeout to 60 minutes.  We do this because Zebra Commerce is a very large project and will time out at the 10 minute default.
  • Clean before checkout, so we always have a clean repository and don’t accidentally distribute objects from another build (we actually do this again later due to a bug in git).
  • Create a  new tag in the repository for each build.

JenkinsZC_1d_AddCustomGitBehaviours

Unfortunately the version of git that I am using has a problem with properly cleaning the repository, it does fails to delete a directory which has files that also need to be deleted, so we need to do an extra git clean.  To do, use the pre-scm-buildstep plugin to add an additional build step under the build section, “Add build step” and select “Execute Windows batch command”.  Add the command “git clean -fdx”.

JenkinsZC_1c_Git_Extra_Clean

By default, the project workspace is located in the Program Files, this is a bit hidden and also causes problems with long file names.  To move it change the directory in the Advanced Project Options.

JenkinsZC_1i_MoveBuildRepositoryWe then set the build triggers, in this case it will poll Git every 15 seconds to look for changes to the repository and will invoke a build if one occurs.
JenkinsZC_1e_SetBuildTriggerToPollSCM

The SCM configuration is complete, so now is a good time to run a test build and ensure that it is working thus far.  Select Build Now and the build will begin.JenkinsZC_1g_TestBuildSCMOnly

You can also view the console output of the build while it is progressing but either the menu for the striped building indicator or selecting console output on the menu for the build on the status page.JenkinsZC_1h_TestBuildSCMOnlyRunning

Run the Build

Now we setup the actual steps for the build.  In the case of ZebraCommerce this will be running a Perl script in the build directory.  This is done with the an “Execute Windows batch command” under the Build section.

One thing to be careful of is the path when running as Local System User, you may want to set it here as well, e.g. “set Path=%PATH%;c:\windows\system32;C:\Windows\Microsoft.NET\Framework\v3.5”

JenkinsZC_1j_RunBuildScript

Install the Build

Once the build is successful, we now automatically install the software in to a test environment.  This consists of:

  • Installing the Full version of the application
  • Restart the Data Import Services
  • Create the Database
  • Import the Test Data

This is accomplished by creating another “Execute Windows batch command” under the build section with all of the tasks.

JenkinsZC_1k_Install_Application

Archiving Artifacts

Finally, once the build is successfully completed and the application is installed, we need to archive an artifacts that we want to maintain long-term.  The way Jenkins works is that there is a work space that is used to create each build and there is also a separate area for those artifacts to keep longer term.  These artifacts are available for download from the Jenkins web interface.

In this case we will keep the installation files for the application which Zebra Commerce places in the bin directory, during the build.  This is created in the “Post-build Actions” section with the “Archive the artifacts option’.  In this case the bin directory does not yet exist, so we receive a warning, but once the build is completed it will work.

JenkinsZC_1l_ArchiveArtifacts

Jenkins Windows Setup

I’m in the process of setting up a Jenkins Build Server for my teams Window projects.  It will be hosted internally on a Windows Server 2012 Virtual Machine and provide continuous integration, deployment, and testing for our team.

Now that the server is ready, the first step is to download Jenkins for Windows.  This is conveniently available on the Jenkins home page.

Jenkins_Home_Page

The download contains a setup.exe and jenkins.msi files which provide a very painless installation process.  Simply run the setup.exe and the setup wizard will begin.

Jenkins_Install1_Welcome

Select Next to begin the setup.Jenkins_Install2_Destination_Folder

Select your installation directory, and then the Next button.

Jenkins_Install3_Ready

Now select the Install button and the installation will begin.  After a minute, the Jenkins setup will be completed.

Jenkins_Install5_Completed

Now that the installation is finished, select the Finish button and Jenkins will be ready to begin.Jenkins_Install6_Initial_Page

Adding Plugins

Jenkins has an extensive set of plugins to provide tools for all types of integration and configuration.  For this installation we will need support for the Git Plugin and the pre-scm-buildstep plugins.

Interesting Stuff for November 2015

Podcasts

Scala

  • Why Scala? … by a hilarious Indian guy

Git

Gource

Microsoft

  • Windows Sysinternals – PsTools:
    • PsExec – execute processes remotely
    • PsFile – shows files opened remotely
    • PsGetSid – display the SID of a computer or a user
    • PsInfo – list information about a system
    • PsPing – measure network performance
    • PsKill – kill processes by name or process ID
    • PsList – list detailed information about processes
    • PsLoggedOn – see who’s logged on locally and via resource sharing (full source is included)
    • PsLogList – dump event log records
    • PsPasswd – changes account passwords
    • PsService – view and control services
    • PsShutdown – shuts down and optionally reboots a computer
    • PsSuspend – suspends processes
    • PsUptime – shows you how long a system has been running since its last reboot (PsUptime’s functionality has been incorporated into PsInfo)
    • Running as the “Local System Account” for testing service account access:
      PsExec -i -s cmd.exe

Interesting Stuff for October 2015

A list of random interesting things I’ve seen over the last month or so.

Image Processing:

Utilities:

  • Dependency Walker (http://www.dependencywalker.com/): Provides a utility to determine the dependencies of a Microsoft module.  Also distributed in older Microsoft VS.
  • The windows “where” command works like the Unix “which” command to find the path of an executable name.
  • Run multiple commands from a cmd shell (http://stackoverflow.com/a/8055430/86923).

Node:

Quotes:

Jenkins

 

Jenkins, formerly known as Hudson, is an extensible open source continuous integration server that simplifies the process between development and deployment.

I am installing it for our Windows development environment running Git, MSBuild and perl scripts to do the build.  Here are some things that helped getting it working.

Links:

Blogs:

Videos:

Open Data Hack Night (10/15/15)

Open data has finally come to Allegheny County and the City of Pittsburgh. You’re invited to celebrate the launch of the Western Pennsylvania Regional Data Center at the community launch event.


Western Pennsylvania Regional Data Center (WPRDC) – http://www.wprdc.org/ , a site for public data sets in the Pittsburgh Region.
Looked at some cool data sets including:

 

SSH on Windows

 

 

 

 

 

Server Fault: SSH / SCP Server on Windows (http://serverfault.com/questions/10468/ssh-scp-server-on-windows)

Successfully connected from putty. Note: With a domain account it needs to be connected to talk to the domain controller. Use the format \ or @

Could not connect to the BitVise SSHD server from the Git Extensions Bash shell.   With the error:

Terminal initialization failure. See server logs for more info.
Hint: Try requesting a different terminal environment.
Connection to localhost closed.

It turns out that this is a problem with the terminal type in the Bash shell which defaults to ‘msys’. I found the solution at ServerFault, Is it possible to change value of $TERM when calling ssh?. Set TERM=vt220.

When connecting from Git Extenstions to the server the first time you may get the error:

The server's host key is not cached in the registry.
You have no guarantee that the server is the computer you think it is.
The server's rsa2 key fingerprint is: ssh-rsa 2048
16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
Connection abandoned. fatal: The remote end hung up unexpectedly

For some reason Plink can't handle setting up a new machine, but if you connect with putty it saves the remote machines information to the registry and everything will work fine thereafter (http://stackoverflow.com/questions/10166173/git-servers-host-key-not-cached-in-registry-github-com).

Resources:

Installing GitExtensions

GitExtensions

Git Extensions is an awesome UI for working with Git in the Windows platform.

To install, download the distribution from http://sourceforge.net/projects/gitextensions/ and run it.  This walk-through is the installation of version 2.48.05.

GitExtensionsSetup

GitExtensionsInstallAllUsers

GitExtensionsRequiredSoftwareGitExtensionsDestinationFolderGitExtensionsCustomSetupGitExtensionsSSHClientGitExtensionsReady

GitExtensionsInstalling

Kdiff3 is a 3-way diff program that is the default diff program for Git Extensions.  It is loaded automatically if you selected it above.

KdiffSetupAgreement

KdiffSetupComponents

KdiffSetupLocation

KdiffSetupAllUsers

KdiffSetupStartMenu

KdiffSetupInstalling

KdiffSetupCompleting

Next sets up Msys Git, the actual Git installation that does all of the processing.

GitSetup

GitLicense

GitComponents

GitPathSetup

Note: I like using Git on the Windows side too, but for GitExtensions you can just use it with Git Bash.  Adding the optional tools is OK if you are a Unix junky, but confusing if you think you are on Microsoft and all of a sudden some of the commands are changing.

GitLineEndings

Note: I’m perhaps conservative here and just stick with how it is since some programs like it different ways.

GitInstalling

GitCompleting

Now Git Extensions runs and makes sure everything looks good:

GitExtensionsSettingChecklist

GitExtensionsCompleted

And now we are ready to start using Git!!!