Updating Slack Notification not working by API
Summary
We are trying to update service slack notification settings through the API v4 and it always come back as the same entity before we PUT our changes. Like shown in: https://docs.gitlab.com/ce/api/services.html#slack-notifications
Are we doing something incorrectly?
Steps to reproduce
Have a slack notification user set to something else than "test" we used "git" as username.
Update it through API https://gitlab.host.com/api/v4/projects/156/services/slack
What is the current bug behavior?
Run this request: curl -X PUT --header "Content-Type: application/json" --header "PRIVATE-TOKEN: my_token" --data '{"webhook":"https://hooks.slack.com/services/my/slack/hook","username":"test"}' https://gitlab.host.com/api/v4/projects/156/services/slack
Response not updated:
{"id":1851,"title":"Slack notifications","created_at":"2017-05-15T17:20:37.998-03:00","updated_at":"2017-05-16T13:17:54.061-03:00","active":true,"push_events":true,"issues_events":true,"merge_requests_events":true,"tag_push_events":true,"note_events":true,"pipeline_events":true,"job_events":false,"properties":{"webhook":"https://hooks.slack.com/services/my/slack/hook","username":"git","notify_only_broken_pipelines":"0","notify_only_default_branch":"0","push_channel":"#testing","issue_channel":"#testing","confidential_issue_channel":"#testing","merge_request_channel":"#testing","note_channel":"","tag_push_channel":"#testing","pipeline_channel":"","wiki_page_channel":"#testing"}}
What is the expected correct behavior?
We expected an update json like:
{"id":1851,"title":"Slack notifications","created_at":"2017-05-15T17:20:37.998-03:00","updated_at":"2017-05-16T13:17:54.061-03:00","active":true,"push_events":true,"issues_events":true,"merge_requests_events":true,"tag_push_events":true,"note_events":true,"pipeline_events":true,"job_events":false,"properties":{"webhook":"https://hooks.slack.com/services/my/slack/hook","username":"test","notify_only_broken_pipelines":"0","notify_only_default_branch":"0","push_channel":"#testing","issue_channel":"#testing","confidential_issue_channel":"#testing","merge_request_channel":"#testing","note_channel":"","tag_push_channel":"#testing","pipeline_channel":"","wiki_page_channel":"#testing"}}
Relevant logs and/or screenshots
We did not found any error or warning messages related to this. Only the correct access_log with PUT method.
Results of GitLab environment info
Expand for output related to GitLab environment info
System information System: Ubuntu 14.04 Current User: git Using RVM: no Ruby Version: 2.3.3p222 Gem Version: 2.6.6 Bundler Version:1.13.7 Rake Version: 10.5.0 Redis Version: 3.2.5 Git Version: 2.11.1 Sidekiq Version:4.2.7
GitLab information Version: 9.1.4 Revision: fed799a Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: http://gitlab.host.com HTTP Clone URL: http://gitlab.host.com/some-group/some-project.git SSH Clone URL: git@gitlab.host.com:some-group/some-project.git Using LDAP: yes Using Omniauth: no
GitLab Shell Version: 5.0.2 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
Checking GitLab Shell ...GitLab Shell version >= 5.0.2 ? ... OK (5.0.2) Repo base directory exists? default... yes Repo storage directories are symlinks? default... no Repo paths owned by git:git? default... yes Repo paths access is drwxrws---? default... yes hooks directories in repos are links: ... 4/1 ... ok 10/4 ... ok 3/5 ... ok 12/14 ... ok 12/15 ... ok 12/16 ... ok 3/18 ... ok 10/19 ... ok 16/23 ... ok 12/24 ... ok 16/27 ... ok 17/30 ... ok 17/31 ... ok 18/32 ... ok 18/33 ... ok 18/34 ... ok 18/35 ... ok 20/43 ... ok 4/44 ... ok 16/45 ... ok 3/51 ... ok 23/52 ... ok 2/58 ... repository is empty 20/60 ... ok 3/61 ... ok 3/62 ... ok 24/63 ... ok 27/64 ... ok 27/65 ... ok 27/66 ... ok 27/67 ... ok 27/68 ... ok 27/69 ... ok 15/70 ... ok 15/71 ... ok 35/73 ... ok 35/74 ... ok 12/75 ... ok 12/76 ... ok 12/77 ... ok 37/78 ... ok 37/79 ... ok 37/80 ... ok 39/81 ... ok 15/82 ... ok 3/83 ... ok 2/84 ... ok 12/85 ... ok 3/86 ... ok 40/87 ... ok 40/88 ... ok 3/89 ... ok 3/90 ... ok 3/91 ... ok 3/92 ... ok 3/93 ... ok 41/94 ... ok 42/95 ... ok 18/96 ... ok 44/97 ... ok 45/98 ... ok 45/99 ... ok 45/100 ... ok 45/101 ... ok 45/102 ... ok 45/103 ... ok 45/104 ... ok 45/105 ... ok 45/106 ... ok 45/107 ... ok 45/108 ... ok 45/109 ... ok 45/110 ... ok 46/111 ... ok 4/112 ... ok 3/113 ... ok 2/114 ... ok 47/115 ... ok 27/116 ... ok 18/117 ... ok 3/118 ... repository is empty 48/120 ... ok 48/121 ... ok 48/122 ... ok 48/123 ... ok 48/124 ... ok 2/125 ... ok 12/126 ... ok 48/127 ... ok 48/128 ... ok 48/129 ... ok 4/130 ... ok 47/131 ... repository is empty 4/132 ... ok 45/133 ... ok 48/135 ... ok 40/136 ... ok 48/137 ... ok 51/138 ... ok 52/139 ... ok 4/140 ... ok 4/141 ... ok 4/142 ... ok 4/143 ... repository is empty 48/144 ... ok 45/145 ... ok 2/148 ... repository is empty 12/149 ... repository is empty 54/150 ... ok 55/151 ... ok 54/152 ... ok 3/153 ... ok 48/154 ... ok 57/156 ... repository is empty Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Access to /var/opt/gitlab/.ssh/authorized_keys: OK Send ping to redis server: OK gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Reply by email ...
Reply by email is disabled in config/gitlab.yml
Checking Reply by email ... Finished
Checking LDAP ...
Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) { log removed } Checking LDAP ... Finished
Checking GitLab ...
Git configured with autocrlf=input? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config outdated? ... no Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory setup correctly? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) projects have namespace: ... 4/1 ... yes 10/4 ... yes 3/5 ... yes 12/14 ... yes 12/15 ... yes 12/16 ... yes 3/18 ... yes 10/19 ... yes 16/23 ... yes 12/24 ... yes 16/27 ... yes 17/30 ... yes 17/31 ... yes 18/32 ... yes 18/33 ... yes 18/34 ... yes 18/35 ... yes 20/43 ... yes 4/44 ... yes 16/45 ... yes 3/51 ... yes 23/52 ... yes 2/58 ... yes 20/60 ... yes 3/61 ... yes 3/62 ... yes 24/63 ... yes 27/64 ... yes 27/65 ... yes 27/66 ... yes 27/67 ... yes 27/68 ... yes 27/69 ... yes 15/70 ... yes 15/71 ... yes 35/73 ... yes 35/74 ... yes 12/75 ... yes 12/76 ... yes 12/77 ... yes 37/78 ... yes 37/79 ... yes 37/80 ... yes 39/81 ... yes 15/82 ... yes 3/83 ... yes 2/84 ... yes 12/85 ... yes 3/86 ... yes 40/87 ... yes 40/88 ... yes 3/89 ... yes 3/90 ... yes 3/91 ... yes 3/92 ... yes 3/93 ... yes 41/94 ... yes 42/95 ... yes 18/96 ... yes 44/97 ... yes 45/98 ... yes 45/99 ... yes 45/100 ... yes 45/101 ... yes 45/102 ... yes 45/103 ... yes 45/104 ... yes 45/105 ... yes 45/106 ... yes 45/107 ... yes 45/108 ... yes 45/109 ... yes 45/110 ... yes 46/111 ... yes 4/112 ... yes 3/113 ... yes 2/114 ... yes 47/115 ... yes 27/116 ... yes 18/117 ... yes 3/118 ... yes 48/120 ... yes 48/121 ... yes 48/122 ... yes 48/123 ... yes 48/124 ... yes 2/125 ... yes 12/126 ... yes 48/127 ... yes 48/128 ... yes 48/129 ... yes 4/130 ... yes 47/131 ... yes 4/132 ... yes 45/133 ... yes 48/135 ... yes 40/136 ... yes 48/137 ... yes 51/138 ... yes 52/139 ... yes 4/140 ... yes 4/141 ... yes 4/142 ... yes 4/143 ... yes 48/144 ... yes 45/145 ... yes 2/148 ... yes 12/149 ... yes 54/150 ... yes 55/151 ... yes 54/152 ... yes 3/153 ... yes 48/154 ... yes 57/156 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.1.0 ? ... yes (2.3.3) Your git bin path is "/opt/gitlab/embedded/bin/git" Git version >= 2.7.3 ? ... yes (2.11.1) Active users: 20
Checking GitLab ... Finished