Git log error in PhpUnderControl continuous integration set up
Asked Answered
L

2

8

So I have set up the following for my PHP project:

  • A Git repository with all the code.
  • An instance of Cruisecontrol with PhpUnderControl running on top of it.

I created a new project in the cruisecontrol project directory and set up a poller to check changes on the git repo every 2 minutes. I have 2 projects running in this Cruisecontrol instance, and the first one I set up works just fine.

The issue I am having with the Platform project looks like this in the error logs:

2010-02-04 06:07:27,076 [Thread-14061] INFO  Project           - Project platform:  bootstrapping  
2010-02-04 06:07:27,077 [Thread-14061] INFO  ProjectController - platform Controller: build progress event: bootstrapping  
2010-02-04 06:07:27,496 [Thread-14061] INFO  GitBootstrapper   - Already up-to-date.  
2010-02-04 06:07:27,500 [Thread-14061] INFO  Project           - Project platform:  checking for modifications  
2010-02-04 06:07:27,500 [Thread-14061] INFO  ProjectController - platform Controller: build progress event: checking for modifications  
2010-02-04 06:07:27,583 [Thread-14063] WARN  Git               - warning: Log for '' only goes back to Tue, 26 Jan 2010 13:43:11 -0500.  
2010-02-04 06:07:27,584 [Thread-14063] WARN  Git               - fatal: Invalid revision range @{ 1264038932}..@{ 1265281647}  
2010-02-04 06:07:27,584 [Thread-14061] INFO  Project           - Project platform:  No modifications found, build not necessary.  
2010-02-04 06:07:27,584 [Thread-14061] INFO  Project           - Project platform:  idle  
2010-02-04 06:07:27,584 [Thread-14061] INFO  ProjectController - platform Controller: build progress event: idle

The strange thing here is that when I check the project directory, the code base gets updated. (I tested with a few small commits in my working directory.) The problem is that this never runs any of the other build processes since Git errors out.

If I go to the projects/platform directory directly and do a git pull, it works fine. Doing an ant build from the project directory also works just fine.

Here are the relevant config files:

<project name="platform" buildafterfailed="false">
    <plugin name="git" classname="net.sourceforge.cruisecontrol.sourcecontrols.Git" />

    <modificationset quietperiod="60">
        <git localWorkingCopy="projects/${project.name}/" />
    </modificationset>

    <bootstrappers>
        <gitbootstrapper localWorkingCopy="projects/${project.name}/" />
    </bootstrappers>

    <schedule interval="120">
        <ant antscript="/usr/bin/ant" buildfile="projects/${project.name}/build.xml" />
    </schedule>

    <listeners>
        <currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
    </listeners>

    <log dir="logs/${project.name}">
        <merge dir="projects/${project.name}/build/logs/" />
    </log>

    <publishers>
        <artifactspublisher dir="projects/${project.name}/build/api"
                            dest="artifacts/${project.name}"
                            subdirectory="api"/>
        <artifactspublisher dir="projects/${project.name}/build/coverage"
                            dest="artifacts/${project.name}"
                            subdirectory="coverage"/>
        <execute command="phpuc graph logs/${project.name} artifacts/${project.name}"/>
        <execute command="phpcb 
                          --log projects/${project.name}/build/logs
                          --source projects/${project.name}/lib/model
                          --ouput projects/${project.name}/build/php-code-browser" />
        <artifactspublisher dir="projects/${project.name}/build/php-code-browser"
                            dest="artifacts/${project.name}"
                            subdirectory="php-code-browser" />
    </publishers>
</project>

My searches on the git error haven't given me any good insight, so hopefully someone here knows!

Louden answered 4/2, 2010 at 18:1 Comment(0)
S
1

It looks like there is no branch set for git to checkout. I don't know how to fix that right away, but that might be the direction to go.

Shaky answered 15/2, 2010 at 11:59 Comment(3)
It isn't the checkout that is failing, it is the bootstrapper that is failing. If I do a git pull from the directory, it works just fine.Louden
But the warning definitely indicates that it's attempting to look at the reflog for a ref called '' (empty string). The first line explicitly shows that, and the second does implicitly - those @{date} bits should really be branch@{date} (which to git means "the position of branch on this date"). Definitely a configuration problem, not a git problem. Can't expect git to work if you give it the empty string for a branch name!Acetometer
Don't know if alex is still watching this, but really, there's not enough information here to say much more than this (unless someone's very familiar with phpundercontrol). The most helpful way to approach debugging would probably be to get it to log the exact git commands it's executing, and trace back where it's getting the branch to give to the command (since it's giving it nothing).Acetometer
R
1

Quick fix:

The cleanest and quickest way to fix this is to set requireModification="false" on the project tag. Wait for a build to fire, then set requireModification="true" again. This will have the effect of creating a new previous build date that is within the range of your available git log changes.

Details:

This happened to me when I re-cloned my repositories within my cruisecontrol environment. This creates an issue where the local working copy of the repository's logs don't go back as far as the last build that cruisecontrol performed.

What happens is that your last build date is older than the oldest change record in your local working repository :( ouch.

This is not happening in the gitbootstrapper. Your bootstrapper is executing just fine.

See: 2010-02-04 06:07:27,496 [Thread-14061] INFO GitBootstrapper - Already up-to-date.

No errors. We're good.

The problem is being reported by Git, as executed by ProjectController when it calls "getModifications"

See:

2010-02-04 06:07:27,500 [Thread-14061] INFO ProjectController - platform Controller: build progress event: checking for modifications
2010-02-04 06:07:27,583 [Thread-14063] WARN Git - warning: Log for '' only goes back to Tue, 26 Jan 2010 13:43:11 -0500.

The code executed in the Git class is in net.sourceforge.cruisecontrol.Git.getModifications

The command executed is:

git log -p --pretty=raw @{timestamp}..@{timestamp}

for example: git log -p --pretty=raw @{1292455850}..@{1299108639}

The basic problem is the parameter being passed into the first timestamp, cruisecontrol is doing exactly what it is programmed to do, but we are asking it to check for changes between dates that our repository has no record of, if requireModification="true", then it will shut down having found no modification!

Relay answered 3/3, 2011 at 22:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.