Perforce Jenkins view mapping

2019-08-30 06:05发布

enter image description here

enter image description here I have spent quite some time on P4 Jenkins plugin but have not been able to get it to work.

My local root directory below, which is also my workspace root directory /home/abigail/p4/projects. My workspace name is admin_linux.

Please see my attacked P4 & P4 Jenkins plugins snapshots. I suspect my workspace mapping //depot/... //admin_linux/... may not be quite right.

After I try "build now" in Jenkins, I got this problem:

    Started by user gvisa
Building in workspace /var/lib/jenkins/jobs/bword/workspace
... p4 client -o admin_linux +

P4 Task: establishing connection.
... server: x.x.x.x:1666
... node: Jenkins
... p4 info +
... p4 client -o admin_linux +
... p4 client -i +
... client: admin_linux
... p4 client -o admin_linux +
... p4 counter change +
... p4 changes -m1 //admin_linux/... +
Building on Node: master
... p4 client -o admin_linux +

P4 Task: establishing connection.
... server: x.x.x.x.:1666
... node: Jenkins

P4 Task: reverting all pending and shelved revisions.
... p4 revert /var/lib/jenkins/jobs/bword/workspace/... +
... rm [abandoned files]
duration: (22ms)

P4 Task: cleaning workspace to match have list.
... p4 reconcile -w -f /var/lib/jenkins/jobs/bword/workspace/... +
duration: (66ms)

P4 Task: syncing files at change: 26
... p4 sync -q /var/lib/jenkins/jobs/bword/workspace/...@26 +
duration: (14ms)

P4 Task: saving built changes.
... p4 client -o admin_linux +
... p4 changes -m100 //admin_linux/...@25,26 +
... p4 change -o 26 +
... p4 change -o 26 +
... p4 describe -s 26 +
... p4 fixes -c26 +
... done

Parsing POMs
ERROR: No such file /var/lib/jenkins/jobs/bword/workspace/pom.xml
Perhaps you need to specify the correct POM file path in the project configuration?
Finished: FAILURE

I can see why it can't find the pom.xml, because pom.xml is ... workspace/admin_linux/bword. But how to fix this?

2条回答
我只想做你的唯一
2楼-- · 2019-08-30 06:34

Jenkins' workspace is defined by $JENKINS_HOME. By default that is /var/lib/jenkins and this is the reason why Jenkins copies stuff to that location and works there.

You can set the environment variable $JENKINS_HOME to your own workspace directory, if there are access problems on the predefined /var/lib/jenkins. However not that this is bad practice to set $JENKINS_HOME to a single project. Set it to a directory you own.

For setting environment variables read this.

查看更多
一纸荒年 Trace。
3楼-- · 2019-08-30 06:42

Looks like your workspace View mapping is incorrect.

You need to know the 'Depot Path' location of your POM (e.g. //depot/bword/pom.xml) you can find this easily enough using P4V and selecting the depot tab and browsing to the correct location.

The workspace maps the Depot paths (Left) to the Workspace path (right), so if you want all the files under //depot/bword/... to appear in the root of your workspace (//admin_linux/...) then your mapping will be:

//depot/bword/... //admin_linux/...

For more details on Workspace mappings take a look at the docs here and scroll down to 'Example 2. Setting the workspace view.'

查看更多
登录 后发表回答