jtarchie / github-pullrequest-resource

Provides a Github pull request resource for concourse CI.
MIT License
141 stars 102 forks source link

Status Update – 404 Not Found #208

Closed jamesgoodhouse closed 6 years ago

jamesgoodhouse commented 6 years ago

Describe the bug I have a put task that is resulting in a 404 Not Found from GitHub. The get is working fine. This is a GitHub enterprise installation, and I have the api_endpoint set for the resource.

The error:

Identity added: /tmp/git-resource-private-key (/tmp/git-resource-private-key)
/usr/lib/ruby/gems/2.4.0/gems/octokit-4.8.0/lib/octokit/response/raise_error.rb:16:in `on_complete': POST https://example.com/api/v3/repos/my-org/my-repo/statuses/51294f673847bde891697018c6abb13c24e7c93e: 404 - Not Found // See: https://developer.github.com/enterprise/2.14/v3/repos/statuses/#create-a-status (Octokit::NotFound)
    from /usr/lib/ruby/gems/2.4.0/gems/faraday-0.14.0/lib/faraday/response.rb:9:in `block in call'
    from /usr/lib/ruby/gems/2.4.0/gems/faraday-0.14.0/lib/faraday/response.rb:61:in `on_complete'
    from /usr/lib/ruby/gems/2.4.0/gems/faraday-0.14.0/lib/faraday/response.rb:8:in `call'
    from /usr/lib/ruby/gems/2.4.0/gems/faraday-http-cache-2.0.0/lib/faraday/http_cache.rb:146:in `call!'
    from /usr/lib/ruby/gems/2.4.0/gems/faraday-http-cache-2.0.0/lib/faraday/http_cache.rb:115:in `call'
    from /usr/lib/ruby/gems/2.4.0/gems/faraday-0.14.0/lib/faraday/rack_builder.rb:143:in `build_response'
    from /usr/lib/ruby/gems/2.4.0/gems/faraday-0.14.0/lib/faraday/connection.rb:387:in `run_request'
    from /usr/lib/ruby/gems/2.4.0/gems/faraday-0.14.0/lib/faraday/connection.rb:175:in `post'
    from /usr/lib/ruby/gems/2.4.0/gems/sawyer-0.8.1/lib/sawyer/agent.rb:94:in `call'
    from /usr/lib/ruby/gems/2.4.0/gems/octokit-4.8.0/lib/octokit/connection.rb:156:in `request'
    from /usr/lib/ruby/gems/2.4.0/gems/octokit-4.8.0/lib/octokit/connection.rb:28:in `post'
    from /usr/lib/ruby/gems/2.4.0/gems/octokit-4.8.0/lib/octokit/client/statuses.rb:43:in `create_status'
    from /usr/lib/ruby/gems/2.4.0/gems/octokit-4.8.0/lib/octokit.rb:46:in `method_missing'
    from /opt/resource/lib/status.rb:15:in `create!'
    from /opt/resource/lib/commands/out.rb:59:in `block in output'
    from /opt/resource/lib/commands/out.rb:52:in `each'
    from /opt/resource/lib/commands/out.rb:52:in `output'
    from /opt/resource/lib/commands/out.rb:117:in `<main>'

To Reproduce

resources:
  - name: my-repo-pr
    type: pull-request
    check_every: 5s
    source:
      access_token: {{github_bot_access_key}}
      private_key:  {{jenkins_build_bot_private_key}}
      uri:          git@example.com:my-org/my-repo.git
      api_endpoint: https://example.com/api/v3/
      repo:         my-org/my-repo
      base:         concourse

jobs:
  - name: Check PR
    plan:
      - get: my-repo-pr
        trigger: true
      - put: my-repo-pr
        params:
          path: my-repo-pr
          status: pending

Expected behavior I expect this to successfully update the status.

jtarchie commented 6 years ago

This is usually associated with you access token not having the correct permissions. Please see the README for the permissions to have enabled.

jamesgoodhouse commented 6 years ago

@jtarchie: That was it! The Not Found took me down the wrong path. Sorry about that, and thanks for your help!