How to use SVN post-commit hook trigger jenkins build? - jenkins

The main purpose is that I want to commit some files to SVN repository and trigger the jenkins to build some test automatically.The method I want to use is post-commit hook.
I use TortoiseSVN , and I create a repository to test.
I change the post-commit.tmpl to post-commit.bat which is in D:\Repository\hooks folder.
below is what in the post-commit.bat : (Windows 10)
SET REPOS=%1
SET REV=%2
FOR /f "tokens=*" %%a IN (
'svnlook uuid %REPOS%'
) DO (
SET UUID=%%a
)
FOR /f "tokens=*" %%b IN (
'svnlook changed --revision %REV% %REPOS%'
) DO (
SET POST=%%b
)
D:/Wget/wget ^
--header="Content-Type:text/plain;charset=UTF-8" ^
--post-data="%POST%" ^
--output-document="-" ^
--timeout=2 ^
http://localhost:8080/jenkins/subversion/%UUID%/notifyCommit?rev=%REV%
the error messages is:
post-commit hook failed (exit code 8)with output:
--2019-09-23 13:50:53--
http://localhost:8080/"realUUID"/notifyCommit?rev=7
Resolving localhost(localhost)... ::1, 127.0.0.1
Connecting to localhost(localhost)|::1|:8080... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-09-23 13:50:53 ERROR 404: Not Found
what I have done is:
1.change jenkins settings to "Allow anonymous read access"
2.cancel CSRF protection
I have no idea what is the main step that SVN communicate with Jenkins.
Please help , and thanks for your answer!

The error that you receive is HTTP 404 NOT FOUND and you need to examine your hook script for errors:
HTTP request sent, awaiting response... 404 Not Found
2019-09-23 13:50:53 ERROR 404: Not Found
Therefore, the URL that wget contacts is invalid: http://localhost:8080/jenkins/subversion/%UUID%/notifyCommit?rev=%REV%. You need to double-check the URL for typos and that the %UUID% is correct. Note that I do not see any SET for %UUID% in your hook - maybe it is the problem?

Related

Openwrt repos miss libsmpp library

RUTOS SDK (teltonika) requires the download of libsmpp34 from openwrt repositories, but none of them contain it.
Should I get it elsewhere ?
Traces below:
wget --tries=5 --timeout=20 --no-check-certificate --output-document=- https://sources.cdn.openwrt.org/libsmpp34-1.14.1.tar.xz --2022-07-04 14:38:15-- https://sources.cdn.openwrt.org/libsmpp34-1.14.1.tar.xz Resolving sources.cdn.openwrt.org (sources.cdn.openwrt.org)... 151.101.122.132, 151.101.2.132, 151.101.66.132, ... Connecting to sources.cdn.openwrt.org (sources.cdn.openwrt.org)|151.101.122.132|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2022-07-04 14:38:16 ERROR 404: Not Found.
Open /package/libs/libsmpp34/Makefile and change the line from:
PKG_SOURCE_URL=git://git.osmocom.org/libsmpp34.git
to
PKG_SOURCE_URL=https://git.osmocom.org/libsmpp34

Jenkins with Azure AD integration fails with "A problem occurred while processing the request"

There is lot of help available. Not able to fix it. After I enter my user name and password.
Jenkins with Azure AD login is successful and it return the token also. After that it fails with "A problem occurred while processing the request". Login is successful when I see the Azure side and jenkins ui prints token also.
When I see the error logs, I see
javax.net.ssl|DEBUG|13|Handling POST /securityRealm/finishLogin from x.x.x.x : Jetty (winstone)-19|2021-07-15 19:36:53.374 EDT|Utilities.java:73|the previous server name in SNI (type=host_name (0), value=login.microsoftonline.com) was replaced with (type=host_name (0), value=login.microsoftonline.com)
2021-07-15 23:36:55.398+0000 [id=326] INFO c.m.a.a.AuthenticationAuthority#doInstanceDiscovery: [Correlation ID: e11160be-50c3-43d7-96a8-dc02c3cc2b2c] Instance discovery was successful
javax.net.ssl|ERROR|13|Handling POST /securityRealm/finishLogin from x.x.x.x : Jetty (winstone)-19|2021-07-15 19:36:55.769 EDT|TransportContext.java:344|Fatal **** (CERTIFICATE_UNKNOWN): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (
"throwable" : {
Also
javax.net.ssl|DEBUG|13|Handling POST /securityRealm/finishLogin from x.x.x.x : Jetty (winstone)-19|2021-07-15 19:36:55.773 EDT|SSLSocketImpl.java:1569|close the underlying socket
javax.net.ssl|DEBUG|13|Handling POST /securityRealm/finishLogin from x.x.x.x : Jetty (winstone)-19|2021-07-15 19:36:55.773 EDT|SSLSocketImpl.java:1588|close the SSL connection (initiative)
2021-07-15 23:36:55.787+0000 [id=19] SEVERE c.m.j.azuread.AzureSecurityRealm#doFinishLogin: error
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I have imported certs for login.microsoftonline.com and portal.azure.com, my jenkins.xml has
-Djavax.net.ssl.trustStore="C:\Program Files (x86)\Jenkins\.cacerts\jssecacerts" -Djavax.net.ssl.trustStorePassword=changeit
Not sure what website it says "unable to find valid certification path to requested target"
As posted in another entry in stack overflow I'd try to debug what is happening with your trustStore with something like:
java -Djavax.net.debug=all -Djavax.net.ssl.trustStore="C:\Program Files (x86)\Jenkins\.cacerts\jssecacerts" -Djavax.net.ssl.trustStorePassword=changeit
You may want to have a look at this post

Error when queing build with sonarqube. Unauthorized

I am trying to integrate sonarqube with TFS, I created a build definition with only one step, the sonar qube integration, based on this tutorial:
https://blogs.msdn.microsoft.com/visualstudioalm/2015/08/24/build-tasks-for-sonarqube-analysis/
I know my sonarqube is already setup, because I can access it through the browser and the database is correctly setup.
However I am getting this error:
14:45:53.684 Default properties file was not found at C:\BuildAgents\DefaultBuildAgent\5\.sonarqube\bin\SonarQube.Analysis.xml
14:45:53.762 Updating build integration targets...
14:45:53.84 Fetching analysis configuration settings...
Unhandled Exception: System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadString(Uri address)
at System.Net.WebClient.DownloadString(String address)
at SonarQube.TeamBuild.PreProcessor.WebClientDownloader.Download(String url)
at SonarQube.TeamBuild.PreProcessor.SonarWebService.GetProperties(String projectKey, String projectBranch)
at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, AnalyzerSettings& analyzerSettings)
at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs args)
at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.Execute(String[] args)
at SonarQube.TeamBuild.PreProcessor.Program.Main(String[] args)
Pre-processing succeeded.
Unexpected exit code received from batch file: 255
******************************************************************************
Finishing task: SonarQubePreBuild
******************************************************************************
Task SonarQubePreBuild failed. This caused the job to fail. Look at the logs for the task for more details.
******************************************************************************
Finishing Build
******************************************************************************
Worker Worker-28c6fdb7-9350-4b65-bbba-0e9aab5e0e83 finished running job 28c6fdb7-9350-4b65-bbba-0e9aab5e0e83
You need to specify the authentication token in the SonarQube service endpoint in TFS: click!
To obtain a user token in SonarQube follow these steps
Be sure the sonar.login and sonar.password properties in SonarQube.Analysis.xml are commented out, otherwise the token won't be used.

