jfrog / build-info

Artifactory's open integration layer for CI build servers
https://www.buildinfo.org
Apache License 2.0
147 stars 155 forks source link

Add npipe support for build-info-extractor-docker #797

Open Ru13en opened 1 month ago

Ru13en commented 1 month ago

Describe the bug On windows using windows containers is not possible to use the npipe protocol to publish docker images to the artifactory. The NettyDockerCmdExecFactory does not support the npipe protocol which has been used here: https://github.com/jfrog/build-info/blob/master/build-info-extractor-docker/src/main/java/org/jfrog/build/extractor/docker/DockerJavaWrapper.java#L77 I found this comment in the docker-java repository: https://github.com/docker-java/docker-java/issues/765#issuecomment-588942835 So I suggest the replacement from NettyDockerCmdExecFactory to OkHttpDockerCmdExecFactory in order to support npipe.

To Reproduce Configure windows docker engine to use windows containers. Configure a Jenkins instance with docker clouds. Add the following mount to the docker cloud template (exposes the host docker engine to the ephemeral container): type=npipe,source=\.\pipe\docker_engine,destination=\.\pipe\docker_engine

Add and execute a pipeline that makes use of the Artifactory.docker (see example in the first screenshot).

Expected behavior At red is the affected code leading to the exception shown in the second screenshot. If we just use the docker-plugin from jenkins there is no issues.

Screenshots image image

Versions

Additional context Add any other context about the problem here.

displaylink-kstrzemp commented 1 month ago

Hello! I've just encountered this issue today when trying to push docker image to artifactory from windows machine. My jenkinsfile snippet:

   // Capture build environment
    rtBuildInfo (
        captureEnv: true,
        buildName: "${BUILD_INFO_NAME}"
    )

    // Deploy the 'latest' image
    rtDockerPush(
        serverId: 'Artifactory',
        image: "${IMAGE_PATH}:${BARE_IMAGE_TAG}",
        targetRepo: DOCKER_REPO,
        buildName: "${BUILD_INFO_NAME}"
    )

Is this going to be fixed? Would jfrog-cli work better?

eyalbe4 commented 1 month ago

@Ru13en, For integrating Jenkins with the JFrog Platform, our recommendation is to avoid using the old Artifactory Jenkins Plugin, and use the newer JFrog Jenkins Plugin whenever it is possible. The older plugin, because of its design, introduces multiple issues, especially when it comes to the integration with docker. We will therefore refrain from making new investments in the Artifactory Jenkins Plugin.

displaylink-kstrzemp commented 1 month ago

Yes - I can confirm that jfrog-cli way works OK in my case