kuleuven / jenkins-mattermost-plugin

Jenkins plugin for Mattermost
MIT License
24 stars 46 forks source link

Quick question about my testing Jenkins connection with mattermost #6

Closed pdclxf closed 8 years ago

pdclxf commented 8 years ago

Hi

Nice to meet you, today i am playing mattermost with my Jenkins, using Mattermost Notification Plugin version 1.4.0 But unlucky i find that's an access denied issue, appreciate that your advise

My incoming webhooks is OK, as when i run below command, it can shows the message curl -i -X POST -d 'payload={"text": "Hello, this is some text.\nThis is more text."}' http://:8065/hooks/8g6y9awyjpdq7d1aff7wfnhh8a

But after i did the config in Jenkins like below. it fails as of access denied Jenkins config: Endpoint:http://:8065/hooks/8g6y9awyjpdq7d1aff7wfnhh8a Channel: Build Server URL:http://:8080/

error: Mar 16, 2016 9:19:33 AM jenkins.plugins.mattermost.StandardMattermostService publish INFO: Posting: to icon: , on http://:8065/hooks/8g6y9awyjpdq7d1aff7wfnhh8a: Mattermost/Jenkins plugin: you're all set! (using ) good Mar 16, 2016 9:19:33 AM jenkins.plugins.mattermost.StandardMattermostService publish WARNING: Mattermost post may have failed. Response:

Access Denied


Access Denied (policy_denied)

Your system policy has denied access to the requested URL.

For assistance, contact your network support team.
Mar 16, 2016 9:19:33 AM jenkins.plugins.mattermost.StandardMattermostService publish INFO: Posting succeeded
jovandeginste commented 8 years ago

Hi,

I see there is no domain in the url - did you omit it or is it running locally? Did you do the 'curl' test from the server running jenkins?

Can you try and provide a channel in the settings?

pdclxf commented 8 years ago

Hi thanks for the reply, when i run 'curl' it is from the server which is running jenkins, there is an correct url included my host name/port, i just wipe it up here, as my company's security requests, i did tried to provide a channel too, but still no luck, may i know if i can debug it like to make it print out what user name/password/command it is running? Thanks again

jovandeginste commented 8 years ago

You could change the source code, of course, but if you're not using ssl for communication between Jenkins and Mattermost, you could use tcpdump:

tcpdump -nnnn -i any port 8065

and then

tcpdump -A -nnnn -i any port 8065

First will just show tcp headers, second will show packet contents. The combination of request and response might give you a clue about context ...

There should not be any username or password, since that is inherent in the token (8g6y9awyjp...)

Can you see in the Mattermost logs? Sometimes there is something useful there ...

pdclxf commented 8 years ago

sorry no luck from Mattermost logs, it just has something like:

[2016/03/24 02:46:08 GMT] [DEBG] /api/v1/users/status [2016/03/24 02:46:16 GMT] [DEBG] /api/v1/users/status [2016/03/24 02:46:22 GMT] [DEBG] /api/v1/users/status [2016/03/24 02:46:29 GMT] [DEBG] /api/v1/users/status [2016/03/24 02:46:37 GMT] [DEBG] /api/v1/users/status

jovandeginste commented 8 years ago

Just out of curiosity, which os are you running? Googling the error you get gives me lots of Microsoft results... If it's Linux, did you try the tcpdump?

jovandeginste commented 8 years ago

Also, why are you using 1.4.0 and not 1.5.0?

pdclxf commented 8 years ago

Hi i updated it to version 1.5.0 but still no luck..same issue

pdclxf commented 8 years ago

and yes i am running on Linux, and the tcpdump is running fine, just don't know why only errors from my jenkins

jovandeginste commented 8 years ago

I expect tcpdump to run fine itself, but what do you see as output :-)

Do you see the connections going out? Do you see them arriving at the Mattermost side?

pdclxf commented 8 years ago

Hi yes the tcpdump works fine as i can see the output on Mattermost, like this

webhook BOT 5 days ago Hello, this is some text. This is more text.

jovandeginste commented 8 years ago

The output that you see on Mattermost is generated by Jenkins or by Curl?

pdclxf commented 8 years ago

it is by Curl, so far no successful connection between Jenkins and Mattermost i think

jovandeginste commented 8 years ago

Are you using proxy configuration in Jenkins? Do you see outgoing connection on the Jenkins server (using tcpdump) to the Mattermost server?

pdclxf commented 8 years ago

hi i find this in the jenkins plugin "Note: the plugin uses the HTTP Proxy Configuration set in Plugin Manager. Fill the 'No Proxy Host' field if your Mattermost instance is hosted internally."

as my jenkins and my Mattermost are in the same internal network, i think we should no need Proxy, so may i ask where i should put this 'No Proxy Host' in ?

jovandeginste commented 8 years ago

This is only relevant if you have configured proxy; find the configuration here:

Manage Jenkins > Manage Plugins > Advanced

pdclxf commented 8 years ago

yes i did have a proxy setup there, and i verify it is working, can connect to erternal network like "http://wiki.jenkins-ci.org/"

jovandeginste commented 8 years ago

There should be a field 'No Proxy Host' where you can add your mattermost domain. You can verify by putting your mattermost url (withouth the hooks/* part) in "test url" field and testing before and after adding the domain.

pdclxf commented 8 years ago

ok i have did the No proxy host, and now the error from my jenkins is

INFO: Posting: to icon: , on http://:8065/hooks/qijuf88sopbmup81psqb33komc: Mattermost/Jenkins plugin: you're all set! (using ) good Mar 29, 2016 11:07:57 AM jenkins.plugins.mattermost.StandardMattermostService publish WARNING: Mattermost post may have failed. Response: {"id":"web.incoming_webhook.channel.app_error","message":"Couldn't find the channel","detailed_error":"err=","request_id":"smawp1j6wpbspgtqx5u9mue7oe","status_code":500,"is_oauth":false}

may i ask if any idea on it ?

jovandeginste commented 8 years ago

I think you now have to specify a channel...

pdclxf commented 8 years ago

Thanks a lot for all your great help, finally i find that with the "Endpoint", there is no need to specify "channel" in jenkins, i remove my "channel" information and keep it empty, it works fine, the test connection between my jenkins and mattermost is passed now, Cheers !

jovandeginste commented 8 years ago

Great, I will then close this issue...! However, I don't understand how you put channel with endpoint?