Slack service API returns "1" and "0" for boolean properties.
### Summary
Slack service API returns `"1"` and `"0"` for boolean properties `notify_only_broken_pipelines` and `notify_only_default_branch`, but should return `true` or `false`.
### Steps to reproduce
1.
<details>
<summary>Export environment variables for convenience</summary>
<pre>
export GITLAB_URL="https://gitlab.com/api/v4"
export GITLAB_TOKEN="put-token-here"
</pre>
</details>
1.
<details>
<summary>Create a new project</summary>
<pre>
curl -sS -XPOST "$GITLAB_URL/projects" \
-H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "example"}' | jq
{
"id": 7822153,
"description": null,
"name": "example",
...
}
</pre>
</details>
1.
<details>
<summary>Check Slack service</summary>
<pre>
curl -sS -XGET "$GITLAB_URL/projects/7822153/services/slack" \
-H "PRIVATE-TOKEN: $GITLAB_TOKEN" | jq
{
"id": null,
"title": "Slack notifications",
"created_at": null,
"updated_at": null,
"active": false,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"confidential_note_events": true,
"pipeline_events": true,
"wiki_page_events": true,
"job_events": true,
"properties": {
"notify_only_broken_pipelines": true,
"notify_only_default_branch": true
}
}
</pre>
</details>
1.
<details>
<summary>Turn off notification settings for Slack</summary>
<pre>
curl -sS -XPUT "$GITLAB_URL/projects/7822153/services/slack" \
-H "Content-Type: application/json" \
-H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
-d '{"webhook": "https://google.com", "notify_only_broken_pipelines": false, "notify_only_default_branch": false}' | jq
{
"id": 41006774,
"title": "Slack notifications",
"created_at": "2018-08-08T19:11:39.973Z",
"updated_at": "2018-08-08T19:11:39.973Z",
"active": true,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"confidential_note_events": true,
"pipeline_events": true,
"wiki_page_events": true,
"job_events": true,
"properties": {
"webhook": "https://google.com",
"notify_only_broken_pipelines": false,
"notify_only_default_branch": false
}
}
</pre>
</details>
1.
<details>
<summary>Disable Slack service</summary>
<pre>
curl -sS -XDELETE "$GITLAB_URL/projects/7822153/services/slack" \
-H "PRIVATE-TOKEN: $GITLAB_TOKEN"
</pre>
</details>
1.
<details>
<summary>Check Slack service again</summary>
<pre>
curl -sS -XGET "$GITLAB_URL/projects/7822153/services/slack" \
-H "PRIVATE-TOKEN: $GITLAB_TOKEN" | jq
{
"id": 41006774,
"title": "Slack notifications",
"created_at": "2018-08-08T19:11:39.973Z",
"updated_at": "2018-08-08T19:13:56.190Z",
"active": false,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"confidential_note_events": true,
"pipeline_events": true,
"wiki_page_events": true,
"job_events": true,
"properties": {
"webhook": null,
"username": null,
"notify_only_broken_pipelines": null,
"notify_only_default_branch": null,
"push_channel": null,
"issue_channel": null,
"confidential_issue_channel": null,
"merge_request_channel": null,
"note_channel": null,
"confidential_note_channel": null,
"tag_push_channel": null,
"pipeline_channel": null,
"wiki_page_channel": null
}
}
</pre>
</details>
1.
Go to GitLab UI, `https://gitlab.com/hypnoglow/example/services/slack/edit`, and
check "Active", "Notify only broken pipelines". Keep "Notify only default branch" unchecked.
Click "Save Changes".
1.
<details>
<summary>Check Slack service:</summary>
<pre>
curl -sS -XGET "$GITLAB_URL/projects/7822153/services/slack" \
-H "PRIVATE-TOKEN: $GITLAB_TOKEN" | jq
{
"id": 41006774,
"title": "Slack notifications",
"created_at": "2018-08-08T19:11:39.973Z",
"updated_at": "2018-08-08T19:16:49.899Z",
"active": true,
"push_events": true,
"issues_events": true,
"confidential_issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"confidential_note_events": true,
"pipeline_events": true,
"wiki_page_events": true,
"job_events": true,
"properties": {
"webhook": "https://google.com",
"username": "",
"notify_only_broken_pipelines": "1",
"notify_only_default_branch": "0",
"push_channel": "",
"issue_channel": "",
"confidential_issue_channel": "",
"merge_request_channel": "",
"note_channel": "",
"confidential_note_channel": "",
"tag_push_channel": "",
"pipeline_channel": "",
"wiki_page_channel": ""
}
}
</pre>
</details>
### Example Project
https://gitlab.com/hypnoglow/example
### What is the current *bug* behavior?
`notify_only_broken_pipelines` is a boolean property, but has a string values `"1"` or `"0"`.
### What is the expected *correct* behavior?
`notify_only_broken_pipelines` should be only either `true` or `false`.
### Output of checks
This bug happens on GitLab.com
issue