Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Help with inconsistency of repository.getHeadRevision() #4183

tomz ·

We're using quickbuild 8.39 (upgrading to 9 soon). Currently I'm seeing something really weird with the repository.getHeadRevision() and repository.takeSnapshot(). The desired result is we only wish to perform a build if at least one of two perforce locations have changes. We initially had "if(codeRepo.isChanged() || dataRepo.isChanged()) return true;" in the Build Condition script but this never seemed to work (it always returned true, even when neither has changed). I've upgraded it to:
def ccl = codeRepo.getHeadRevision();
def dcl = dataRepo.getHeadRevision();
return (!archivePathExists(pathToArchive(ccl,dcl)));
Where the archive path for a build would exist on a successful build so this would tell it not to build that version again. This still isn't working because bizarrely, one of those head revisions differs from the one we get using the exact same calls on ccl/dcl inside the build step. The one inside the General Settings Build Condition is somehow newer. The only difference is that in the build step there is a takeSnapshot() call on each depot prior to getHeadRevision(). Do you have any idea what's going wrong here, and what the best solution should be for our purposes?

  • replies 4
  • views 1042
  • stars 0
robinshen ADMIN ·

Are you checking out codeRepo and dataRepo in current build? If not, please modify snapshot taking script to do the following:

... // logic to get code repo and data repo

Also make sure that codeRepo and dataRepo are checking out files to different destination paths in its repository definition.

After that the build condition below should do the work:

return codeRepo.isChanged() || dataRepo.isChanged()
tomz ·

There isn't really any good way to set the destination paths to different locations. In order for any/all build processes to work:
codeRepo has a view of
//view/codeFolder/... //source_location/codeFolder/...
//view/%%1 //source_location/%%1

and dataRepo has a view of
//view/dataFolder/... //source_location/dataFolder/...

Where source location is the same for both in order for any of the systems inside to work. Is this the cause of the logic problem? The old source code used to only use isChanged() and takeSnapshot(), which I believe is what you are suggesting, and it did not work (was always true).

tomz ·

By moving the takeSnapshot() call inside the build condition, I think it seems to work better now. The only issue is that this invalidates the SCM changes information in the trigger configuration. I believe this is the closest to best behavior we can get. Thanks for your suggestions.

robinshen ADMIN ·

Sorry I mean to specify different root directory in definition of your Perforce repositories in QB. It is not in the view.