티스토리 뷰

Jenkins에서 빌드한 산출물에 대해 Tagging을 하기 위해 Git Publisher를 사용한다. 하지만 Tagging을 할때 아래와 같은 오류가 발생하며 Jenkins Job이 실패를 했다. 

 

using credential gitlab_build
 > git tag -l BUILD_STG_3 # timeout=10
 > git tag -a -f -m BUILD_STG_3 BUILD_STG_3 # timeout=10
Pushing tag BUILD_STG_3 to repo origin
 > git --version # timeout=10
using GIT_ASKPASS to set credentials gitlab_build
 > git push http://gitlab.oingdaddy.com/sample/sample.git BUILD_STG_3 -f
ERROR: Failed to push tag BUILD_STG_3 to origin
hudson.plugins.git.GitException: Command "git push http://gitlab.oingdaddy.com/sample/sample.git BUILD_STG_3 -f" returned status code 128:
stdout: 
stderr: fatal: unable to access 'http://gitlab.oingdaddy.com/sample/sample.git/': The requested URL returned error: 403

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2099)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1791)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$400(CliGitAPIImpl.java:79)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$8.execute(CliGitAPIImpl.java:2178)
	at hudson.plugins.git.GitPublisher.perform(GitPublisher.java:292)
	at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1074)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
	at hudson.model.Run.execute(Run.java:1843)
	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:429)

물론 빌드를 하기 위해서 git에서 소스를 가져오고 빌드를 하는 과정까지는 잘 되었다. Jenkins에서 git에 연결이 잘 안되었다거나 통신을 할 수 없는 상황은 아니다. 하지만 git push를 하는 과정에서 GitException 이 발생하며 128 에러코드를 받았으며 해당 git repo에 연결을 할 수 없었다. 

 

여러가지 원인이 있겠지만 필자의 경우는 Jenkins에서 git에 연동하기 위한 계정이 해당 git 프로젝트의 멤버로 등록이 되어 있지 않아서 발생을 했다. 즉 연결한 계정이 push 권한이 있어야 Tagging 작업을 진행할 수 있다. 

 

 

jenkins git credential

여기에서 설정한 Credentials 정보가 해당 git project의 멤버로 등록이 되어 있어야 하며 push 권한을 가지고 있어야 한다. 

 

git invite member

이런식으로 Jenkins Credentials에 넣었던 계정(build)을 내가 tagging (push) 하려는 프로젝트의 멤버로도 추가를 해줘야한다. role permission은 Maintainer로 준다. 

 

하나의 프로젝트를 위해 구성을 하다보면 위와 같은 실수는 없겠지만 git repo에 여러 프로젝트가 올라가있고 Jenkins에서 통합 빌드 계정으로 이를 관리한다면 위와 같은 문제가 발생할 수 있다. 

 

끝!

 

댓글
최근에 올라온 글
최근에 달린 댓글
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31