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:
[SSL_Freestyle] $ /bin/sh -xe /tmp/jenkins9008466315547409153.sh + echo P4_PORT is 10.1.3.163:1866 P4_PORT is 10.1.3.163:1866 + echo P4_CLIENT is jenkins-master-SSL_Freestyle-1 P4_CLIENT is jenkins-master-SSL_Freestyle-1 Finished: SUCCESS
Reproduction steps:
(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:
echo P4PORT is $P4_PORT
(4) Run the job.