一個golang寫的部署GitHub上最新代碼到服務器上的小工具:GoShip

jopen 9年前發布 | 33K 次閱讀 GoShip Git 版本控制系統

GoShip是一個golang寫的部署GitHub上最新代碼到服務器上的小工具。

GoShip SSHes into the machines that you list in ETCD and gets the latest revision from the specified git repository. It then compares that to the latest revision on GitHub and, if they differ, shows a link to the diff as well as a Deploy button. You can then deploy by clicking the button, and will show you the output of the deployment command, as well as save the output, diff, and whether the command succeeded.

一個golang寫的部署GitHub上最新代碼到服務器上的小工具:GoShip

Installation

  1. Install go development environment
  2. rungo get github.com/gengo/goship
  3. rungo build github.com/gengo/goship

Usage

  1. Export your GitHub API token:

    export GITHUB_API_TOKEN="your-organization-github-token-here"
  2. Github Omniauth Integration:

    Users who are collaborator on a repo can 'see' that repo in Goship. You must create a developer application to use omniauth. If you do NOT add the appropriate env keys below AUTH will be OFF I.E. Please be careful and check the logs. Please note the "Authorization callback URL" should match your site i.e.http://<your-url-and-port>/auth/github/callback.

    export GITHUB_RANDOM_HASH_KEY="some-random-hash-here";
    export GITHUB_OMNI_AUTH_ID="github-application-id";
    export GITHUB_OMNI_AUTH_KEY="github-application-key";
    export GITHUB_CALLBACK_URL="http://<your-url-and-port>";  // must match that given to Github! Would be 127.0.0.1:port for testing

    If authentication is 'turned on', organization 'team' members who are collaborators and exclusively on a 'pull' only team will be able to see a repo, however the deploy button will be diasbled for them.

  3. Create an etcd server

    1. Follow the instructions in the etcd README
    2. Write configurations in YAML.
    3. Store the configuration into etcd withgoshipcfgin tools
      • You can also directly access to etcd entries for small amount of change.
        • etcd exposes a single set of APIs. [reference]. There are many tools to call the APIs, e.g. etcdctl.

項目主頁:http://www.baiduhome.net/lib/view/home/1447653914322

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!