1

I work with a Jenkins job that calls a downstream parameterized job, whose parameter is a JSON-format string.

Occasionally, the downstream job fails. The volume of error text is substantial, and I think the relevant content is:

Caused by: java.io.IOException: Cannot run program "git" (in directory "/home/user/workspace/MyJob@script"): error=7, Argument list too long

...which I think is telling me that the downstream job's string parameter, populated by the upstream job, is too large.
If I manually launch the job and toy with the string length I can induce job success or failure (with the above error), which I think substantiates my guess that the string parameter length is the problem.

According to this post, the maximum length of a Jenkins string parameter is not documented or publicized, possibly because it is a function of several variables that makes the answer different between instances: what's the string length limit of jenkins string parameter

Question: What are standard/recommended methods of passing long strings between Jenkins jobs?

I can imagine ad hoc solutions, such as writing my JSON content to a file at a location known to downstream jobs...or the upstream job passing the filepath as a parameter to the downstream job -- but I'd prefer to use standard/accepted solutions over ad hoc ones.

Researching the issue, I ran into stash()/unstash() in posts such as this: Pass large amount of parameters between jobs But the Jenkins Snippet Generator says stash() and unstash() are for use between stages in the same build -- which is not my use-case: I need to pass strings between jobs.

Other posts like this suggest archiveArtifacts(): Documentation on archiveArtifacts command in Jenkins -- but how do you "unarchive" an artifact? In the "Sample Step" drop-down list in my Jenkins Snippet Generator, I don't see copyArtifacts() or anything else that appears to be an analog to archiveArtifacts().

StoneThrow
  • 5,314
  • 4
  • 44
  • 86

0 Answers0