We are using Jenkins with Pipeline Multibranch Plugin, Docker Pipeline Plugin, Credentials Plugin and Artifactory Plugin.
Our builds are running inside plain Docker JNLP slaves. The Docker daemon sockets used in our Jenkins Docker cloud are TLS secured (–tlsverify set) so we have configured Docker client credentials in Jenkins.
When building Docker images with scripted pipeline we are using Docker Pipeline Plugin to set Docker Host and credentials:
This works fine for building images but not for pushing or pulling images to/from Artifactory with Artifactory Plugin.
never uses the Docker credentials set by Docker Pipeline Plugin. Instead Artifactory tries to connect to env.DOCKER_HOST without TLS. Since there is no credential parameter for Artifactory.docker I am looking for a way to configure Artifactory Plugin for TLS with Docker.
What I found from looking at the code:
The underlying docker-java supports system environment, system properties, property file and programmatic configuration for setting TLS client credentials. Since we are using plain Jenkins Docker JNLP clients there seems to be no way to set system environment or system properties for the JNLP client process which runs Artifactory Plugin.
As a workaround we are writing a property file to configure docker-java for TLS:
This works but is ugly and error prone. I can think of two better solutions:
1. Implement Docker Credential handling in Artifactory Plugin
2. Use Docker Credentials from Jenkins EnvVars set by Docker Pipeline Plugin
It would be nice if you could take a look into this. I tried with support but had problems to explain what our problem is.
I have a working implementation of 2. It's evaluates Jenkins EnvVars and only sets docker-java DefaultDockerClientConfig TLS options if DOCKER_CERT_PATH and DOCKER_TLS_VERIFY are found. There is no additional plugin dependency. I could open a PR for this.