Jenkins is not fetching due to Gerrit-Trigger Parameters issues - github

I am configuring Gerrit-Trigger/Jenkins Job that does verify when the developer check In the code. I see the job is failing since Gerrit Parameters are not picked by Jenkins. Below is the error which I am getting:
> /usr/bin/git -c core.askpass=true fetch --tags --progress ssh://<Gerrit URL>.git $GERRIT_REFSPEC
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from ssh://<Gerrit URL>.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:810)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1066)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1097)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1269)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:607)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1738)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git -c core.askpass=true fetch --tags --progress ssh://<Gerrit URL>.git $GERRIT_REFSPEC" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref $GERRIT_REFSPEC
How do I configure Jenkins to pick all Gerrit Paramaters?
-Thanks

Related

How do I fix Jenkins github app credentials issue?

I had multiple Jenkins jobs running happily for some time using github app for authentication but today they all stopped working.
I can go to each job and when I select 'validate', the github app credentials are validated fine.
I created a dummy job to reproduce the error. The job finds Jenkinsfile I created but then return the error as below:
Started by user xxxxxxx
22:34:53 Connecting to https://api.github.com using xxx-terraform-aws
Obtained Jenkinsfile from xxxxxxxxxxxxxxxxx
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/sts_test_fix-xxx-xxx-fix-Jenkins
[Pipeline] {
[Pipeline] stage (hide)
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
The recommended git tool is: NONE
using credential xxx-terraform-aws
> git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/sts_test_fix-xxx-xxx-fix-Jenkins/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/xxxx/xxx-terraform.git # timeout=10
Fetching without tags
Fetching upstream changes from https://github.com/xxx/xxx-terraform.git
> git --version # timeout=10
> git --version # 'git version 2.25.1'
using GIT_ASKPASS to set credentials xxx-terraform-aws
> git fetch --no-tags --force --progress -- https://github.com/xxx/xxx-terraform.git +refs/heads/fix-xxx-xxx-fix-Jenkins:refs/remotes/origin/fix-xxx-xxx-fix-Jenkins # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://github.com/xxx/xxx-terraform.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1003)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1244)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1308)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
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:829)
Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --force --progress -- https://github.com/xxx/xxx-terraform.git +refs/heads/fix-xxx-240xxxfix-Jenkins:refs/remotes/origin/fix-xxx-xxx-fix-Jenkins" returned status code 128:
stdout:
stderr: remote: Invalid username or password.
I redeployed Jenkins and the issue disappeared, however next day it came back. I wonder if this is because I added few script permissions for one of the groovy jobs.
Could anyone please point me to a right direction why I am getting this error when validation for github app is passing?

RestBed clone failed from github

While cloning the restbed repo, we are getting below error and is taking a lot of time.
$ git submodule update --init --recursive
Submodule 'dependency/asio' (https://github.com/corvusoft/asio-dependency) registered for path 'dependency/asio'
Submodule 'dependency/catch' (https://github.com/corvusoft/catch-dependency) registered for path 'dependency/catch'
Submodule 'dependency/openssl' (https://github.com/corvusoft/openssl-dependency) registered for path 'dependency/openssl'
Cloning into '${HOME}/restbed/dependency/asio'...
error: RPC failed; curl 56 SSL read: errno -5961
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: clone of 'https://github.com/corvusoft/asio-dependency' into submodule path '${HOME}/restbed/dependency/asio' failed
Failed to clone 'dependency/asio'. Retry scheduled
Is there something wrong with the repo?
Thanks,
What occurs when you run git clone --recursive https://github.com/corvusoft/restbed.git

jenkins -github build issue

I have been facing issues while trying to build a project in jenkins which fetches the files from github .
Below is the error log i got :
p.s: for security reason i have removed the ssh url of git .I can able to clone from my locally but when im trying it from jenkins it fails . I have generated ssh key in linux server and its able to connect to github .Can anyone please help me on this
Building in workspace /var/lib/jenkins/jobs/tr-data-events-testing/workspace
> /usr/local/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/local/bin/git config remote.origin.url git#github.url---------git # timeout=10
Fetching upstream changes from git#github.url-----------s.git
> /usr/local/bin/git --version # timeout=10
using GIT_SSH to set credentials jenkins dxc key
> /usr/local/bin/git fetch --tags --progress git#----url--------------.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git#---url-------.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:766)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1022)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1053)
at hudson.scm.SCM.checkout(SCM.java:485)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1282)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:610)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:532)
at hudson.model.Run.execute(Run.java:1741)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:381)
Caused by: hudson.plugins.git.GitException: Command "/usr/local/bin/git fetch --tags --progress git#github.-------events.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: error: The requested URL returned error: 503 while accessing https://--url-----------/info/refs
fatal: HTTP request failed
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1693)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1441)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:62)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:313)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:764)
... 11 more
ERROR: null
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
Help us localize this page
i resolved this issue by un setting the proxy in .gitconfig file . thank you for your answers
First, make sure Jenkins is running with the same user account you have created your ssh keys with.
It it does not, it would search for ~/.ssh/id_rsa in its own $HOME.
Second, to debug, you can launch Jenkins with this environment variable set first:
export GIT_SSH_COMMAND='ssh -Tv'
That way, any time it will try a git command involving ssh, you will see exactly where Jenkins/git tries to look for ssh keys, and what is the error.
Make sure you Git is recent enough to support this (Git 2.3+, Q4 2015).
But your logs show:
The requested URL returned error: 503 while accessing https://
So this has nothing to do with ssh. As mentioned, a proxy can interfere.

Pushing my app to cloudControl (PaaS) fails: hook declined

When trying to push and deploy my app to cloudControlled PaaS:
$ cctrlapp MY_APP/default push
I get the following error (reduced output):
remote: -----> Receiving push
remote: /srv/www/buildpacks/php/bin/compile: line 81: /srv/tmp/builddir/code/composer.phar: Permission denied
remote: ! cloudControl push rejected, failed to compile php app
remote: !
remote: error: hook declined to update refs/heads/master
To ssh://MY_APP#cloudcontrolled.com/repository.git
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'ssh://MY_APP#cloudcontrolled.com/repository.git'
Command '['PATH_TO_GIT', 'push', u'ssh://MY_APP#cloudcontrolled.com/repository.git', 'master']'
returned non-zero exit status 1
Anyone has any idea?
I found out I have to remove the composer.phar file from the root directory of my repository. Too keep it in my local filesystem, I did
git rm --cached composer.phar
# then commit, push, deploy

hudson.plugins.git.GitException: Could not fetch from any repository

I want to configure hudson+git and want to create a build. But I am getting following exception:
Started by user nitish
Checkout:workspace / /root/.hudson/jobs/NightlyGit/workspace - hudson.remoting.LocalChannel#dd7efd
Using strategy: Default
Checkout:workspace / /root/.hudson/jobs/NightlyGit/workspace - hudson.remoting.LocalChannel#dd7efd
Fetching changes from the remote Git repository
Fetching upstream changes from https://github.com/test/eng.git
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
ERROR: (Underlying report) : Error performing command: /usr/bin/git fetch -t https://github.com/test/eng.git +refs/heads/nightly:refs/remotes/origin/nightly
Command "/usr/bin/git fetch -t https://github.com/test/engile.git +refs/heads/nightly:refs/remotes/origin/nightly" returned status code 128: error: The requested URL returned error: 401 while accessing https://github.com/test/eng.git/info/refs
fatal: HTTP request failed
ERROR: Could not fetch from any repository
FATAL: Could not fetch from any repository
hudson.plugins.git.GitException: Could not fetch from any repository
at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:887)
at hudson.plugins.git.GitSCM$3.invoke(GitSCM.java:845)
at hudson.FilePath.act(FilePath.java:758)
at hudson.FilePath.act(FilePath.java:740)
at hudson.plugins.git.GitSCM.gerRevisionToBuild(GitSCM.java:845)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:622)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1483)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:507)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:424)
at hudson.model.Run.run(Run.java:1366)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
I am newbie to the git ,I dont know what is the exact problem is there any creadentials required while using git with hudson?. Right now I have created the hudson job and providing the git repository link but it throws above exception. can somebody help me to sort out this issue.
Try this:
Go to the job's "Configure" page.
Under Source Code Management → Git → Additional Behaviors, add a behavior "Wipe out repository & force clone":
Click on Save button.
Try to Build again.
I have created the SSH key on hudson server and added it to my github account that solved my issue.
Sometimes the permission of the workspace also can cause the same error.
sudo chown -R jenkins: <workspace>