Page MenuHomePhabricator

java.lang.RuntimeException: Invalid Credential: 'SONAR_API_KEY'
Closed, ResolvedPublic

Description

Not sure what has changed in the JJB / Pipeline configuration, but today I get an error when +2'ing a patch: https://integration.wikimedia.org/ci/job/research-mwaddlink-pipeline-test/442/console

java.lang.RuntimeException: Invalid Credential: 'SONAR_API_KEY'. Allowed credentials: [:]
	at org.wikimedia.integration.PipelineCredentialManager.generateCredential(PipelineCredentialManager.groovy:32)
	at org.wikimedia.integration.PipelineRunner.run(PipelineRunner.groovy:492)
	at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2030)
	at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2015)
	at com.cloudbees.groovy.cps.CpsDefaultGroovyMethods.each(CpsDefaultGroovyMethods:2056)
	at org.wikimedia.integration.PipelineRunner.run(PipelineRunner.groovy:491)
	at org.wikimedia.integration.PipelineStage.run(PipelineStage.groovy:541)
	at org.wikimedia.integration.PipelineStage.closure(PipelineStage.groovy:268)
	at ___cps.transform___(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
	at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77)
	at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.constructorCall(DefaultInvoker.java:25)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:97)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
	at jdk.internal.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:107)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
	at jdk.internal.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:89)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
	at jdk.internal.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:136)
	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Finished: FAILURE

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

@jeena or @hashar do you have an idea of what may have changed in our config to cause this?

kostajh triaged this task as High priority.Mar 11 2021, 9:38 PM

The SONAR_API_KEY credential is still in the CI Jenkins.

I guess that comes from https://gerrit.wikimedia.org/r/c/integration/pipelinelib/+/668245 PipelineRunner: allowedCredentials. The job output seems to indicate no credential is allowed:

Invalid Credential: 'SONAR_API_KEY'. Allowed credentials: [:]

So I guess we are now using some kind of list (I havent looked at the above change).

Mentioned in SAL (#wikimedia-releng) [2021-03-11T22:03:41Z] <marxarelli> running tox -e jenkins-jobs -- --conf jenkins_jobs.ini update ./jjb/ trigger-research-mwaddlink-pipeline-test research-mwaddlink-pipeline-test to deploy https://gerrit.wikimedia.org/r/c/integration/config/+/668199 for select jobs (T277236)

Mentioned in SAL (#wikimedia-releng) [2021-03-11T22:10:40Z] <marxarelli> running tox -e jenkins-jobs -- --conf jenkins_jobs.ini update ./jjb/ trigger-research-mwaddlink-pipeline-test research-mwaddlink-pipeline-test to revert https://gerrit.wikimedia.org/r/c/integration/config/+/668199 for select jobs (T277236)

We hadn't yet merged a patchset to integration/config that was thought to be independent. However, the yaml and groovy job definition in integration/config is what defines the global whitelist which includes SONAR_API_KEY.

Merging the patch surfaced another issue in the config patchset related to CPS serialization, Caused: java.io.NotSerializableException: groovy.json.internal.LazyMap. @jeena is on the case.

In the meantime, I've reverted the pipelinelib patch and re-ran the job https://integration.wikimedia.org/ci/job/research-mwaddlink-pipeline-test/446/console. Seems ok so far but please verify!

kostajh claimed this task.

We hadn't yet merged a patchset to integration/config that was thought to be independent. However, the yaml and groovy job definition in integration/config is what defines the global whitelist which includes SONAR_API_KEY.

Merging the patch surfaced another issue in the config patchset related to CPS serialization, Caused: java.io.NotSerializableException: groovy.json.internal.LazyMap. @jeena is on the case.

In the meantime, I've reverted the pipelinelib patch and re-ran the job https://integration.wikimedia.org/ci/job/research-mwaddlink-pipeline-test/446/console. Seems ok so far but please verify!

Success! Thanks for the quick action on this, much appreciated!

@dduvall nice! Thank you for the detailed fix up report.