olipo186 / Git-Auto-Deploy

Deploy your GitHub, GitLab or Bitbucket projects automatically on Git push events or webhooks using this small HTTP server written in Python. Continuous deployment in it's most simple form.
http://olipo186.github.io/Git-Auto-Deploy/
Other
1.39k stars 216 forks source link

Problem with WebHook on website #232

Open Kaczuc opened 5 years ago

Kaczuc commented 5 years ago

I also have a question about adding my own weebhook to the site

No matching projects

0 candidates matches the request

The URLs references in the webhook did not match any repository entry in the config. For this webhook to work, make sure you have at least one repository configured with one of the following URLs; git@gitlab.com:Kaczuc/testing.git, https://gitlab.com/Kaczuc/testing.git, git@gitlab.com:Kaczuc/testing.git

Received 'Push Hook' event from GitLab

Handling the request with GitLabRequestParser

Incoming request from 35.185.49.***:55594

I am aware that such a project does not exist is just an example of news because I do not want to show my main project

Letme commented 5 years ago

Well it seems like your url in the config is wrong so at least paste that part and change only reponame to testing.

If it is not public then you will need to add ssh keys

Kaczuc commented 5 years ago
  // Project configs
  "repositories": [
    {
      "url": "https://gitlab.com/robertoo2940/test/tree/master",
      "branch": "master",
      "remote": "origin",
      "path": "/home/TestBot",
      "deploy": "echo deploying"
    },
    {
      "url": "https://gitlab.com/robertoo2940/test",
      "path": "/home/TestBot"
    }
//  ,{
//      "url": "https://api.github.com/repos/olipo186/Git-Auto-Deploy",
//      "deploy": "echo deploying after pull request",
//      "filters": [
//        {
//          "type": "pull-request-filter",
//          "action": "closed",
//          "ref": "testing-branch"
//        }
//      ]
//    }
  ]
}
Letme commented 5 years ago

None of the urls there are same from which you woud clone. One is link to file tree on master and other is missing .git

Kaczuc commented 5 years ago

You will show me how it should look and conclude that this is how it should look https://gitlab.com/robertoo2940/test.git

Letme commented 5 years ago

That is what I see when I try to clone. I personally use ssh, so I dont know if https of private gitlab repo will even work as I assume it requires username and password to clone (but maybe it is public).

Kaczuc commented 5 years ago

So a friend changed the settings of gitlab to public thanks to that you can clone when you set up colonizing after SSH?

Tell me if what I gave you is correct

Letme commented 5 years ago

That seems like correct url for https yes.

I don't understand the last question about ssh.

Kaczuc commented 5 years ago

I mean, how to configure SSH

Letme commented 5 years ago

In rough: user that runs gitautodeploy generates ssh key and you copy public part of that key to deploy keys in gitlab and then enable that key in your repo and use ssh clone address instead of https.

I think readme in this repo has a bit more detailed description...

ThanhLD24 commented 4 years ago
  // Project configs
  "repositories": [
    {
      "url": "https://gitlab.com/robertoo2940/test/tree/master",
      "branch": "master",
      "remote": "origin",
      "path": "/home/TestBot",
      "deploy": "echo deploying"
    },
    {
      "url": "https://gitlab.com/robertoo2940/test",
      "path": "/home/TestBot"
    }
//  ,{
//      "url": "https://api.github.com/repos/olipo186/Git-Auto-Deploy",
//      "deploy": "echo deploying after pull request",
//      "filters": [
//        {
//          "type": "pull-request-filter",
//          "action": "closed",
//          "ref": "testing-branch"
//        }
//      ]
//    }
  ]
}

I encounter the same problem, I read Git-Auto-Deploy source code and I realize that if we declare only url in repositories config, that is not enough. When gitautodeploy check, sometimes (i don't know reason) the actual request URL what it got is the last path of URL (with your example: 'https://gitlab.com/robertoo2940/test' then it get 'test' ), then I see we have another config is match-url, if this config is declared, the script will check it first, you only need declare config "match-url":"test" below url config, it will work. like this:

"repositories": [ { "url": "https://gitlab.com/robertoo2940/test", "match-url": "test", "branch": "master", "remote": "origin", "path": "/home/TestBot", "deploy": "echo deploying" } ]