Crucible after restore fails in Jira

I install and user Crucible+FishEye on http://mydomen:8060
work several month - all works, integration with jira was worked.
I create http://crucible.mydomain (in other physic server) - with nginx proxy on localhost:8060, install Crucible+FishEye and restore from backup.
And now i get erro in jira tasks Source and Rewiev tab:
This list of reviews may be incomplete, as errors occurred retrieving data from the following repositories:
Request to http://mydomen:8060/ failed: Error in remote call to 'mydomen' (http://crucible1.mydomen) [AbstractRestCommand{path='rest-service/search-v1/reviews', params={maxReturn=50, term=XM-911}, methodType=GET}] : Received status code 404 (Not Found)
Request to http://crucible.mydomain/ failed: Error in remote call to 'Crucible+FishEye' (http://mydomen:8060) [AbstractRestCommand{path='rest-service/search-v1/reviews', params={maxReturn=50, term=XM-911}, methodType=GET}] : The host did not accept the connection within timeout of 10000 ms
Why it try connected on http://mydomen:8060 ??
In my Crucible > Administration > Global settings > Server > HTTP Bind=crucible.mydomain
I found solution: I need recreate Application links in http://jira.mydomen/plugins/servlet/applinks/listApplicationLinks

Jenkins-Testlink integration - HTTP server returned unexpected status: Found

I’m trying to connect Jenkins (1.482) with TestLink (1.9.4) thru Jenkins configuration in order to retrieve tests, but while running the job in Jenkins I get the below error in the console log.
Please note that Jenkins is hosted on tomcat (linux) on network“gnb” and Testlink is hosted on php (linux) on another network “<company network name>”. It works well when both are on my localhost (in windows)
but this integration does not work when both Jenkins and TestLink are on separate networks/hosts.
I get the below error on the console while running the job:
Preparing TestLink client API.
Using TestLink URL: http://<hostname>/mr61_php5/testlink/lib/api/xmlrpc.php
FATAL: Error verifying developer key: HTTP server returned unexpected status: Found
br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException: Error verifying developer key: HTTP server returned unexpected status: Found
at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:66)
at br.eti.kinoshita.testlinkjavaapi.TestLinkAPI.(TestLinkAPI.java:162)
at hudson.plugins.testlink.TestLinkBuilder.getTestLinkSite(TestLinkBuilder.java:244)
at hudson.plugins.testlink.TestLinkBuilder.perform(TestLinkBuilder.java:134)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:717)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
at hudson.model.Run.execute(Run.java:1502)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: org.apache.xmlrpc.client.XmlRpcHttpTransportException: HTTP server returned unexpected status: Found
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.getInputStream(XmlRpcSunHttpTransport.java:94)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:152)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)
at br.eti.kinoshita.testlinkjavaapi.BaseService.executeXmlRpcCall(BaseService.java:90)
at br.eti.kinoshita.testlinkjavaapi.MiscService.checkDevKey(MiscService.java:62)
... 12 more
ERROR: Error communicating with TestLink. Check your TestLink configuration.
I have below settings in my Jenkins’s global configuration for Testlink installation
Name: testlink
URL: http://<host name>/mr61_php5/testlink/lib/api/xmlrpc.php
Developer key: generated from Testlink (Settings->Generate a new key)
Can you please point me if I miss something?
Usually in the Testlink folder structure, the path that you have mentioned, does not contain the xmlrpc.php file
Probabaly worng URL: URL: http:///mr61_php5/testlink/lib/api/
The correct URL is usually of this format
.../testlink/lib/api/xmlrpc//xmlrpc.php
Kindly check the correct URL, or try opening the xmlrpc.php page, so that you can get the correct path of the file. As per my assumption it should be somewhat like this:
http:///mr61_php5/testlink/lib/api/xmlrpc/xmlrpc.php
Good answer In my case it is as below...
http://IP:PORT/testlink/lib/api/xmlrpc/v1/xmlrpc.php in 1.9.11 version of testlink

Resources