I am searching for a best practice for switching svn repo paths from many jenkins jobs at once.
We have many different jobs which all define an svn path and poll our svn repo every 5 minutes.
Normally we build all projects from their trunks (subversion plugin 2.7.1).
But sometimes for bugfix reasons we want to be able to build all or certain projects from predefined tags or branches.
This switch should be made on a global job level not in the actual jobs themselves.
I have defined a job which lists all svn paths for our projects (using List Subversion tags plugin).
When the job gets fired every selected path gets written into a properties file with a key-value pair like "SVN_Projectname=tags/TAGNAME".
When no subversion tag is selected for a project the default vaule "SVN_Projectname=trunk" is written to the file for that project.
This is running without any issues...
I created a test job with a textparameter called "SVN_Projectname" and used the envInject plugin option "Prepare an environment for the run" with "Override Build Parameters" to read the already existent properties file.
Also the subversion plugin is provided with the parameter "${SVN_Projectname}" for the read parameter value from file.
Additional credentials (realm and credentials) are also provided and polling is activated for that job too.
Running that job manually is no problem, but the actual value from the file is generating polling results of the following error (scm-polling.log):
Started on 11.10.2017 14:53:00
Received SCM poll call on master for XXX_TAG on 11.10.2017 14:53:00
ERROR: Failed to check repository revision for http://XXX/svn/repository_XXX/Project/tags/tagname
[8mha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWhSE4tKMnjz/PLL0ldFVf2c+b/lb8MDAwVRQxSaBqxXTRIIQMEMIIUFgAAckCEiWAAAAA=[0morg.tmatesoft.svn.core.SVNCancelException: svn: E200015: E200015: ISVNAuthentication provider did not provide credentials; HTTP authorization cancelled.
svn: E200015: ISVNAuthentication provider did not provide credentials; HTTP authorization cancelled.
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:66)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:57)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:798)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:391)
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:379)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.performHttpRequest(DAVConnection.java:862)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:698)
at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:118)
at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1049)
at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.getLatestRevision(DAVRepository.java:189)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgRepositoryAccess.getRevisionNumber(SvnNgRepositoryAccess.java:119)
at org.tmatesoft.svn.core.internal.wc2.SvnRepositoryAccess.getLocations(SvnRepositoryAccess.java:195)
at org.tmatesoft.svn.core.internal.wc2.ng.SvnNgRepositoryAccess.createRepositoryFor(SvnNgRepositoryAccess.java:46)
at org.tmatesoft.svn.core.internal.wc2.remote.SvnRemoteGetInfo.run(SvnRemoteGetInfo.java:46)
at org.tmatesoft.svn.core.internal.wc2.remote.SvnRemoteGetInfo.run(SvnRemoteGetInfo.java:31)
at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:21)
at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1235)
at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:294)
at org.tmatesoft.svn.core.wc.SVNWCClient.doInfo(SVNWCClient.java:2535)
at hudson.scm.SubversionSCM.parseSvnInfo(SubversionSCM.java:1228)
at hudson.scm.CompareAgainstBaselineCallable.call(CompareAgainstBaselineCallable.java:79)
at hudson.scm.CompareAgainstBaselineCallable.call(CompareAgainstBaselineCallable.java:27)
at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
at hudson.scm.SubversionSCM.compareRemoteRevisionWith(SubversionSCM.java:1425)
at hudson.scm.SCM.compareRemoteRevisionWith(SCM.java:391)
at hudson.scm.SCM.poll(SCM.java:408)
at hudson.model.AbstractProject._poll(AbstractProject.java:1460)
at hudson.model.AbstractProject.poll(AbstractProject.java:1363)
at jenkins.triggers.SCMTriggerItem$SCMTriggerItems$Bridge.poll(SCMTriggerItem.java:128)
at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:557)
at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:603)
at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.tmatesoft.svn.core.SVNCancelException: svn: E200015: ISVNAuthentication provider did not provide credentials; HTTP authorization cancelled.
at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:728)
... 34 more
Done. Took 0,17 sec
No changes
While i have provided all credentials to the job and starting the job manually, there is no problem. I dont understand what the actual problem is...
Or is there a better way of automating such a behavior?
Maybe manipulating the projects config.xmls with a changed svn path is a possibility?
But then jenkins service would have to be restarted? and i would prefer to make the change on the fly ^^
Related
I am trying to get my Jenkins publish files over ssh. I use pipeline scripts, that is because I have to use the ssh agent. But I am not able to configure it correctly, it is always throwing an exception. This is what I did so far for debugging:
I configured ssh credentials on the "Publish over SSH" part in global settings and as credentials (SSH Username with private key).
I use a file on the master without passphrase.
I created a freestyle job and configured the "Publish SSH"-Plugin to make an "ls" on the remote machine. This works.
I checked the box to use "ssh agent", but this leads to an exception:
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent] Java/JNR ssh-agent
[ssh-agent] Skipped registering BouncyCastle, not running on a remote agent
[ssh-agent] Started.
[ssh-agent] Unable to read key: Unable to create OpenSSL PBDKF: Could not generate secret key
org.bouncycastle.openssl.PEMException: Unable to create OpenSSL PBDKF: Could not generate secret key
at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
at org.bouncycastle.openssl.jcajce.PEMUtilities.getKey(Unknown Source)
at org.bouncycastle.openssl.jcajce.PEMUtilities.crypt(Unknown Source)
at org.bouncycastle.openssl.jcajce.JcePEMDecryptorProviderBuilder$1$1.decrypt(Unknown Source)
at org.bouncycastle.openssl.PEMEncryptedKeyPair.decryptKeyPair(Unknown Source)
at jenkins.bouncycastle.api.PEMEncodable.decode(PEMEncodable.java:162)
at com.cloudbees.jenkins.plugins.sshagent.jna.JNRRemoteAgent.addIdentity(JNRRemoteAgent.java:79)
at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper$SSHAgentEnvironment.add(SSHAgentBuildWrapper.java:395)
at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.preCheckout(SSHAgentBuildWrapper.java:229)
at jenkins.scm.SCMCheckoutStrategy.preCheckout(SCMCheckoutStrategy.java:76)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:528)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: java.security.spec.InvalidKeySpecException: Could not generate secret key
at javax.crypto.SecretKeyFactory.generateSecret(SecretKeyFactory.java:347)
... 15 more
Caused by: java.lang.IllegalArgumentException: password empty
at org.bouncycastle.jcajce.provider.symmetric.OpenSSLPBKDF$PBKDF.engineGenerateSecret(Unknown Source)
at javax.crypto.SecretKeyFactory.generateSecret(SecretKeyFactory.java:336)
... 15 more
I tried to type some dummy passphrase, this leads to a different exception (something with "check your credentials").
I tried to set the path for the key file to something different, this leads to a third exception (Like FileNotFound)
There is no difference between running on master or slave.
The error message "password empty" looks as if the empty passphrase makes problems - but the "publish over ssh" plugin has no problems with it, so I think it should be ok like this.
I have no idea what else I could check. I am near to create a freestyle job with "publish over ssh" which is triggered by my pipeline job... but seriously this is not the way it should be done?...
I am trying to trigger builds automatically when a commit is made using the BitBucket plugin. I seem to have things setup correctly with the Web Hook and checking the box in the project to "Build when a change is pushed to BitBucket".
When I commit, I am seeing a message in the BitBucket Hook Log showing the last built revision and then it shows a command > git.exe ls-remote -h {repo} # timeout=10. In the system log, it shows "Triggering BitBucket job {JobName}". However, the build never starts. After about 10 minutes, the following error gets logged in the BitBucket Hook Log:
ERROR: Timeout after 10 minutes
ERROR: Failed to join a process
org.jvnet.winp.WinpException: Failed to read environment variable table error=299 at .\envvar-cmdline.cpp:201
at org.jvnet.winp.Native.getCmdLineAndEnvVars(Native Method)
at org.jvnet.winp.WinProcess.parseCmdLineAndEnvVars(WinProcess.java:126)
at org.jvnet.winp.WinProcess.getCommandLine(WinProcess.java:102)
at hudson.util.ProcessTree$Windows$1.getArguments(ProcessTree.java:441)
at hudson.plugins.msbuild.MsBuildKillingVeto.vetoProcessKilling(MsBuildKillingVeto.java:55)
at hudson.util.ProcessTree$OSProcess.getVeto(ProcessTree.java:239)
at hudson.util.ProcessTree$Windows$1.killRecursively(ProcessTree.java:422)
at hudson.util.ProcessTree.killAll(ProcessTree.java:142)
at hudson.Proc$LocalProc.destroy(Proc.java:375)
at hudson.Proc$LocalProc.kill(Proc.java:367)
at hudson.Proc$1.run(Proc.java:157)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I was able to fix this by changing the git credentials from the job from None to actually specifying credentials rather than just using default for the Jenkins user. I think this may have something to do with the call to git from the BitBucket Hook is running on a different thread as the job would and for some reason needs the specific credentials to use.
In the ssh-agent credentials section of my jenkins job, I have two options:
Specific credentials
Parameter expression
My job works fine when I select Specific credentials, but when I choose Parameter expression, and fill in the value as ${CREDENTIAL_ID}, and run my job with parameter CREDENTIAL_ID=<hex id of credential>, the job dies with this trace:
[WS-CLEANUP] Deleting project workspace...
[WS-CLEANUP] Done
FATAL:
java.io.IOException: [ssh-agent] Could not find specified credentials
at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.preCheckout(SSHAgentBuildWrapper.java:204)
at jenkins.scm.SCMCheckoutStrategy.preCheckout(SCMCheckoutStrategy.java:76)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:528)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
FATAL: [ssh-agent] Could not find specified credentials
java.io.IOException: [ssh-agent] Could not find specified credentials
at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.preCheckout(SSHAgentBuildWrapper.java:204)
at jenkins.scm.SCMCheckoutStrategy.preCheckout(SCMCheckoutStrategy.java:76)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:528)
at hudson.model.Run.execute(Run.java:1738)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE
Any idea what might be going on? I'm running Jenkins ver. 1.654, Credentials Binding Plugin 1.6, SSH credentials plugin 1.11, and SSH agent plugin 1.9
I was trying to achieve the same thing, using a String Parameter with the credential ID (the hex value, just like you posted in your problem's description).
The issue is that it seems that the Parameter Expression expects you to use a Credential Parameter instead of a String Parameter.
Although it's not exactly how you wanted to use it (you'll have to choose the key from a dropdown list when you trigger a build), changing the parameter type may be a suitable solution for you.
I am using Jenkins to run jobs and want to create/update tickets in JIRA, whenever build fails. I have downloaded JIRA plugin, Jira Issue Updater, JiraTestResultReporter plugins and configured URL and credentials, under Manage Jenkins/Configure System.
In the job am running, under Post-build Actions, I added 'Create Jira Issue' with project key, assignee name etc and 'Jira Test Result Reporter' with all required credentials.
I get the following error in the console:
ERROR: Publisher 'Jira Test Result Reporter' aborted due to exception:
java.lang.NoSuchMethodError: hudson.model.AbstractBuild.getTestResultAction()Lhudson/tasks/test/AbstractTestResultAction;
at JiraTestResultReporter.JiraReporter.perform(JiraReporter.java:105)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:726)
at hudson.model.Build$BuildExecution.post2(Build.java:185)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:671)
at hudson.model.Run.execute(Run.java:1769)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
Finished: FAILURE
Any idea whats going wrong? Is it not able to find the project? I have access to create ticket in the project specified, in jira.
It is generally possible to create tickets in JIRA programmatically, for example via their REST API.
Regarding your error, this behavior was introduced when the method signature of getTestResultAction() changed to return an Action instead of an AbstractTestResultAction.
The effect on the JiraTestResultReporter plugin is a known issue and is tracked at JENKINS-25140.
The error was fixed in the source of the plugin a while ago, but is still pending a release.
Solution:
As a workaround, Daniel Beck suggests to build and install a snapshot of the current JiraTestResultReporter plugin which seems to solve this particular error (see comments to the Jenkins ticket mentioned above).
My question is somewhat continuation of Cloudbees jenkins does not trigger jobs on promotion. To recap: I am using jenking on cloudbees. I have a job named "package" with a couple of promotion processes. The first promotion process "promote to e2etesting" is configured as: promote after job named "testing" is successfully run. "Testing" is configured as downstream job of "package" job (build other project of post build action section). This promotion works nicely and as soon as "promote to e2etesting" is performed a new job named "e2e-testing" is fired.
My "package" job has other promotion processes, one of them being named "promotion-to-staging" with criteria being : "when the following downstream projects build successfully: e2e-testing". Unfortunately after successful completion of "e2e-testing" (triggered by "promote to e2etesting"), "promotion-to-staging" does not happen.
On "e2e-testing" job console output i can see:
WARNING: package appears to use this job as a promotion criteria, but no fingerprint is
recorded. Fingerprint needs to be enabled on both this job and package.
See http://hudson.gotdns.com/wiki/display/HUDSON/Fingerprint for more details
I have no idea if the warning is related to my problem but on the other side it is weird since i have "record fingerprint of files ..." enabled for "e2e-testing job", and "package" job (being maven job) seems to have it enabled out-of-box - as i click on "passport icon" on artifact built by "package" job i can see it utilization among other jobs.
In jenkins logs i can see:
SEVERE: I/O error in channel s-74638b6e
java.io.IOException: Unexpected termination of the channel at
hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at hudson.remoting.Command.readFrom(Command.java:92)
at hudson.remoting.ClassicCommandTransport.read(ClassicCommandTransport.java:59)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)
May 24, 2013 3:43:31 AM hudson.model.Run execute
INFO: e2e-testing #10 main build action completed: SUCCESS
May 24, 2013 3:43:19 AM hudson.slaves.WorkspaceList log
FINE: Executor #0 for s-74638b6e : executing e2e-testing #10 acquired /scratch/jenkins/workspace/e2e-testing
May 24, 2013 3:43:14 AM hudson.model.Run execute
INFO: package » promotion » promotion-to-e2e-testing #10 main build action completed: SUCCESS
Any idea?
e2e-testing need not be a configured downstream job of package (i.e. kicked off directly as a post-build action), but there need to be a downstream relationship between the builds as identified by fingerprints. In other words, some (successful) build of e2e-testing must record a fingerprint of an input artifact which matches the fingerprint of an artifact produced by some build of package. When that happens, promotion-to-staging should be triggered on that build of package.
Given the warning message you saw, I suspect that e2e-testing either does not record fingerprints, or is recording fingerprints but none matching an artifact produced by package. You should be able to check this by browsing the Fingerprints link for a successful e2e-testing build, verifying that the expected artifact is listed, then clicking on details for that artifact and verifying that it is also listed as being “produced” by a package build.