9

I'm running jenkins from a .bat file because I need some apps to be able to perform some service operations that otherwise, from the service, would be impossible to do.

I have installed the jenkins plugin in Slack. Followed the instructions and go to configure the plugin.

Because I'm running it for now locally I have the following configuration:

  • Base URL: http://127.0.0.1:7061/
  • Team subdomain: weatherwindowsapp
  • Integration token: gk2aDYzJP8DQ2mGssS1Sssm1
  • Channel: #testchannel

If I click in the "Test connection" button at the bottom the following error is yielded to the console running jenkins:

    [0m[33mApr 18, 2017 3:53:29 PM jenkins.plugins.slack.StandardSlackService publish
WARNING: Response Code: 403
[0m[33mApr 18, 2017 4:00:33 PM hudson.security.csrf.CrumbFilter doFilter
WARNING: No valid crumb was included in request for /gk1aDYmKI6DQ3mGsuZ1fevm5. Returning 403.
[0m[33mApr 18, 2017 4:00:33 PM jenkins.plugins.slack.StandardSlackService publish
WARNING: Slack post may have failed. Response: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 403 No valid crumb was included in the request</title>
</head>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /gk1aDYmKI6DQ3mGsuZ1fevm5. Reason:
<pre>    No valid crumb was included in the request</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>

[0m[33mApr 18, 2017 4:00:33 PM jenkins.plugins.slack.StandardSlackService publish
WARNING: Response Code: 403
[0m

If I change the Base URL to "/" I get this response:

  [0m[33mApr 18, 2017 4:26:21 PM jenkins.plugins.slack.StandardSlackService publish
WARNING: Error posting to Slack
java.lang.IllegalStateException: Target host is null
        at org.apache.http.util.Asserts.notNull(Asserts.java:46)
        at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:125)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
        at org.apache.http.impl.client.CloseableHttpClient.execute(Closeabl

I followed the instructions step by step, tried different Base URl without any success.

Fritjof Berggren
  • 3,178
  • 5
  • 35
  • 57
  • Have you configured the Slack Notification Plugin with just an Integration Token or did you configure with Integration Token Credential ID? Also, your `Base URL`, what is that referring to? The Jenkins server? – Jacob Apr 18 '17 at 16:47
  • Tried both with an integration token and the credential ID. The Base URl is referring to the local jenkins server yes. – Fritjof Berggren Apr 19 '17 at 07:23

1 Answers1

15

Was dealing with the same issue. So I've found simple workaround (for integration with slack.com. Didn't check for other systems):

  1. You need to specify direct URL for notifications in Jenkins for your slack system Base URL - https://your-sub-domain.slack.com/services/hooks/jenkins-ci/
  2. Populate other required fields (Team Subdomain, Integration Token, Chanel)
  3. Click Test Connection button

After following this steps you may solve the issue

JohnD
  • 151
  • 4