Groover, on 30 October 2019 - 01:35 PM, said:
I tried p4 changes -m1 etc and this produces output that I could parse with a custom utility, but unless I am mistaken, I can't run this command line from a custom utility because I would need to pass login credentials every 12 hours and there isn't a command line switch to specify the password. Right?
No, scripting Perforce is pretty easy.
If the command is running from the same environment where the user is submitting or working on their files, it'll just inherit their credentials (i.e. any script the user runs in their environment will just run as them, the same way it'll inherit filesystem permissions etc).
If you're running this as part of some centralized automation, the standard (reasonably secure) solution is to use a dedicated Perforce user account (historically Perforce would give you a free license to use for things like this, I'm not sure if that's still the case), and give that user an unlimited login timeout so you can just login once on that machine (which is presumably more secure than the average laptop -- the automation user can also be locked down to only have read-only access if that makes sense).
The standard INsecure solutions (which are a little easier but also aren't recommended) are:
- don't set a password on that user (this is the hilariously insecure option, only works if the server doesn't mandate passwords)
- do p4 -P PASSWORD changes -m1 (this works if you're on a server that doesn't mandate that you use login tickets)
- do echo PASSWORD|p4 login (this works on a "secure" server, but is still terrible practice from a security standpoint)
(edit: wait -- how do you even do builds in the first place if you don't have a script that has permission to sync the files from Perforce?