Var
Var

Reputation: 329

Unable to sync source code using the perforce plugin for Jenkins

I am trying to sync my source code from perforce, using the perforce plugin of Jenkins and it fails, here is the console output:

Started by user anonymous
Building in workspace /home/var/.jenkins/jobs/Perforce-Test/workspace
Using master perforce client: Perforce-Test
[workspace] $ /usr/bin/p4 workspace -o Perforce-Test
[workspace] $ /usr/bin/p4 login -a -p
[workspace] $ /usr/bin/p4 -P 5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9 workspace -o Perforce-Test
Changing P4 Client View from:
//depot/perf/main/solution/... //Perforce-Test/perf/main/solution/...

Changing P4 Client View to: 
  //depot/perf/main/solution/Main-Code/... //Perforce-Test/perf/main/solution/Main-Code/...
Saving modified client Perforce-Test
[workspace] $ /usr/bin/p4 -P 5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9 -s client -i
Last build changeset: 0
[workspace] $ /usr/bin/p4 -P 5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9 changes -s submitted -m 1 //Perforce-Test/...
Failed to get last submitted changeset in the view, falling back to change counter. Error was: No output for: /usr/bin/p4 -P 5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9 changes -s submitted -m 1 //Perforce-Test/... 
[workspace] $ /usr/bin/p4 -P 5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9 counter change
[workspace] $ /usr/bin/p4 -P 5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9 -s changes -s submitted //Perforce-Test/...@3691614,@3691663
Sync'ing workspace to changelist 3691663 (forcing sync of unchanged files).
[workspace] $ /usr/bin/p4 -P 5XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9 -s sync -f //Perforce-Test/...@3691663
Caught exception communicating with perforce. Errors encountered while force syncing: error: //Perforce-Test/...@3691663 - protected namespace - access denied.
com.tek42.perforce.PerforceException: Errors encountered while force syncing: error: //Perforce-Test/...@3691663 - protected namespace - access denied.

    at com.tek42.perforce.parse.Workspaces.syncTo(Workspaces.java:167)
    at hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:1126)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1270)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:609)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:531)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)
ERROR: Unable to communicate with perforce. Errors encountered while force syncing: error: //Perforce-Test/...@3691663 - protected namespace - access denied.

Finished: FAILURE

I have attached the screen shot of my job. Could anybody let me know what might be the problem? Is it a problem with my user? When i try to create a new workspace and sync the latest code using the perforce view client, with the same user, it works fine.

Perforce Job Screen Shot

Upvotes: 1

Views: 2905

Answers (1)

Samwise
Samwise

Reputation: 71464

The error message:

//Perforce-Test/...@3691663 - protected namespace - access denied.

indicates that you do not have permission to the files that you are trying to sync. If the username you're using is "anonymous" as the output suggests, check the protection table to see whether that user has permission to the files you're trying to sync (and if there are IP-based protections, check them against the build machine's IP).

If you're not sure which Perforce username this job is running as, a quick way to test might be to delete the "Perforce-Test" client, since it looks like the plugin will recreate it (at which point the username will show up in the Owner field of the client). You could also check the Perforce server's log to see which user was running those commands.

Upvotes: 1

Related Questions