stderr: fatal: Couldn't find remote ref $GERRIT_REFSPEC - jenkins

Before anyone guns me down..I have looked at all the messages that has this error but they seem to manifest from a different problem,I couldn't get any substantial information. Following are the errors I'm running into in the git polling log...
I don't have a clue regarding error #1,please provide inputs
For this,I read on other questions that $GERRIT_REFSPEC gets filled in dynamically when there is a gerrit trigger but i don't understand why I keep seeing this in the git poll log. How can I fix this ?
Error messages:
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
hudson.plugins.git.GitException: Command "/usr/bin/git fetch -t ssh://company.com:29418/platform/vendor/proprietary/mla.git $GERRIT_REFSPEC" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref $GERRIT_REFSPEC

Go to the Job's Configure page and search to check This build is parameterized box.
Then set Name to GERRIT_REFSPEC
and Default value to refs/heads/master.
It took me some time to search for how to add this string parameter mentioned in the Gerrit Trigger plugin manual. I use Jenkins 1.567 with Gerrit Trigger 2.11.1.

As of May 2016, this error may be result of fix for SECURITY-170 introduced in Jenkins 2.3 or 1.651.2.
From wiki:
In a May 2016 security advisory, a vulnerability was announced (SECURITY-170 / CVE-2016-3721) whereby attackers could potentially exploit the fact that certain Jenkins plugins allow the definition of arbitrary build parameters — which are in turn injected into the build envirionment.
The fix for this issue — which was first included in Jenkins versions 1.651.2 and Jenkins 2.3 — means that only build parameters that have been explicitly defined in a job's configuration will be available by default at build time. Any other arbitrary parameters added to a build by plugins will not be available by default.
As there are a number of plugins that rely on the behaviour in older Jenkins versions, upgrading to 1.651.2 or 2.3 means that certain build behaviours may be broken.
One of the affected plugins is the Gerrit Trigger. The issue you should watch for updates is here.
However, please note that the Rado's solution to definine the GERRIT_REFSPEC parameter manually in build config can solve this problem temporarily if you build only one branch from Gerrit.
A workaround is available by adding the following JAVA_ARGS to /etc/default/jenkins on ubuntu
JAVA_ARGS="$JAVA_ARGS -Dhudson.model.ParametersAction.keepUndefinedParameters=true"
You could also add which variables should be allowed
JAVA_ARGS="$JAVA_ARGS -Dhudson.model.ParametersAction.safeParameters=GERRIT_REFSPEC,GERRIT_BRANCH

Looks like you ran a Jenkins Gerrit Trigger build manually? The trigger page says,
Using "Build Now"
[..]
Add a String parameter called GERRIT_REFSPEC with the default value refs/heads/master
https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger

After solving this issue if Jenkins is still not pulling the latest code commit(un-merged) then, need to Add Additional Behaviours -> Strategy for choosing what to build -> Gerrit Trigger
Reference: Thanks to Fabian

Related

Update Jenkins Plugins via Artifactory

