Bug 1305665

Summary: Problem with configuring webhook for github -302 document has moved
Product: [Community] Copr Reporter: Przemo Firszt <przemo>
Component: frontendAssignee: Miroslav Suchý <msuchy>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: clime
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-30 12:31:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Full payload of the request none

Description Przemo Firszt 2016-02-08 20:34:55 UTC
Description of problem:
I can't configure properly copr with github link. copr gives me this webhook URL for github:
 https://copr.fedoraproject.org/webhooks/github/5388/e36ad2eb-4611-4a82-8c77-bb50915317fc/ 
But it fails with 302:
Request:
Headers

Request URL: https://copr.fedoraproject.org/webhooks/github/5388/e36ad2eb-4611-4a82-8c77-bb50915317fc
Request method: POST
content-type: application/json
Expect: 
User-Agent: GitHub-Hookshot/21f57ba
X-GitHub-Delivery: 24f7a700-ce9f-11e5-9de8-e8a0c1e6d04d
X-GitHub-Event: push

Response:
Content-Length: 381
Content-Type: text/html; charset=iso-8859-1
Date: Mon, 08 Feb 2016 20:10:49 GMT
Location: https://copr.fedorainfracloud.org/webhooks/github/5388/e36ad2eb-4611-4a82-8c77-bb50915317fc
Server: Apache/2.4.6 (Red Hat Enterprise Linux)

Body

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://copr.fedorainfracloud.org/webhooks/github/5388/e36ad2eb-4611-4a82-8c77-bb50915317fc">here</a>.</p>
<hr>
<address>Apache/2.4.6 (Red Hat Enterprise Linux) Server at copr.fedoraproject.org Port 443</address>
</body></html>

Version-Release number of selected component (if applicable):


How reproducible:
Try to set up github wehhook to build a package with copr


Steps to Reproduce:
As per copr manual for webhooks. Default source was set to: https://github.com/PrzemoF/FreeCAD.git

1.    In your GitHub project, go to Settings / Webhooks and services.
2.    Click on the Add webhook button.
3.    Fill in the Payload URL field with the url above.
4.    Click the Add webhook button.

Actual results:
302 The document has moved

Expected results:
copr build with lastest github revision of the repository

Additional info:
The address provided by error 302 is identical as the request address.

Full payload of the request attached

