2

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?

Sergei
  • 387
  • 1
  • 6
  • 16
  • it seems that jenkins is storing the temporary github app credentials and using them even after they expire. Try removing the credential manager of git from the jenkins server. – Singh Sep 01 '23 at 04:15

0 Answers0