martes, 24 de junio de 2014

Integración de Jenkins con BitBucket

El asunto del titulo parece bastante simple y de hecho lo es. Pero al intentar realizar un fetch de una aplicación alojada en bitbucket a través de autenticación basada en HTTPS, obtuve los siguientes errores:

Error 1

Started by user Juan mauricio Giraldo parra
Building remotely on 262ce1a4 in workspace /scratch/jenkins/workspace/AtlasTeam
 > git rev-parse --is-inside-work-tree
Fetching changes from the remote Git repository
 > git config remote.origin.url https://yuytyutury:ggyutyutryut@bitbucket.org/danielbustamante/atlasteam.git
Fetching upstream changes from https://bjgjhghghjgh@bitbucket.org/danielbustamante/atlasteam.git
 > git --version
 > git fetch --tags --progress https://kjhjkhkjhkjh@bitbucket.org/danielbustamante/atlasteam.git +refs/heads/*:refs/remotes/origin/*
FATAL: Failed to fetch from https://mhjjkhjkhkjhkj@bitbucket.org/danielbustamante/atlasteam.git
hudson.plugins.git.GitException: Failed to fetch from https://nmbhgjhghghjghj@bitbucket.org/danielbustamante/atlasteam.git
 at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:622)
 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:854)
 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:879)
 at hudson.model.AbstractProject.checkout(AbstractProject.java:1411)
 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:662)
 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:571)
 at hudson.model.Run.execute(Run.java:1665)
 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
 at hudson.model.ResourceController.execute(ResourceController.java:88)
 at hudson.model.Executor.run(Executor.java:246)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://nhjghjgjhgjgjhg@bitbucket.org/danielbustamante/atlasteam.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fatal: Authentication failed

 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1325)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1186)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:87)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:257)
 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:153)
 at org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$1.call(RemoteGitImpl.java:146)
 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
 at hudson.remoting.Request$2.run(Request.java:328)
 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
 at java.util.concurrent.FutureTask.run(FutureTask.java:262)
 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:744)


Error 2

Started by user anonymous
[EnvInject] - Loading node environment variables.
Building on master in workspace /var/lib/jenkins/workspace/TccWebServices_BS
 > git rev-parse --is-inside-work-tree
Fetching changes from the remote Git repository
 > git config remote.origin.url https://sfsfdsdf:sdadasdads@bitbucket.org/danielbustamante/atlasteam.git
Fetching upstream changes from https://mauriciogiraldo@bitbucket.org/danielbustamante/atlasteam.git
 > git --version
 > git fetch --tags --progress https://nghjghjghjgfhg@bitbucket.org/danielbustamante/atlasteam.git +refs/heads/*:refs/remotes/origin/*
FATAL: Failed to fetch from https://mnghjghjghjgjfhj@bitbucket.org/danielbustamante/atlasteam.git
hudson.plugins.git.GitException: Failed to fetch from https://jhghjghjgfhjhjg@bitbucket.org/danielbustamante/atlasteam.git
 at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:623)
 at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:855)
 at hudson.plugins.git.GitSCM.checkout(GitSCM.java:880)
 at hudson.model.AbstractProject.checkout(AbstractProject.java:1414)
 at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:652)
 at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:561)
 at hudson.model.Run.execute(Run.java:1678)
 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
 at hudson.model.ResourceController.execute(ResourceController.java:88)
 at hudson.model.Executor.run(Executor.java:231)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://hgfghfhgfghfgh@bitbucket.org/danielbustamante/atlasteam.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: error: The requested URL returned error: 401 while accessing https://khkhkjhjkhkjkjh@bitbucket.org/danielbustamante/atlasteam.git/info/refs

fatal: HTTP request failed

 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1325)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1186)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$200(CliGitAPIImpl.java:87)
 at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:257)
 at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:621)
 ... 10 more

En los foros de internet la respuesta a este error era siempre la misma. Desde la versión 1.4.0 el issue fué solucionado. Nosotros teníamos instalada la versión 2.2.2 y aún así no funcionaba. Intentamos muchas cosas hasta que decidimos bajar la versión del plug-in Git de Jenkins a la versión 1.4.0 y se hizo la luz. Al parecer la ultima versión del plug-in tiene un problema con la autenticación HTTPS.

Los desarrolladores no consideramos el mal que podemos causar al entregar liberaciones de producto a producción sin asegurar adecuadamente la calidad. Fué 1 semana de trabajo que nos retrasó en cierta medida el proyecto. :-(




No hay comentarios: