V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
caniuse
V2EX  ›  程序员

怎么搭建个环境,能让前端项目每次提交后自动部署到开发环境, jenkins 还是进后台点

  •  
  •   caniuse · Jul 26, 2017 · 9907 views
    This topic created in 3197 days ago, the information mentioned may be changed or developed.
    41 replies    2017-07-27 15:14:23 +08:00
    defunct9
        1
    defunct9  
       Jul 26, 2017
    webhook
    hellojl
        2
    hellojl  
       Jul 26, 2017
    Jenkins 可以配置成自动的
    mzeht
        3
    mzeht  
       Jul 26, 2017
    jenkins 上配置 git 的钩子 每次 pull 触发任务
    learnshare
        4
    learnshare  
       Jul 26, 2017
    每次提交有点过分,应该是每个 vertion tag 吧
    wanxi3
        5
    wanxi3  
       Jul 26, 2017
    Jenkins 完全可以达到你的要求
    caniuse
        6
    caniuse  
    OP
       Jul 26, 2017
    @learnshare 每次提交,反正构建也挺快的
    caniuse
        7
    caniuse  
    OP
       Jul 26, 2017
    @defunct9 @hellojl @mzeht @learnshare @wanxi3 小程序的 wx.removeStorageSync(KEY)会抛异常? 不想写 try catch
    119
        8
    119  
       Jul 26, 2017
    HOOK
    Ouyangan
        9
    Ouyangan  
       Jul 26, 2017
    花两分钟搜索下???
    Finest
        10
    Finest  
       Jul 26, 2017
    就不怕有 bug ?
    Charkey
        11
    Charkey  
       Jul 26, 2017
    Jenkins 配置钩子来触发呗。
    TeamCity 用比较多,可以配置通过 commit 来触发。
    MrMario
        12
    MrMario  
       Jul 26, 2017 via iPhone
    Jenkins 有 cli,可以远程调用
    caniuse
        13
    caniuse  
    OP
       Jul 26, 2017
    @hand515 测试环境就是为了测试 bug 用啊
    caniuse
        14
    caniuse  
    OP
       Jul 26, 2017
    @Charkey TeamCity 比 jenkins 好用吗?
    codermagefox
        15
    codermagefox  
       Jul 26, 2017
    @caniuse 是 vue,只是测试环境的话.
    http://note.codermagefox.com/blog/post/magefox/Jenkins%E8%87%AA%E5%8A%A8%E9%83%A8%E7%BD%B2Vue%E9%A1%B9%E7%9B%AE%E6%B5%8B%E8%AF%95%E7%8E%AF%E5%A2%83

    自己的博客自己写的文章,没触犯 v 站站规吧?被搞怕了
    winglight2016
        16
    winglight2016  
       Jul 26, 2017
    可以用 webhook,也可以 15 分钟自动 build 一回
    janxin
        17
    janxin  
       Jul 26, 2017
    jenkins 好难用啊,有没有人性化点的?
    zhlssg
        18
    zhlssg  
       Jul 26, 2017
    gitlab ci 也可以
    learnshare
        19
    learnshare  
       Jul 26, 2017
    @caniuse 微信提供的 API 不那么可靠
    Charkey
        20
    Charkey  
       Jul 26, 2017
    @caniuse @janxin 单纯做部署的可以试试 TeamCity,和 IntelliJ IDEA 一样是 JetBrains 的产品;如果能整个团队做相应的调整,可以试试 gitlab。
    suman
        21
    suman  
       Jul 26, 2017
    git,svn 都可以设置 hook, 比如 post-update, post-commit
    wingoo
        22
    wingoo  
       Jul 26, 2017
    做个定时脚本好了, 每几分钟 pull 一次
    Charkey
        23
    Charkey  
       Jul 26, 2017
    @hand515 我用过的 TeamCity,支持 Pre-test Commit,也就是提交时不是真正的提交,会执行指定的构建,构建成功后 TeamCity 会自动提交
    millercn
        24
    millercn  
       Jul 26, 2017
    Jenkins 不行吗
    zenxds
        25
    zenxds  
       Jul 26, 2017
    刚写了个 webhook,然后利用 git 的 archive 打包远程代码,再解压到目标目录实现的
    hl
        26
    hl  
       Jul 26, 2017
    你是运维么?
    caniuse
        27
    caniuse  
    OP
       Jul 26, 2017
    @hl 我现在是前端
    caniuse
        28
    caniuse  
    OP
       Jul 26, 2017
    @zenxds 直接 git clone 不就好了
    Mirachael
        29
    Mirachael  
       Jul 26, 2017
    gitlab 有个.gitlab-cli.yml ,用这个自定义 taghook,然后会触发 gitlab 的 runner 去执行,你在 yml 文件中定义的操作。
    zenxds
        30
    zenxds  
       Jul 26, 2017
    @caniuse 只对特定规则带版本的 tag push 才执行发布,线上的目录是带版本的,而且解压也只解静态目录
    timwei
        31
    timwei  
       Jul 26, 2017
    @caniuse

    不用 git clone 可能很多原因

    像是部属的环境并无法接触 git 远端

    或是不希望 git log、git remote 等等的信息洩漏


    当然如果部属的环境不考虑这些,直接 clone 也没毛病
    LioMore
        32
    LioMore  
       Jul 26, 2017
    我的思路是服务器上 git init --bare 一个空仓库,然后配置 git hook,post-receive 自动 checkout 代码

    本地配置好一个 git remote add dev [email protected]:repo.git

    需要部署的时候 git push dev master 就可以了

    这样应该可以满足需求,不过会出现一些安全上的问题吧,具体的我也不是很了解,请大家指点
    gdzzzyyy
        33
    gdzzzyyy  
       Jul 26, 2017
    SlipStupig
        34
    SlipStupig  
       Jul 26, 2017
    docker!
    hikarugo
        35
    hikarugo  
       Jul 26, 2017
    如果会 python 得话 。我用的 fabric。。。贼方便
    huangzxx
        36
    huangzxx  
       Jul 26, 2017
    jenkins
    gitlab-ci
    docker
    都可以
    leopku
        37
    leopku  
       Jul 26, 2017
    gitlab-ci 最新版可以配合 docker 一起玩
    nicevar
        38
    nicevar  
       Jul 27, 2017
    jenkins 配合 gitlab 非常方便,就是 gitlab 有点臃肿,看公司还是个人了,个人不用 gitlab 也行,直接根据 git 的 push 来发布,master 的分支只用来发版本,平时提交试用其他分支
    sunqi0928
        39
    sunqi0928  
       Jul 27, 2017
    jenkins + gitlab 会满足你的
    flashback313
        40
    flashback313  
       Jul 27, 2017
    gitlab-ci +1
    moskize
        41
    moskize  
       Jul 27, 2017
    简单:drone.io + docker。需要一台 vps
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   963 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 88ms · UTC 20:29 · PVG 04:29 · LAX 13:29 · JFK 16:29
    ♥ Do have faith in what you're doing.