Jenkins Groovy - Trying to load a JDBC driver

2020-08-18 Thread Randall Becker
Can someone throw some light on this, please? I am trying to load a JDBC 
type 4 driver from the local system (no agents involved) in order to update 
a database during deployment. The classLoader.rootLoader is null in the 
Jenkins groovy container, so I'm not sure how to accomplish this. The 
pipeline is not running in a groovy sandbox - all sorts of issues came up 
when it was, like using the File object.

Thanks,
Randall

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/60009954-adf6-47ab-a7bd-10686d05e4f1o%40googlegroups.com.


Re: Trying to use Global Shared Groovy in Pipelines - ERROR: Could not find any definition of libraries [mylib]

2020-08-18 Thread Randall Becker
This was a new pipeline. I changed how the library was specified, using the 
library { lib } structure and that worked.

On Monday, 17 August 2020 17:26:48 UTC-4, Devin Nusbaum wrote:
>
> This sounds like JENKINS-60245 
> . There is a proposed 
> fix, but I have not had time to review it. 
>
> Is this something you had working previously, and it was broken by an 
> update or something, or are you just trying it for the first time?
>
> You might be able to use the `library` step instead of the `@Library` 
> annotation as a workaround for now.
>  
>
> On Aug 17, 2020, at 17:01, Randall Becker > 
> wrote:
>
> I'm having some difficulty with global shared groovy libraries in 
> pipelines (Jenkins 2.242, with Pipeline:Groovy Shared Libraries 2.16) and 
> could use a swift kick in the proper direction.
>
> I've configured a local bare git repository using it's path in the System 
> Configuration, which correctly reports the commit associated with the HEAD 
> of master. Since this is local, there are no credentials involved.
>
> The groovy script is loaded in my pipeline (not a Jenkinsfile, just a 
> simple project), as follows - from a file outside the workspace, which is 
> not yet populated at the load step:
>
> stage('load') {
> steps {
> script {
> modules.first = load 
> pwd()+'/../../OtherJob/workspace/publisher.groovy'
> }
> }
> }
>
> The load works and I can execute simple things, but when trying to 
> reference the library I get the error that
> ERROR: Could not find any definition of libraries [mylib],
>
> The first line of the publisher.groovy script is:
> @Library('mylib') _
>
> And the exception thrown is below (there is more, obviously). Nothing in 
> the jenkins log, this is from the build console
>
> org.jenkinsci.plugins.workflow.cps.CpsCompilationErrorsException: startup 
> failed:
> Script1.groovy: Loading libraries failed
>
> 1 error
>
>   at 
> org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
>   at 
> org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
>   at 
> org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
>   at 
> org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
>   at 
> org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
>   at 
> groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
>   at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
>   at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
>   at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
> ...
>
> I really want to share code (not variables) as I have about 30 pipelines 
> that need my groovy classes. Obviously I'm doing something wrong, but the 
> diagnostics are not providing a nice hint to help me out with resolving 
> this. Any suggestions?
>
> Thanks in advance,
> Randall
>
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkins...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/f5350044-b8b1-4e3e-b613-36bb9eade86ao%40googlegroups.com
>  
> 
> .
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2a941b57-aafa-4443-98a8-189f048d8738o%40googlegroups.com.


Re: "Added a missed class for missing class telemetry"

2020-08-18 Thread fakemai...@gmail.com
I just want to not see these warnings without having to filter out all 
other warning output

In my build.gradle I have to set *events 'standard_out'* because if I do 
*showStandardStreams 
true*  to see everything these warnings make the output literally 
unreadable 

This makes it hard to use the test harness and see useful error/warning 
messages for my actual scripts
On Thursday, August 13, 2020 at 5:39:24 AM UTC-4 bma...@gmail.com wrote:

> Looks like more a question for the dev list?
> What are you trying to do more precisely?
>
>
> Le ven. 17 juil. 2020 à 17:40, red 888  a écrit :
>
>> Im trying to run the test harness and im seeing a ton of these warnings
>>
>> This says resolved but Im seeing it 
>> on "org.jenkins-ci.main:jenkins-war:2.235"
>> https://issues.jenkins-ci.org/browse/JENKINS-60725
>>
>> # build.gradle
>> apply plugin: 'groovy'
>>
>>
>> ext {
>>
>> jobDslVersion = '1.77'
>> }
>>
>>
>> sourceSets {
>> jobs {
>> groovy {
>> srcDirs 'jobs'
>> compileClasspath += main.compileClasspath
>> }
>> compileClasspath += sourceSets.main.output
>> runtimeClasspath += sourceSets.main.output
>> }
>> }
>>
>>
>> repositories {
>> maven {
>> url 'https://repo.jenkins-ci.org/public/'
>> }
>> jcenter()
>> }
>>
>>
>> configurations {
>> testPlugins {}
>>
>>
>> testCompile {
>> exclude group: 'xalan'
>> exclude group: 'xerces'
>> }
>> }
>>
>>
>> dependencies {
>> compile "org.apache.ivy:ivy:2.5.0"
>> testCompile "org.spockframework:spock-core:1.3-groovy-2.4"
>>
>>
>> // Jenkins Test Harness
>> testCompile "org.jenkins-ci.main:jenkins-test-harness:2.64"
>> testCompile "org.jenkins-ci.main:jenkins-war:2.235"
>>
>>
>> // Job DSL plugin including dependencies
>> compile "org.jenkins-ci.plugins:job-dsl-core:${jobDslVersion}"
>> testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}"
>> testCompile "org.jenkins-ci.plugins:job-dsl:${jobDslVersion}@jar"
>> testCompile "org.jenkins-ci.plugins:structs:1.20@jar"
>> testCompile "org.jenkins-ci.plugins:script-security:1.73@jar"
>>
>>
>> // Jenkins plugins to install
>> testPlugins "org.jenkins-ci.plugins:ghprb:1.31.4"
>> testPlugins "com.coravy.hudson.plugins.github:github:1.19.0"
>> }
>>
>>
>> task resolveTestPlugins(type: Copy) {
>> from configurations.testPlugins
>> into new File(sourceSets.test.output.resourcesDir, 
>> 'test-dependencies')
>> include "*.hpi"
>> include "*.jpi"
>>
>>
>> doLast {
>> def baseNames = source.collect { it.name[0..it.name.lastIndexOf(
>> '.')-1] }
>> new File(destinationDir, 'index').setText(baseNames.join("\n"), 
>> "UTF-8")
>> }
>> }
>>
>>
>> test {
>> dependsOn tasks.resolveTestPlugins
>> inputs.files sourceSets.jobs.groovy.srcDirs
>>
>>
>> // set build directory for Jenkins test harness
>> systemProperty 'buildDirectory', project.buildDir.absolutePath
>> }
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/c8314bd8-b3ed-4276-a540-193877f3268fo%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/0f1838a9-333a-4d96-9dc8-7ac594af0c2dn%40googlegroups.com.