Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cruise Control .net git log invalid revision range

I've managed to mess up my Cruise Control projects.

I was updating the Git URLs for the project repositories on my continuous integration server when moving to a new source control host. I got a bit cut and paste happy and pasted the wrong URL for a repository into the origin. So the next time Cruise Control did a pull it merged and pulled a lot of stuff that shouldn't be in the repository.

Once I'd realised my mistake, I thought not a problem, I'll just delete the offending repository and clone using the correct URL.

Except that Cruise Control seems to have remembered the last change set from the messed up repository and when deciding if it needs to do a new build it's throwing a hissy fit. That's what I'm guessing has happened anyway. When it's issuing a git log command it's saying that it can't find a change set in the cleaned up respository.

The command it's issuing is:

git log 66cd57438ea42b4f8cb6dbf033dc1162f61a4d54..origin/master --name-status --pretty=format:"Commit:%H%nTime:%ci%nAuthor:%an%nE-Mail:%ae%nMessage:%s%n%n%b%nChanges:" -m

Git's reponse is

Source control operation failed: fatal: Invalid revision range 66cd57438ea42b4f8cb6dbf033dc1162f61d5e65..origin/master

The changeset id definitely doesn't exist in the correct repository but does exist in the repository I incorrectly merged.

How do I get Cruise Control .net to forget the duff changeset id?

like image 327
Giles Roberts Avatar asked Feb 11 '23 19:02

Giles Roberts


1 Answers

CruiseControl.net stores the id of the last commit in a per-project state file. These are normally text files that reside in the server directory (c:\Program Files (x86)\CruiseControl.NET\server)

e.g. A state file could contain:

<IntegrationResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" scmError="false">
  <ProjectName>Project1</ProjectName>
  ...
  <Label>1.2.3.4</Label>
  <Parameters>
    ...
    <NameValuePair name="$LastChangeNumber" value="66cd57438ea42b4f8cb6dbf033dc1162f61a4d54" />
  </Parameters>
  <LastSuccessfulIntegrationLabel>1.2.3.4</LastSuccessfulIntegrationLabel>
  <SourceControl name="commit" value="66cd57438ea42b4f8cb6dbf033dc1162f61a4d54" />
</IntegrationResult>

You can modify this file to contain a commit id thats relevant from your correct repository; however you must stop CruiseControl first. Restart the server/service once they've all been changed and all should be good.

The only line that needs changing is:

  <SourceControl name="commit" value="66cd57438ea42b4f8cb6dbf033dc1162f61a4d54" />

The other properties can be left as is; they're just properties of the last build.

like image 81
Simon Laing Avatar answered Feb 14 '23 09:02

Simon Laing