• 请不要在回答技术问题时复制粘贴 AI 生成的内容
caniuse
V2EX  ›  程序员

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

  •  
  •   caniuse · Jul 26, 2017 · 10562 views
    This topic created in 3397 days ago, the information mentioned may be changed or developed.
    41 replies  •  2017-07-27 15:14:23 +08:00
    defunct9
    defunct9
    Jul 26, 2017
    1
    webhook
    hellojl
    hellojl
    Jul 26, 2017
    2
    Jenkins 可以配置成自动的
    mzeht
    mzeht
    Jul 26, 2017
    3
    jenkins 上配置 git 的钩子 每次 pull 触发任务
    learnshare
    learnshare
    Jul 26, 2017
    4
    每次提交有点过分,应该是每个 vertion tag 吧
    wanxi3
    wanxi3
    Jul 26, 2017
    5
    Jenkins 完全可以达到你的要求
    caniuse
    caniuse
    OP
    Jul 26, 2017
    6
    @learnshare 每次提交,反正构建也挺快的
    caniuse
    caniuse
    OP
    Jul 26, 2017
    7
    @defunct9 @hellojl @mzeht @learnshare @wanxi3 小程序的 wx.removeStorageSync(KEY)会抛异常? 不想写 try catch
    119
    119
    Jul 26, 2017
    8
    HOOK
    Ouyangan
    Ouyangan
    Jul 26, 2017
    9
    花两分钟搜索下???
    Finest
    Finest
    Jul 26, 2017
    10
    就不怕有 bug ?
    Charkey
    Charkey
    Jul 26, 2017
    11
    Jenkins 配置钩子来触发呗。
    TeamCity 用比较多,可以配置通过 commit 来触发。
    MrMario
    MrMario
    Jul 26, 2017 via iPhone
    12
    Jenkins 有 cli,可以远程调用
    caniuse
    caniuse
    OP
    Jul 26, 2017
    13
    @hand515 测试环境就是为了测试 bug 用啊
    caniuse
    caniuse
    OP
    Jul 26, 2017
    14
    @Charkey TeamCity 比 jenkins 好用吗?
    codermagefox
    codermagefox
    Jul 26, 2017
    15
    @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
    winglight2016
    Jul 26, 2017
    16
    可以用 webhook,也可以 15 分钟自动 build 一回
    janxin
    janxin
    Jul 26, 2017
    17
    jenkins 好难用啊,有没有人性化点的?
    zhlssg
    zhlssg
    Jul 26, 2017
    18
    gitlab ci 也可以
    learnshare
    learnshare
    Jul 26, 2017
    19
    @caniuse 微信提供的 API 不那么可靠
    Charkey
    Charkey
    Jul 26, 2017
    20
    @caniuse @janxin 单纯做部署的可以试试 TeamCity,和 IntelliJ IDEA 一样是 JetBrains 的产品;如果能整个团队做相应的调整,可以试试 gitlab。
    suman
    suman
    Jul 26, 2017
    21
    git,svn 都可以设置 hook, 比如 post-update, post-commit
    wingoo
    wingoo
    Jul 26, 2017
    22
    做个定时脚本好了, 每几分钟 pull 一次
    Charkey
    Charkey
    Jul 26, 2017
    23
    @hand515 我用过的 TeamCity,支持 Pre-test Commit,也就是提交时不是真正的提交,会执行指定的构建,构建成功后 TeamCity 会自动提交
    millercn
    millercn
    Jul 26, 2017
    24
    Jenkins 不行吗
    zenxds
    zenxds
    Jul 26, 2017
    25
    刚写了个 webhook,然后利用 git 的 archive 打包远程代码,再解压到目标目录实现的
    hl
    hl
    Jul 26, 2017
    26
    你是运维么?
    caniuse
    caniuse
    OP
    Jul 26, 2017
    27
    @hl 我现在是前端
    caniuse
    caniuse
    OP
    Jul 26, 2017
    28
    @zenxds 直接 git clone 不就好了
    Mirachael
    Mirachael
    Jul 26, 2017
    29
    gitlab 有个.gitlab-cli.yml ,用这个自定义 taghook,然后会触发 gitlab 的 runner 去执行,你在 yml 文件中定义的操作。
    zenxds
    zenxds
    Jul 26, 2017
    30
    @caniuse 只对特定规则带版本的 tag push 才执行发布,线上的目录是带版本的,而且解压也只解静态目录
    timwei
    timwei
    Jul 26, 2017
    31
    @caniuse

    不用 git clone 可能很多原因

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

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


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

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

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

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