I want to update Jenkins plugin via Artifactory.
Create a remote repo named Jenkins-update
Create a local repo named jenkins-update-center
Get the update-center.json from repo Jenkins-update to local and modify the URL from 'http://updates.jenkins-ci.org/' to my own URL 'https://artifacts.xxx.com/artifactory/Jenkins-update/' in update-center.json, then put update-center.json into local repo.
#!/bin/sh
curl -L -o /tmp/update-center.json http://localhost:8081/artifactory/Jenkins-update-cache/update-center.json
sed -i 's#http://updates.jenkins-ci.org/#https://artifacts.xxx.com/artifactory/Jenkins-update/#g' /tmp/update-center.json
curl -L -uuser:pass -T /tmp/update-center.json "http://localhost:8081/artifactory/jenkins-update-center/update-center.json"
Change the default update site from 'http://updates.jenkins-ci.org/' to 'https://artifacts.xxx.com/artifactory/jenkins-update-center/update-center.json' in Jenkins
There is an error 'SHA-512 digest mismatch: expected=49a22dc23f739a76623d10128b6803f79e0489de3ded0f1d01f3dfba4557136c7f318baaf4749a7713ec4b3f56633f2ac3afc4703e87d423ede029d68f84c74d in 'update site 'default''' when I click 'check now' button.
What should I do to make Jenkins update plugins from Artifactory?
Tkx
As soon as the content of update-center.json changed you need to re-generate "signature" section of this file.
For that you need to generate your key pair (see more details in How to create a local mirror of public Jenkins update site?)
Also you may use the following proposed approach :
there is probably a better way, by having a sandbox Jenkins on a system that has access to the internet. You update the server using the UI and then you can test that updated Jenkins thoroughly. When done, you just need to copy the war and hpi files over to your 'production' Jenkins. now you have even a nice process and QA in place.
Another way is to setup a transparent https proxy between your Jenkins and Artifactory server - in that case update-center.json will not change and signature verification should work fine.
With best regards,
Dmytro Gorbunov
As of 2023-01-10 there is a problem with making a mirror of the jenkins plugins on artifactory.
Artifactory documentation decribes only how to create a mirror: https://jfrog.com/knowledge-base/how-to-configure-artifactory-as-a-mirror-for-jenkins-plugins/
But this is not a complete solution. Because this leads to the situation when every plugin shall be manually updated. Having plugins with bunch of dependencies it is huge effort.
There is a need to generate a file: update-center.json
There is an internal jenkins tool to do this: https://github.com/jenkins-infra/update-center2, but documentation is poor and contains vague statements like:
With a few modifications it could easily be used to generate your corporate update center as well.
Without clear description, what shall be done.
I tried to follow steps and completely failed. Tool require some special environment variables, which are also not documented and so on.
So as of my experience mirroring jenkins plugins on artifactory is practically not possible. And honestly spoken, I would like to be wrong here.

Jenkins Subversion Checkout Failing - "E175002: CRLF expected at end of chunk: -1/-1"

