skip to Main Content

Since a few days we got an error on a Jenkins Pipeline when we want to upload a tar archive via spec to the Artifactory.
All the Maven builds with goal deploy works well and the artifacts gets deployed.
I checked the docs, logs and Stackoverflow.
At the moment I have no further ideas except asking here.

This is the error message of the console output from the Jenkins Pipeline:

[...]
[Pipeline] script
[Pipeline] {
[Pipeline] newBuildInfo
[Pipeline] artifactoryUpload
Executing command: /bin/sh -c git log --pretty=format:%s -1
[consumer_0] Deploying artifact: http://artifactory.name.de/artifactory/snapshots/dir/app-name/release-bundles/1.62.0/app-name-release-bundle-1.62.0.tar.gz
Failed to upload file
[consumer_0] An exception occurred during execution:
java.lang.RuntimeException: java.io.IOException: JFrog service failed. Received 404: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>

    at org.jfrog.build.extractor.clientConfiguration.util.spec.SpecDeploymentConsumer.consumerRun(SpecDeploymentConsumer.java:44)
    at org.jfrog.build.extractor.producerConsumer.ConsumerRunnableBase.run(ConsumerRunnableBase.java:11)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.io.IOException: JFrog service failed. Received 404: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>

    at org.jfrog.build.extractor.clientConfiguration.client.JFrogService.throwException(JFrogService.java:49)
    at org.jfrog.build.extractor.clientConfiguration.client.artifactory.services.Upload.handleUnsuccessfulResponse(Upload.java:59)
    at org.jfrog.build.extractor.clientConfiguration.client.JFrogService.execute(JFrogService.java:121)
    at org.jfrog.build.extractor.clientConfiguration.client.artifactory.services.Upload.execute(Upload.java:77)
    at org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager.upload(ArtifactoryManager.java:262)
    at org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager.upload(ArtifactoryManager.java:257)
    at org.jfrog.build.extractor.clientConfiguration.util.spec.SpecDeploymentConsumer.consumerRun(SpecDeploymentConsumer.java:39)
    ... 2 more
[...]

That’s the relevant part of the pipeline with the upload spec:

def artifactoryServer = Artifactory.server 'art1'
[...]
pipeline {
    stages {
        stage('Transfer release bundle to artifactory.') {
            steps {
                script {
                    parentArtifactId = parentPom.artifactId
                    def repository = "snapshots"
                    if(params.branchName == "master") {
                        repository = "releases";
                    }
                        
                    def uploadReleaseArchiveSpec = """{
                        "files": [ 
                            {
                                 "pattern": "release-bundle-${releaseBundleVersion}.tar.gz",
                                 "target": "${repository}/path/to/file/${parentArtifactId}/release-bundles/${parentPom.version}/"
                            }
                        ]                                                 
                    }"""
                        artifactoryServer.upload spec: uploadReleaseArchiveSpec, failNoOp: true
                }
            }    
        }
    }
}

In the router-request.log I found this:

{
    "ClientAddr": "127.0.0.1:56828",
    "DownstreamContentSize": 95,
    "DownstreamStatus": 404,
    "Duration": 2531738,
    "RequestMethod": "GET",
    "RequestPath": "/access/api/v1/users/jffe@000?expand=groups",
    "ServiceAddr": "localhost:8040",
    "StartUTC": "2022-09-08T09:39:50.224317922Z",
    "level": "info",
    "msg": "",
    "request_Uber-Trace-Id": "745779c57b007818:30fa1347695348a7:062656bb9a6ef6c9:0",
    "request_User-Agent": "JFrog Access Java Client/7.43.6 74306900  Artifactory/7.38.10 73810900",
    "time": "2022-09-08T11:39:50+02:00"
}

There is also an error message in the catalina log from Tomcat of Artifactory:

08-Sep-2022 13:52:42.392 SEVERE [http-nio-127.0.0.1-8091-Acceptor] org.apache.tomcat.util.net.Acceptor.run Socket accept failed
        java.io.IOException: Duplicate accept detected. This is a known OS bug. Please consider reporting that you are affected: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1924298
                at org.apache.tomcat.util.net.NioEndpoint.serverSocketAccept(NioEndpoint.java:548)
                at org.apache.tomcat.util.net.NioEndpoint.serverSocketAccept(NioEndpoint.java:78)
                at org.apache.tomcat.util.net.Acceptor.run(Acceptor.java:129)
                at java.base/java.lang.Thread.run(Thread.java:829)

But we are using RedHat Enterprise Linux and not Ubuntu. Otherwise there is an error.
Our environment:

Jenkins 2.346.3
Artifactory OSS 7.38.10
Jenkins Artifactory Plug-in 3.17.0 (and 3.16.2 former attempts)
RedHat Enterprise Linux 8.6

Has anybody an idea? Did I overseen something in the logs above? Where else should I look?

I saw also this post. Unfortunately without answer.

UPDATE – 2022-09-13

I found the issue:
The upload works with a directly in the Jenkins Job (via the corresponding text area) inserted Pipeline script and it doesn’t work with the same Pipeline script requested from a Git repository.
Now, it would be interesting to know why the second approach fails.

2

Answers


  1. I guess you are using your own private Jfrog? In that case, does the Jenkins machine have access to your JFrog? Can you ssh into your Jenkins machine and upload a random artifact using curl?

    This may not be the best answer, but when dealing with Jfrog, I always simply use curl within the Jenkins pipeline to upload artifacts:

    curl -u <user>:<password> -X PUT "<jfrog_url>/path/to/upload/artifact.zip" -T "pathonjenkinsartifact.zip"
    
    Login or Signup to reply.
  2. I had the same issue. The problem is Jenkins injects GIT_ environment variables when checking out Pipeline from SCM.

    I worked around the problem by resetting GIT_ environment variables.

    pipeline {
        agent {
            label("some-agent")
        }
    
        environment {
            GIT_BRANCH = ""
            GIT_COMMIT = ""
            GIT_PREVIOUS_COMMIT = ""
            GIT_PREVIOUS_SUCCESSFUL_COMMIT = ""
            GIT_URL = ""
        }
    
        stages {
            stage("Push to Artifactory") {
                steps {
                    rtUpload(
                            serverId: "your-artifactory-instance-id",
                            "buildName": "Your-Build-Name",
                            "failNoOp": true,
                            spec: """
                            {
                                "files": [
                                        {
                                            "pattern": "target/app.jar",
                                            "target": "libs-release-local/some/path/in/artifactory/app.jar"
                                        }
                                ]
                            }
                            """.stripIndent()
                    )
                    rtPublishBuildInfo(
                            serverId: "your-artifactory-instance-id",
                            "buildName": "Your-Build-Name"
                    )
                }
            }
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search