I believe the current git plugin expects that you'll enter the user name
and password as a credential in the "Manage Credentials" globally, then
that your job will reference that credential rather than embedding the
credential in the URL.

Could you try that?

It also has the benefit that your console log won't include your
authorization token as plain text.

Mark Waite


On Thu, May 1, 2014 at 1:42 PM, Scott Purcell
<scottpurcell78...@gmail.com>wrote:

> Pinging this to try again to get some other eyes and minds applied to this
> problem...
>
> On Tuesday, January 28, 2014 6:11:21 PM UTC-6, Scott Purcell wrote:
>>
>>  Context:
>>
>> I'm maintaining courseware that consists of restructured text source
>> files that we maintain in Github and render into PDFs for our courses. I'm
>> trying to use Jenkins to automatically re-render the PDFs each time changes
>> are committed to the repository. I am a beginning user of Jenkins and
>> beginning-intermediate user of Git and Github.
>>  Problem:
>>
>> I have a job that runs fine (see log excerpt 1 below) whenever I, from
>> the Jenkins WebUI, click "Build Now". But when changes are committed to
>> GitHub, although Jenkins does detect the commit, the build fails when
>> trying to connect to the repo with at 401 error (see log 2 below)
>>  Technical Details: The version of Jenkins you are using Jenkins ver.
>> 1.544
>>
>>    1. How you are launching Jenkins (via java -jar, deployed to Tomcat
>>    v7.0.19, etc)
>>
>>    /usr/bin/daemon --name=jenkins --inherit 
>> --env=JENKINS_HOME=/var/lib/jenkins
>>    --output=/var/log/jenkins/jenkins.log 
>> --pidfile=/var/run/jenkins/jenkins.pid
>>    -- /usr/bin/java -jar /usr/share/jenkins/jenkins.war
>>    --webroot=/var/cache/jenkins/war --httpPort=8080 --ajp13Port=-1
>>
>>  The version of Java you are using to launch Jenkins
>>
>> java version "1.7.0_25"
>>
>> OpenJDK Runtime Environment (IcedTea 2.3.10)
>> (7u25-2.3.10-1ubuntu0.12.04.2)
>>
>> OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
>>  The version of any plugin which you think is related to the problem
>>
>>    - Git server plugin 1.2
>>    - GitHub API Plugin 1.44
>>    - Github Authentication plugin 0.14
>>    - GitHub plugin 1.8
>>    - GitHub Pull Request Builder 1.9
>>    - GitHub SQS Build Trigger Plugin 1.5
>>
>>   Authentication
>>
>> I'm using Oauth tokens (a "Personal Access Token") to access my git repos
>> from Jenkins.
>>  Log Excerpt 1
>>
>> Started by user Scott Purcell
>> [EnvInject] - Loading node environment variables.
>> Building in workspace 
>> /var/lib/jenkins/jobs/Course-OSFundamentals-Dev/workspace
>> Fetching changes from the remote Git repository
>> Fetching upstream changes from
>> https://<obfuscated-Oauth-token>@github.com/cloud-training/Course-OSFundamentals-Dev.git
>> Checking out Revision 5ea59b1effedd48729ce7395a2e81d10398387bc 
>> (origin/master)
>> [workspace] $ /bin/sh -xe /tmp/hudson1502402201860439422.sh
>> + bash .renderall.sh
>>
>>
>> Log 2
>>
>> Last GitHub Push
>>
>> Started on Jan 28, 2014 1:45:06 PM
>> Using strategy: Default
>> [poll] Last Built Revision: Revision bcf944840221314b82160a60941723a6e54c0311
>> (origin/master)
>> FATAL: hudson.plugins.git.GitException: Failed to connect to
>> https://<obfuscated-Oauth-token>@github.com/cloud-training/Course-OSFundamentals-Dev.git
>> (status = 401)
>> hudson.util.IOException2: hudson.plugins.git.GitException: Failed to connect 
>> to
>> https://<obfuscated-Oauth-token>@github.com/cloud-training/Course-OSFundamentals-Dev.git
>> (status = 401)
>>         at 
>> hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:459)
>>         at hudson.scm.SCM._compareRemoteRevisionWith(SCM.java:356)
>>         at hudson.scm.SCM.poll(SCM.java:373)
>>         at hudson.model.AbstractProject._poll(AbstractProject.java:1584)
>>         at hudson.model.AbstractProject.poll(AbstractProject.java:1493)
>>         at 
>> com.cloudbees.jenkins.GitHubPushTrigger$1.runPolling(GitHubPushTrigger.java:73)
>>         at 
>> com.cloudbees.jenkins.GitHubPushTrigger$1.run(GitHubPushTrigger.java:98)
>>         at 
>> hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
>>         at 
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>>         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
>>         at 
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>>         at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>>         at java.lang.Thread.run(Thread.java:724)
>> Caused by: hudson.plugins.git.GitException: Failed to connect to
>> https://<obfuscated-Oauth-token>@github.com/cloud-training/Course-OSFundamentals-Dev.git
>> (status = 401)
>>         at 
>> org.jenkinsci.plugins.gitclient.CliGitAPIImpl.checkCredentials(CliGitAPIImpl.java:1602)
>>         at 
>> org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:957)
>>         at 
>> org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:922)
>>         at 
>> org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:1438)
>>         at 
>> hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:489)
>>         at 
>> hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:457)
>>         ... 13 more
>> Done. Took 0.31 sec
>> No changes
>>
>>
>> Log Excerpt 3
>>
>> This instance, right after I had deleted my old tokens and created a new
>> one, worked.
>>
>> Jan 28, 2014 4:40:39 PM 
>> org.jenkinsci.plugins.GithubRequireOrganizationMembershi
>> pACL hasPermission
>> INFO: Granting READ access for github-webhook url: /github-webhook/
>> Jan 28, 2014 4:40:39 PM com.cloudbees.jenkins.GitHubWebHook 
>> processGitHubPayload
>> INFO: Received POST for 
>> https://github.com/cloud-training/Course-OSFundamentals-Dev
>> Jan 28, 2014 4:40:39 PM com.cloudbees.jenkins.GitHubWebHook 
>> processGitHubPayload
>> INFO: Poked Course-OSFundamentals-Dev
>> Jan 28, 2014 4:40:40 PM com.cloudbees.jenkins.GitHubPushTrigger$1 run
>> INFO: SCM changes detected in Course-OSFundamentals-Dev. Triggering  #30
>> Jan 28, 2014 4:43:20 PM 
>> org.jenkinsci.plugins.GithubRequireOrganizationMembershipACL hasPermission
>> INFO: Granting READ access for github-webhook url: /github-webhook/
>> Jan 28, 2014 4:43:20 PM com.cloudbees.jenkins.GitHubWebHook 
>> processGitHubPayload
>> INFO: Received POST for 
>> https://github.com/cloud-training/Course-OSFundamentals-Dev
>> Jan 28, 2014 4:43:20 PM com.cloudbees.jenkins.GitHubWebHook 
>> processGitHubPayload
>> INFO: Poked Course-OSFundamentals-Dev
>> Jan 28, 2014 4:43:20 PM 
>> org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
>> INFO: basic authentication scheme selected
>> Jan 28, 2014 4:43:20 PM org.apache.commons.httpclient.HttpMethodDirector 
>> processWWWAuthChallenge
>>
>>
>> Log Excerpt 4:
>>
>> But this one, the very next attempt with no changes to configuration or
>> tokens, failed in the same way as previously.
>>
>> Jan 28, 2014 4:49:21 PM hudson.model.Run execute
>> INFO: Course-OSFundamentals-Dev #30 main build action completed: SUCCESS
>> Jan 28, 2014 4:54:51 PM 
>> org.jenkinsci.plugins.GithubRequireOrganizationMembershipACL hasPermission
>> INFO: Granting READ access for github-webhook url: /github-webhook/
>> Jan 28, 2014 4:54:52 PM com.cloudbees.jenkins.GitHubWebHook 
>> processGitHubPayload
>> INFO: Received POST for 
>> https://github.com/cloud-training/Course-OSFundamentals-Dev
>> Jan 28, 2014 4:54:52 PM com.cloudbees.jenkins.GitHubWebHook 
>> processGitHubPayload
>> INFO: Poked Course-OSFundamentals-Dev
>> Jan 28, 2014 4:54:52 PM 
>> org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
>> INFO: basic authentication scheme selected
>> Jan 28, 2014 4:54:52 PM org.apache.commons.httpclient.HttpMethodDirector 
>> processWWWAuthChallenge
>> INFO: No credentials available for BASIC 'GitHub'@github.com:443
>>
>>
>> Thank you in advance for any help you can give!
>>
>>
>> Scott Purcell
>>
>>   --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks!
Mark Waite

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to