I have a Jenkins v2.107.2 instance (running as a Windows service) which is checking out several projects via Subversion from a Visual SVN Server (on a seperate Windows PC).
One of the projects (the largest - ~2.7GB) is occasionally, but then consistently failing with the following error when attempting to checkout:
ERROR: Failed to check out https://example.com/myrepo
org.tmatesoft.svn.core.SVNException: svn: E175002: CRLF expected at end of chunk: -1/-1
svn: E175002: REPORT request failed on '/svn/REPO/!svn/vcc/default'
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:112)
In addition, when checking the logs of the Visual SVN Server, I can see the following:
Error writing base64 data: The timeout specified has expired [500, #70007]
A failure occurred while driving the update report editor [500, #70007]
Provider encountered an error while streaming a REPORT response. [500, #0]
Previously, some combination of downgrading Jenkins & the Subversion plugin by one version resolved this error, but despite having not changed versions since, this no longer works.
From looking online, there seems to be some sort of timeout built into Subversion where requests will be killed if going over a certain time. However, the instructions all refer to the Subversion config that should be in %APPDATA%\Roaming, which I do not seem to have.
The Jenkins Subversion documentation suggests C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming, but again I have nothing there.
I've installed TortoiseSVN, which did create the Subversion configuration folder. I've modified the http-timeout, and then put this configuration in all the locations suggested by the documentation, but this has not made any difference (but whether it's because it doesn't fix the issue, or it's not being picked up - I'm not sure).
This error E175002: CRLF expected at end of chunk: -1/-1 can occur with products that use SVNKit to support Subversion - Jenkins, Fisheye, Crucible etc. The bug should not occur with svn.exe, TortoiseSVN or native JavaHL libraries.
Per my experience, the following solution solves the problem - enable Spooling in SVNKit. See these tickets:
https://issues.jenkins-ci.org/browse/JENKINS-44307
https://issues.tmatesoft.com/issue/SGT-989.
The error is produced by SVNKit which is used in Jenkins to enable SVN client capabilities. SVNKit is a separate re-implementation of Subversion and SVNKit might have its own specifics that could result in issues or errors that does not occur with actual Apache Subversion client. I'm not an expert in SVNKit, but it seems to me that you've encountered such SVNKit-specific issue or at least error wording.
You need to enable spooling.
See this Jenkins support issue, although this dupe issue describes the solution better:
Set the -Dhudson.spool-svn=true system property or increase timeout on the server.
For Jenkins on Windows you need to edit jenkins.xml file located in Jenkins installation directory (e.g. C:\Program Files\Jenkins\jenkins.xml).
Add an option for Hudson to use SVN spooling
<service>
...
<arguments>
...
-Dhudson.spool-svn=true
...
</arguments>
...
</service>

Travis-CI and Coveralls

I just cannot hook up the automatic update of coveralls.io to my Travis-CI build. All works fine if I execute the scripts on my machines. Here is the last message from the build log:
Submitting coverage to coveralls.io...
Coverage submitted!
Couldn't find a repository matching this job.
'url'
The command "python travis-ci/run.py" exited with 0.
Any hints or suggestions would be highly appreciated.
Best, Philipp
Make sure the TRAVIS, TRAVIS_JOB_ID and TRAVIS_BRANCH environment variables are defined when calling coveralls.
If you're using Tox for example, an extra step is needed as described in the coveralls-python readme.
This question is older, but the current problems show the same error. (And Google finds this too :-))
There were issues opened about it in node-coveralls and coveralls-public (and one more) repositories. It appeared, that Coveralls got accidentally blocked by Travis.
Although the problem was supposed to be fixed, as the comments on the second issue suggest, it occurred again. I myself could upload a new report neither from my machine, nor from Travis. I switched from Coveralls to Codecov.

let Tycho/Jenkins build fail when p2 site doesn't exist

I have an RCP application which I build in Jenkins using "mvn clean verify" to run Maven/Tycho. When the target platform of my application contains a p2 repository site that is not available anymore, Tycho prints a warning but still uses it's local cache.
[WARNING] Failed to access p2 repository http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo, use local cache. Neither http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo/content.jar nor http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo/content.xml found.
It took my quite some time to notice this problem because the Jenkins build succeeds without any issues and I am not going to read all console output...
I would like to get notified of this issue so I can take measures when a repository is moved or deleted. Tycho should still use it's cache under normal circumstances.
Can I solve this using Jenkins or can I instruct Tycho to fail fast (drawback: also fails on temporary outage)?
To partly answer my question the best solution is probably to set up a local p2 mirror, but I think this requires a lot more work.
You can mark a Jenkins build unstable or failed based on it's output by using the Jenkins Text finder plugin.
Manage Jenkins plugins and install the text finder plugin from the
Available plugins.
Edit the project to add a post-build action "Jenkins Text Finder".
Check 'Also search the console output', set the Regular expression to
'Failed to access p2 repository' and check 'Unstable if found'.

Jenkins : Invalid gitTool selection Git

i've setup my own jenkins buildserver today on my windows PC to build commits to my bitbucket.org-repository automatically.
Sadly i'm deep in trouble with the conenction between jenkins and git.
This is my Jenkis-Git configuration:
This is the Jobconfiguration:
If i now run "Build now" i'm getting the following output in console:
I hope somebody here is abled to help me with this problem. The Job is building... and building... and building... no result.
Kind regards,
Daniel
I get these Git-related warnings as well, but Jenkins is working just fine for me. I believe that they can be ignored. There is an open issue about this.
confirm you do indeed have Git installed on your system. try again.
If still having issue, you may need to also add the path of the Git executable to your Node configuration. By going to your Node configuration page, 'Node Properties' section, 'Tools Locations' setting. There you will find an option to explicitly add the path to Git.

Resources