Skip to main content

Is there a way to automatically pull from GitHub?

Comments

9 comments

  • cPanelLauren
    Hi @angelleye We're really happy you like the new feature! Does the documentation here: Guide to Git - Deployment - cPanel Knowledge Base - cPanel Documentation help answer your question? Thanks!
    0
  • angelleye
    It says this... [QUOTE]Generally, deployment sends finished code into production. You can use different configurations to automatically (push deployment) or manually (pull deployment) deploy changes.
    So this seems to be a guide on pushing these repos out to other repos, but what I'm looking is automated pulling of a remote repo (GitHub) into this one. All I need is for exactly what happens when I manually push the "Update" button to happen automatically.
    0
  • cPanelLauren
    HI @angelleye Yea after discussing this with some others I don't think the direction you want to go is present natively right now. The API functions that are associated with this are: UAPI Modules - VersionControl - Developer Documentation - cPanel Documentation You might be able to use the UAPI here to automate something or a git post-commit hook but you'd need a cPanel session to do so. Thanks!
    0
  • angelleye
    Yeah, I found this: github.com/olipo186/Git-Auto-Deploy We should be able to make it happen this way, but it would sure be a nice feature to have built in. It's so close right now! :) Does that Update button inside each of the Git repos trigger a particular script that I could hook up to a CRON job?
    0
  • cPanelLauren
    Hi @angelleye After speaking with the Product Owner for that team I believe that the specific API function that is being triggered is UAPI Functions - VersionControl::update - Developer Documentation - cPanel Documentation which you should be able to add to a script in for a cron to do what you want. I also want to encourage you to open a feature request on this, we did have the feature request here Allow users to install websites from version control which included webhooks originally: [QUOTE]Re webhooks - Already planning to provide webhook URLs for repositories which enable deployment! We're intending to offer them on all repositories that enable deployment. If you don't want to use them in to integrate deployments, you can still bookmark them and they'll work all the same.
    The comments from cPanelAdamF are super informative on the plan for this in the future as well but if you want to see the functionality in the product we strongly advise a feature request. If you do end up opening it please post the link here so others can vote on it as well. Thanks!
    0
  • cPanelAdamF
    I'll add an important thing to @cPanelLauren's reply: Sending the branch parameter to that Update API call will cause a git pull to occur in order to ensure that it's got the latest from your remote. This is new behavior as of v74. ...and I'll definitely echo @cPanelLauren's guidance to engage with us on a feature request for official webhook support. We were not able to get it done for v74 so we shipped without it. The product management team inside cPanel pays very close attention to that feature request site!
    0
  • Gojko
    Hello, i'm looking how to make this one. So tried to run cron job: /usr/bin/uapi VersionControl update name=test repository_root=/home/user/public_html/test branch=master source_repository='{"remote_name":"origin"}'
    and i got: --- apiversion: 3 func: update module: VersionControl result: data: available_branches: - master branch: master clone_urls: read_only: [] read_write: [] deployable: 0 last_deployment: ~ last_update: author: author <111+user@users.noreply.github.com> date: '1540507571' identifier: e6175a616d542c6acf4bce690b7f772911ccb2 message: Create fff.txt name: test repository_root: /home/user/public_html/test source_repository: remote_name: origin url: https://github.com/user/test.git tasks: [] type: git errors: ~ messages: ~ metadata: {} status: 1 warnings: ~
    i get the same thing if i use php, cURL login to php and run session url from : UAPI Functions - VersionControl::update - Developer Documentation - cPanel Documentation response: { "status":1, "messages":null, "errors":null, "metadata":{}, "data":{ "source_repository": {"remote_name": "origin", "url":"https://github.com/user/test.git" }, "deployable":0, "name":"test", "repository_root":"/home/wuser/public_html/test", "available_branches":["master">, "clone_urls": { "read_only":[], "read_write":[] }, "branch":"master", "tasks":[], "last_update": { "date":"111111", "author":"user <15720022+user@users.noreply.github.com>", "message":"Create fff.txt", "identifier":"e6175a616d542c6acf4bce690b7f77291d41c2" }, "type":"git", "last_deployment":null }, "warnings":null }
    0
  • cPanelAdamF
    A question for you before I ask more diagnostic questions: I see "
    0
  • Gojko
    Yes, and worked ok trough cPanel Git Version Control Option.
    0

Please sign in to leave a comment.