Comment 1 Przemo Firszt 2016-02-08 20:57:30 UTC
There was a problem with attaching payload, so it's here:
{
  "ref": "refs/heads/fedora_master",
  "before": "939164101a308d0b201bcc02cb7d4534dd0e356e",
  "after": "ea6bd3c38179b269f2d0dad366aefc220eeb4b74",
  "created": false,
  "deleted": false,
  "forced": false,
  "base_ref": null,
  "compare": "https://github.com/PrzemoF/FreeCAD/compare/939164101a30...ea6bd3c38179",
  "commits": [
    {
      "id": "ea6bd3c38179b269f2d0dad366aefc220eeb4b74",
      "distinct": true,
      "message": "copr: fedora.spec cleaning\n\nSigned-off-by: Przemo Firszt <przemo>",
      "timestamp": "2016-02-08T20:04:17Z",
      "url": "https://github.com/PrzemoF/FreeCAD/commit/ea6bd3c38179b269f2d0dad366aefc220eeb4b74",
      "author": {
        "name": "Przemo Firszt",
        "email": "przemo",
        "username": "PrzemoF"
      },
      "committer": {
        "name": "Przemo Firszt",
        "email": "przemo",
        "username": "PrzemoF"
      },
      "added": [

      ],
      "removed": [

      ],
      "modified": [
        "package/fedora/freecad.spec"
      ]
    }
  ],
  "head_commit": {
    "id": "ea6bd3c38179b269f2d0dad366aefc220eeb4b74",
    "distinct": true,
    "message": "copr: fedora.spec cleaning\n\nSigned-off-by: Przemo Firszt <przemo>",
    "timestamp": "2016-02-08T20:04:17Z",
    "url": "https://github.com/PrzemoF/FreeCAD/commit/ea6bd3c38179b269f2d0dad366aefc220eeb4b74",
    "author": {
      "name": "Przemo Firszt",
      "email": "przemo",
      "username": "PrzemoF"
    },
    "committer": {
      "name": "Przemo Firszt",
      "email": "przemo",
      "username": "PrzemoF"
    },
    "added": [

    ],
    "removed": [

    ],
    "modified": [
      "package/fedora/freecad.spec"
    ]
  },
  "repository": {
    "id": 32345469,
    "name": "FreeCAD",
    "full_name": "PrzemoF/FreeCAD",
    "owner": {
      "name": "PrzemoF",
      "email": "przemo"
    },
    "private": false,
    "html_url": "https://github.com/PrzemoF/FreeCAD",
    "description": "mirror of the FreeCAD sf.net git master branch. Clone this one if you want to start FreeCAD development!  ",
    "fork": true,
    "url": "https://github.com/PrzemoF/FreeCAD",
    "forks_url": "https://api.github.com/repos/PrzemoF/FreeCAD/forks",
    "keys_url": "https://api.github.com/repos/PrzemoF/FreeCAD/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/PrzemoF/FreeCAD/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/PrzemoF/FreeCAD/teams",
    "hooks_url": "https://api.github.com/repos/PrzemoF/FreeCAD/hooks",
    "issue_events_url": "https://api.github.com/repos/PrzemoF/FreeCAD/issues/events{/number}",
    "events_url": "https://api.github.com/repos/PrzemoF/FreeCAD/events",
    "assignees_url": "https://api.github.com/repos/PrzemoF/FreeCAD/assignees{/user}",
    "branches_url": "https://api.github.com/repos/PrzemoF/FreeCAD/branches{/branch}",
    "tags_url": "https://api.github.com/repos/PrzemoF/FreeCAD/tags",
    "blobs_url": "https://api.github.com/repos/PrzemoF/FreeCAD/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/PrzemoF/FreeCAD/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/PrzemoF/FreeCAD/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/PrzemoF/FreeCAD/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/PrzemoF/FreeCAD/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/PrzemoF/FreeCAD/languages",
    "stargazers_url": "https://api.github.com/repos/PrzemoF/FreeCAD/stargazers",
    "contributors_url": "https://api.github.com/repos/PrzemoF/FreeCAD/contributors",
    "subscribers_url": "https://api.github.com/repos/PrzemoF/FreeCAD/subscribers",
    "subscription_url": "https://api.github.com/repos/PrzemoF/FreeCAD/subscription",
    "commits_url": "https://api.github.com/repos/PrzemoF/FreeCAD/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/PrzemoF/FreeCAD/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/PrzemoF/FreeCAD/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/PrzemoF/FreeCAD/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/PrzemoF/FreeCAD/contents/{+path}",
    "compare_url": "https://api.github.com/repos/PrzemoF/FreeCAD/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/PrzemoF/FreeCAD/merges",
    "archive_url": "https://api.github.com/repos/PrzemoF/FreeCAD/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/PrzemoF/FreeCAD/downloads",
    "issues_url": "https://api.github.com/repos/PrzemoF/FreeCAD/issues{/number}",
    "pulls_url": "https://api.github.com/repos/PrzemoF/FreeCAD/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/PrzemoF/FreeCAD/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/PrzemoF/FreeCAD/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/PrzemoF/FreeCAD/labels{/name}",
    "releases_url": "https://api.github.com/repos/PrzemoF/FreeCAD/releases{/id}",
    "deployments_url": "https://api.github.com/repos/PrzemoF/FreeCAD/deployments",
    "created_at": 1426531425,
    "updated_at": "2016-02-07T16:34:16Z",
    "pushed_at": 1454961862,
    "git_url": "git://github.com/PrzemoF/FreeCAD.git",
    "ssh_url": "git:PrzemoF/FreeCAD.git",
    "clone_url": "https://github.com/PrzemoF/FreeCAD.git",
    "svn_url": "https://github.com/PrzemoF/FreeCAD",
    "homepage": null,
    "size": 271874,
    "stargazers_count": 2,
    "watchers_count": 2,
    "language": "C++",
    "has_issues": false,
    "has_downloads": true,
    "has_wiki": false,
    "has_pages": false,
    "forks_count": 1,
    "mirror_url": null,
    "open_issues_count": 0,
    "forks": 1,
    "open_issues": 0,
    "watchers": 2,
    "default_branch": "master",
    "stargazers": 2,
    "master_branch": "master"
  },
  "pusher": {
    "name": "PrzemoF",
    "email": "przemo"
  },
  "sender": {
    "login": "PrzemoF",
    "id": 2077043,
    "avatar_url": "https://avatars.githubusercontent.com/u/2077043?v=3",
    "gravatar_id": "",
    "url": "https://api.github.com/users/PrzemoF",
    "html_url": "https://github.com/PrzemoF",
    "followers_url": "https://api.github.com/users/PrzemoF/followers",
    "following_url": "https://api.github.com/users/PrzemoF/following{/other_user}",
    "gists_url": "https://api.github.com/users/PrzemoF/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/PrzemoF/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/PrzemoF/subscriptions",
    "organizations_url": "https://api.github.com/users/PrzemoF/orgs",
    "repos_url": "https://api.github.com/users/PrzemoF/repos",
    "events_url": "https://api.github.com/users/PrzemoF/events{/privacy}",
    "received_events_url": "https://api.github.com/users/PrzemoF/received_events",
    "type": "User",
    "site_admin": false
  }
}

Comment 2 clime 2016-02-09 13:50:31 UTC
Thanks! We will at least fix the webhook url hint so that it uses the new domain fedorainfracloud.

You can change your webhook url setup in git to https://copr.fedorainfracloud.org/webhooks/github/5388/e36ad2eb-4611-4a82-8c77-bb50915317fc which is the referenced 302 location but you have probably already figured that out.

Comment 3 Miroslav Suchý 2016-03-30 12:31:52 UTC
WebUI now correctly print https://copr.fedorainfracloud.org
If you already created webhook with url to copr.fedoraproject.org, you have to alter them.