Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix JENKINS-68435: Revert "Remove useless code for building clone url… #52

Merged
merged 1 commit into from
May 10, 2022

Conversation

cs8898
Copy link
Contributor

@cs8898 cs8898 commented May 10, 2022

Tackling the issue JENKINS-68435

This reverts commit 88a1ac7. (introduced in #50 )

  • It seems the code dropps the whole credential provider, and falls back to User:Password / SSH
  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@justusbunsi
Copy link
Member

@cs8898 Thanks for this PR. Can you tell me how I can reproduce this error? During my tests with the PR that removed the code everything was fine.

I'd be really appreciative if you could provide a list of actions on how to configure Jenkins and how to run the job so that it fails. If you could provide screenshots, you'd be my hero. These details are missing to me to fully understand for which scenarios this code is used.

@cs8898
Copy link
Contributor Author

cs8898 commented May 10, 2022

Gitea Config

  1. Add an Application Token to the Profile (i use my personal one, but we also could use an dedicated Jenkins User)
    2022-05-10-123357_1148x516_scrot
  2. Create The Repo you want to build and add the Jenkins file (or a new Organization in my case, so its really clean)

Jenkins Config

  1. Add your Application Token (type: Gitea Personal Access Token)
  2. Create The Organization using Your Gitea Token
    2022-05-10-130526_965x367_scrot
  3. Wait and see the Log

Log

Cloning repository https://git.geekinbusiness.de/GeekInHosting/maillist.git
  /usr/bin/git init /opt/jenkins/workdir/agent/workspace/GeekInHosting_maillist_master # timeout=10
Fetching upstream changes from https://git.geekinbusiness.de/GeekInHosting/maillist.git
  /usr/bin/git --version # timeout=10
  git --version # 'git version 2.30.2'
  /usr/bin/git fetch --no-tags --force --progress -- https://git.geekinbusiness.de/GeekInHosting/maillist.git +refs/heads/master:refs/remotes/origin/master # timeout=10
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "/usr/bin/git fetch --no-tags --force --progress -- https://git.geekinbusiness.de/GeekInHosting/maillist.git +refs/heads/master:refs/remotes/origin/master" returned status code 128:
stdout: 
stderr: remote: Unauthorized
fatal: Authentication failed for 'https://git.geekinbusiness.de/GeekInHosting/maillist.git/'

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2671)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2096)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:618)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:847)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:158)
	at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:151)
	at hudson.remoting.UserRequest.perform(UserRequest.java:211)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:376)
	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
	at java.base/java.lang.Thread.run(Unknown Source)

Log when Downgraded to 1.4.1

Note:

[Pipeline] checkout
The recommended git tool is: NONE
Warning: CredentialId "chris-gitea-token" could not be found.
 > /usr/bin/git rev-parse --resolve-git-dir /opt/jenkins/workdir/agent/workspace/GeekInHosting_maillist_master/.git # timeout=10
Fetching changes from the remote Git repository
Fetching without tags
Checking out Revision c5b4401cf3e561bc538bc8c242c8c9b2e6b05c68 (master)
 > /usr/bin/git config remote.origin.url https://[someWierdToken]@git.geekinbusiness.de/GeekInHosting/maillist.git # timeout=10
Fetching upstream changes from https://[someWierdToken]@git.geekinbusiness.de/GeekInHosting/maillist.git
 > /usr/bin/git --version # timeout=10
 > git --version # 'git version 2.30.2'
 > /usr/bin/git fetch --no-tags --force --progress -- https://[someWierdToken]@git.geekinbusiness.de/GeekInHosting/maillist.git +refs/heads/master:refs/remotes/origin/master # timeout=10
 > /usr/bin/git config core.sparsecheckout # timeout=10
 > /usr/bin/git checkout -f c5b4401cf3e561bc538bc8c242c8c9b2e6b05c68 # timeout=10
Commit message: "fix jenkinsfile"
First time build. Skipping changelog.
The recommended git tool is: NONE
Warning: CredentialId "chris-gitea-token" could not be found.
The recommended git tool is: NONE
Warning: CredentialId "chris-gitea-token" could not be found.
[GitCheckoutListener] Recording commits of 'git https://[someWierdToken]@git.geekinbusiness.de/GeekInHosting/maillist.git'
[GitCheckoutListener] Found no previous build with recorded Git commits
[GitCheckoutListener] -> Starting initial recording of commits
[GitCheckoutListener] -> Using head commit 'c5b4401' as starting point
[GitCheckoutListener] -> Git commit decorator successfully obtained 'org.jenkinsci.plugin.gitea.GiteaBrowser@5f4ad250' to render commit links
[GitCheckoutListener] -> Recorded 2 new commits
[Gitea] Notifying branch build status: PENDING Build started...
[Gitea] Notified

@lafriks lafriks merged commit 8288e82 into jenkinsci:master May 10, 2022
@lafriks lafriks added the bug label May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants