Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status audit descriptions are too long #72

Closed
bribroder opened this issue Apr 24, 2019 · 3 comments · Fixed by #73
Closed

Status audit descriptions are too long #72

bribroder opened this issue Apr 24, 2019 · 3 comments · Fixed by #73
Labels
bug Something isn't working

Comments

@bribroder
Copy link

Hi there,

Setting up policy-bot for the first time, I seem to be having a problem posting back status checks; running the server on debug mode shows that the github API is returning a 422 error for the description field of something:

2019-04-24T19:53:48.877708064Z |INFO| Server listening on 0.0.0.0:8080                           
2019-04-24T19:54:01.617921615Z |INFO| Received webhook event github_delivery_id=a076d8fe-66bf-11e9-90b4-5f63d75174d3 github_event_type=status rid=bj0btm9mqqplijrec0hg                                                                    
2019-04-24T19:54:01.619487450Z |WARN| Entity 'policy-bot[bot]' overwrote status check 'policy-bot: master' on ref=7f5271ba1aa085f8d62b55756e6b889b5af967f7 to status='pending' description='0/1 rules approved' targetURL='https://pbot.name.org/details/githuborg/reponame/54' audit=status github_delivery_id=a076d8fe-66bf-11e9-90b4-5f63d75174d3 github_event_type=status github_installation_id=865320 github_repository_name=reponame github_repository_owner=githuborg rid=bj0btm9mqqplijrec0hg
2019-04-24T19:54:01.836555577Z |DEBUG| github_request elapsed=216.917109 github_delivery_id=a076d8fe-66bf-11e9-90b4-5f63d75174d3 github_event_type=status github_installation_id=865320 github_repository_name=reponame github_repository_owner=githuborg method=POST path=https://api.github.com/repos/githuborg/reponame/statuses/7f5271ba1aa085f8d62b55756e6b889b5af967f7 rid=bj0btm9mqqplijrec0hg size=252 status=422                                                                                             
2019-04-24T19:54:01.837172027Z |ERROR| Unexpected error handling webhook request error="POST https://api.github.com/repos/githuborg/reponame/statuses/7f5271ba1aa085f8d62b55756e6b889b5af967f7: 422 Validation Failed [{Resource:Status Field:description Code:custom Message:description is too long (maximum is 140 characters)}]" github_delivery_id=a076d8fe-66bf-11e9-90b4-5f63d75174d3 github_event_type=status rid=bj0btm9mqqplijrec0hg                                                                            
2019-04-24T19:54:01.837235280Z |INFO| http_request elapsed=219.432713 method=POST path=/api/github/hook rid=bj0btm9mqqplijrec0hg size=22 status=500

.policy.yml

policy:                                                                                                                                                                                                                                                                             
  approval:
  - or:
    - deploy updates
    - submodule updates
    - at least one human approval

approval_rules:
- name: at least one human approval
  options:
    invalidate_on_push: true
  requires:
    count: 1

- name: deploy updates
  options:
    invalidate_on_push: true
  if: 
    only_changed_files:
      paths:
      - '^deploy/.*'

- name: submodule updates
  options:
    invalidate_on_push: true
  if: 
    only_changed_files:
      paths:
      - '^src/.*'

My server config is pretty standard-looking, I'm not sure what else to include to help identify the issue. Any ideas would be greatly appreciated.

@bluekeyes bluekeyes added the bug Something isn't working label Apr 24, 2019
@bluekeyes
Copy link
Member

It looks like you've discovered a bug in how we generate status messages. GitHub will only allow status descriptions up to 140 characters, but it looks like the code path for auditing status events can exceed this limit.

However, this code path shouldn't be triggered in normal operation. What value to you have set for the options.app_name property in your server configuration?

@bluekeyes bluekeyes changed the title Error handling webhook request Status audit descriptions are too long Apr 24, 2019
@bribroder
Copy link
Author

Thanks @bluekeyes! I had a generic app-name set:

# Options for application behavior
options:
  # The name of the application as registered with GitHub
  app_name: policy-bot

Changing it to match my GitHub app got things working. Great shooting.

@dbommi
Copy link

dbommi commented Sep 17, 2019

retest this please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants