General Discussion

General discussion on using Go including questions and tips

This is a public Discussion Area  publicRSS

Post

    toby
    Getting the perforce changelist number
    Post posted February 10, 2009 by toby
    5015 Views, 4 Comment
    Topic:
    Getting the perforce changelist number
    Body:
    hello everybody I know that perforce changelist numbers are going to be part of the 2.0 release but this problem is blocking us and we can’t wait. I can issue the following command on the agent, in the folder that the pipeline is check out to.p4 -ubuild cruise-centctvm1.caplin.com-RichCCTBUILD4-cMhKOYLi65OoYmvmNOnGoxvyOd0 changes -m 1 //DHTML/...#have and it will return me the changelist. I can then parse this out and post it back using a little script. The problem is that i don’t know what the perforce client is. It is listed in the perforce client list and i do have the option of listing all known p4 clients and attempting to single out the one i want. but i don’t like the sound of that. The client must be stored somewhere?Any ideas on how i can get my hands on the client? I am guessing its in the database, thats my next port of call. thanks

    Comment

    • toby
      posted February 11, 2009 by toby

      a bit hacky but managed to get changelist number from the console log on the server

      url = ‘http://’config[‘cruiseserverurl’]’/cruise/files/’config[‘pipeline’]’/’config[‘pipelinecounter’]’/installer/LATEST/makeInstaller/cruise-output/console.log’
      f = urllib.urlopen(url)
      consoleLog = f.read()

    • Qiao Liang 乔梁
      posted February 11, 2009 by Qiao Liang 乔梁

      Hey Toby,

      Currently p4 client name generated with RandomString(a Hash) on agent side. The general format of the client name is :
      <snap>
      cruise-${agent-hostname}- ${workingFolder-name} -${RandomString}.
      </snap>
      So you can say it is hard to get in client side by now.

      Qiao Liang

    • toby
      posted February 11, 2009 by toby

      the agent reuses the same client each time it build a job, so the client string must be stored on the agent somewhere, right?

    • fauna5
      posted February 11, 2009 by fauna5

      Qiao,

      So is it possible to access the current perforce revision number in a job with the current version? Both cruisecontrol and our other CI tool inject this as an ant property when running the build.

      I understand it is a feature request for 2.0 to have the build number to be able to name the cruise build number as a preforce number, but in the meantime all we need to do is access the number in our ant script. This is because our products are released as ${product.name}${major.minor.patch}${perforce revision numer}.tar.gz.

      Thanks,

      Richard