How to push code to multiple servers by Mercurial?

前端 未结 3 1930
[愿得一人]
[愿得一人] 2021-02-02 18:11

How can we push code to multiple servers? We have many servers which needs to have the same copy of the code. It is difficult to push to individual server. I know mercurial has

3条回答
  •  太阳男子
    2021-02-02 18:32

    i assume that one of the servers is a master repo, the rest are deployments. in such a situation, i would interact with just the master and leave the deployments up to cron:

    cat >$HOME/bin/dist <<'EOM'
    #!/bin/sh
    cd ${1:?}
    tip=$(hg tip --template '{node}')
    for r in $remotes; do
      hg push -r $tip $r
    done
    EOM
    
    chmod +x $HOME/bin/dist
    (crontab -l; echo '*/5 * * * * $HOME/bin/dist /var/repos/master') | crontab -
    

提交回复
热议问题