Isuru H
Isuru H

Reputation: 1221

Getting the perforce changelist for multiple projects through Jenkins

Apologies in advance for my Jenkins knowledge, started using it recently.

I have multiple projects under the same depot. Therefore I've only got one perforce mapping in the Jenkins. I want to get the latest changelist number for each project. The environmental variable P4_CHANGELIST only lists the latest for the whole depot. Therefore I tried to invoke a post build CMD process for each project to query the changelist number

p4 changes -m1 //path/to/project1 
p4 changes -m1 //path/to/project2

Then Jenkins trigger an error Connect to server failed; check $P4PORT. But the command works in my machine. Any help is much appreciated.

Upvotes: 0

Views: 571

Answers (1)

Isuru H
Isuru H

Reputation: 1221

Thanks All, still couldn't get to work. So this is my solution.

Instead if mapping the parent directory of multiple projects and building them all, I created multiple Jenkins projects with a single mapping in each. In this way each Jenkins project has the final changelist of perforce project (in the environmental variable P4_CHANGELIST). Thereafter I created a pipeline project at use a simple Groovy scripts to build all my projects. Now I have all the latest changelists of all the projects. I know its naive, but got my job done.

Upvotes: 0

Related Questions