[jenkins] GitHubWebHook ( Not intended to be browsed interactively (must specify payload parameter) 이슈 해결
general java 2014. 10. 6. 21:05webhooks의 content type이 application/json인 경우, jenkins에서 hook 결과가 아래 IllegalArgumentException이 발생되어 삽질을 할 수 있다.
Caused by: java.lang.IllegalArgumentException: Not intended to be browsed interactively (must specify payload parameter)
at com.cloudbees.jenkins.GitHubWebHook.doIndex(GitHubWebHook.java:154)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
at org.kohsuke.stapler.MetaClass$2.dispatch(MetaClass.java:164)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:733)
관련 내용을 살펴보기 위해 검색했다.
http://developer.cloudbees.com/bin/view/DEV/GitHub+Commit+Hooks+HOWTO
http://ics-software-engineering.github.io/play-example-continuous-integration/
관련해서 특별한 문제점을 찾을 수 없었다.
참고로 GitHubWebHook plugin 소스를 확인해보니. payload 정보를 읽지 못한 부분이었다.
public void doIndex(StaplerRequest req) {
151
152 String eventType = req.getHeader("X-GitHub-Event");
153 if ("push".equals(eventType)) {
154 String payload = req.getParameter("payload");
155 if (payload == null) {
156 throw new IllegalArgumentException("Not intended to be browsed interactively (must specify payload parameter). " +
157 "Make sure payload version is 'application/vnd.github+form'.");
158 }
159 processGitHubPayload(payload,GitHubPushTrigger.class);
160 } else if (eventType != null && !eventType.isEmpty()) {
161 throw new IllegalArgumentException("Github Webhook event of type " + eventType + " is not supported. " +
162 "Only push events are current supported");
163 } else {
164 //Support github services that don't specify a header.
165 //Github webhook specifies a "X-Github-Event" header but services do not.
166 String payload = req.getParameter("payload");
167 if (payload == null) {
168 throw new IllegalArgumentException("Not intended to be browsed interactively (must specify payload parameter)");
169 }
170 processGitHubPayload(payload,GitHubPushTrigger.class);
171 }
결론은 특수 문자 및 한글 이슈로 인해서 application/json이 동작이 안될 수 있다.
Webhooks/Manage webhook의 Content type에 application/x-www-form-urlencoded 를 설정하고 webhook 테스트를 진행해보니. 잘 동작되었다.
'general java' 카테고리의 다른 글
spring @Inject 공부 (0) | 2014.12.09 |
---|---|
[java] commons-lang 2에서 3으로 넘어갈 때 주의할 사항 (0) | 2014.10.23 |
[jenkins] 설치관련 에러 - dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) (0) | 2014.09.20 |
jenkins plugin 실패시 - cmd is neither a valid file, URL, nor a plugin artifact name in the update center (0) | 2014.09.20 |
[play framework] 초짜 코딩시 주의할 점 - controller클래스의 public static 메소드 (0) | 2014.08.19 |