Niraj Nandane
Niraj Nandane

Reputation: 1468

p4 password unset or invalid in jenkins

the p4 commands that we execute in execute shell as a build step are saying invalid or unset P4PASSWD.

This is because perforce gives 12 hrs of access to one login using p4 ticket.

How you are managing this invalid or unset P4PASSWD error ,that always come after 12 hrs

Upvotes: 1

Views: 4308

Answers (3)

Br.Bill
Br.Bill

Reputation: 691

An insecure method is to set P4PASSWD in the environment that the process is running in. It's insecure because your password could easily be compromised.

I know three possible ways to do this:

  • Setting environment variable P4PASSWD to the password value.
  • Set the P4PASSWD value with p4 set command (Windows Only).
  • Set P4CONFIG filename and declare P4PASSWD value in a P4CONFIG file.

I don't recommend these insecure options, but for full disclosure, they do work.

References:

Upvotes: -1

Bruno Lavit
Bruno Lavit

Reputation: 10382

I confirm you need to use a dedicated P4 user for your build system with unlimited timeout.

If you create a new build user, on your build machine: open a P4 session with your build user (with P4V or the CLI).

It will generate an unlimited access token in your p4ticket.txt file.

Next, your Jenkins jobs will stop having this timeout issue.

Upvotes: 0

Samwise
Samwise

Reputation: 71562

The duration of a login ticket is configurable, as is the requirement of using login tickets as opposed to plaintext passwords:

http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.superuser.html#DB5-21975

Putting the user that runs the automated task in a group with an unlimited timeout is generally the simplest and most secure solution that doesn't involve having a human operator periodically re-authenticate.

Upvotes: 2

Related Questions