When using an SSL enabled credential the P4_PORT variable contains the correct host and port but does not display the SSL prefix so it cannot be used. For example:
But in the job when we display P4_PORT:
(1) Setup an SSL enabled P4D server.
(2) Create a credential for the SSL server in Jenkins.
(3) Create a freestyle job that uses the credential. Add a build step that displays P4_PORT. For example on Linux:
(4) Run the job.