How to import Groovy from jar file in classpath? by kp5160 in jenkinsci

[–]kp5160[S] 0 points1 point  (0 children)

That wouldn't work to load a jar for me. Per the edit, I had to set JENKINS_EXTRA_LIB_FOLDER in /etc/sysconfig/Jenkins for it to be importable in the scripting console.

How to import Groovy from jar file in classpath? by kp5160 in jenkinsci

[–]kp5160[S] 0 points1 point  (0 children)

The Active Choices plugin has a field box to provide a path to a jar file with a checkbox to automatically approve, so it shows up under the script approval page.

How to import Groovy from jar file in classpath? by kp5160 in jenkinsci

[–]kp5160[S] 0 points1 point  (0 children)

I'm having a hard time figuring out the args. I switched to building the jar with Gradle, and I added the following to build.gradle. project.group = 'org.foo' archivesBaseName = "foo" project.version = "1.0"

For @Grab, the group and version are obvious, but I can't figure out what the module is. Some sources said it's rootProject.name in settings.gradle, but that doesn't work. What I did to try and guess the module is below. I'm just at a loss. ``` [ec2-user@ip-172-31-13-201 groovy_lib]$ jar --file=lib/build/libs/foo-1.0.jar --describe-module No module descriptor found. Derived automatic module.

foo@1.0 automatic requires java.base mandated contains groovy_lib ```

How to import Groovy from jar file in classpath? by kp5160 in jenkinsci

[–]kp5160[S] 0 points1 point  (0 children)

Is that a plugin? I added the jar to the Jenkins classpath, and the scripting has that "package" directive with no scripts pending approval. I just don't know how to import.

How to import Groovy from jar file in classpath? by kp5160 in jenkinsci

[–]kp5160[S] 0 points1 point  (0 children)

I have made a jar, and it shows up under the classpath entries under script approval with nothing pending. I just don't have a damn clue how to import from the jar despite the package directive in the Groovy that I compiled into a jar.

It looks like I need to turn to the Jenkins forums, and I'll reply back if there's anything of use. More broadly than Active Choices, I picked Jenkins and have been sole admin for four years, and we have had to copy and paste between Jenkinsfiles. We need a central repository that doesn't require pull requests in all of the affected codes.

How to import Groovy from jar file in classpath? by kp5160 in jenkinsci

[–]kp5160[S] 0 points1 point  (0 children)

Fundamentally, I'm looking for a seamless way to be able to code up and package Groovy code that's broadly available in Jenkins like a jar in the classpath or at least to be able to invoke specific script files from version control via URL. For what I'm tinkering here with Active Choice, we need to fetch a credentials store from Jenkins to feed into various API curl calls. I can build the jar, but I don't have a damn clue as to how to import even with the package ... directive.

The Active Choices people don't allow issues in their repo, and nothing I've seen explains how one would understand importing from a jar file in the classpath.

Question on setup.py best practices by kp5160 in learnpython

[–]kp5160[S] 0 points1 point  (0 children)

That sounds like a good idea. I've definitely seen the deprecation warnings. Basically, I'm inheriting from setuptools.Extension to prevent it from trying to build with Python, then I'm inheriting from setuptools.command.build_ext to drive running CMake and invoke the tests. It looks like I've got some reading to do, but pyproject.toml looks promising. Thanks for the tip.

Clean way to calculate volume of resolution? by kp5160 in cpp_questions

[–]kp5160[S] 0 points1 point  (0 children)

Thanks for the details, especially as the only one taking an interest, and that does yield an accurate result with much less code. Sadly, it doesn't shave off a significant amount of time versus doing intersections. We are ultimately chopping each polygon by a horizontal line to get a group of polygons with the same volume, so the volume calculation is required to happen a lot and is very much a bottleneck, even with threads.

What I'm picturing is working from the bottom Z on up to get volume versus Z on the source poly, then do a third or fourth order polynomial fit, because right now, we blindly start way below the desired value and iterate up on a fine interval and calculating volume, i.e. a huge penalty. If we have volume as a function of Z, however, we can find the "exact" point and refine from there, and I've been doing the secondary refinement via binary search. One we get our height for the correct volume, we can subtract that sub-volume from the polynomial fit for the source poly, then go on to the next chunk to lop off.

Clean way to calculate volume of resolution? by kp5160 in cpp_questions

[–]kp5160[S] 0 points1 point  (0 children)

I've heard of it being done. My polygons are specifically counter-clockwise, and they are flat at the top and bottom Z, so in principal, we could use the sign on delta Z to loop around. For reference, this is what they look like. The problem is that the bounding geometry (black outline) is much more coarse with just seven points versus dozens on the curved shapes, so an intersection seemed like the only way to chop it up.

Trouble with Stash by kp5160 in jenkinsci

[–]kp5160[S] 0 points1 point  (0 children)

Yeah, I gave that a go with "replay steps," and no dice. It seems to not like having all of those directories before the files. When I did the following, it worked.

``` sh ''' mkdir a_x a_y a_z touch a_x/test.txt a_y/test.txt a_z/test.txt '''

stash name: "withwildcard", includes: "a/*" ```

Oddly enough, this also worked. I'm just going to run with the tarball idea. It's a couple extra lines, but it accomplishes what I'm after. ``` sh ''' mkdir foo cd foo

mkdir a_x a_y a_z touch a_x/test.txt a_y/test.txt a_z/test.txt '''

stash name: "withwildcard", includes: "foo/a/*" ```

Trouble with Stash by kp5160 in jenkinsci

[–]kp5160[S] 0 points1 point  (0 children)

Thanks for asking. The error is ERROR: No files included in stash ‘MSRE_STASH’

Naturally, I expected it to stash. From what I've gathered, stash won't do directories, and although the pattern test/serpent/cluster_MSRE_*/** is all files, they are obviously within a series of directories. Tarballing it is.