如何防止同一个.travis.yml需要一遍又一遍地复制到每个仓库?

时间:2016-07-31 14:59:00

标签: travis-ci

背景:目前有多个模块:puppet-sftppuppet-gitpuppet-packerpuppet-otto使用相同的.travis。 YML。

目标:创建common .travis.yml而不是一遍又一遍地复制

方法:

  1. 已创建common git repo
  2. 使用travis 在每个项目中克隆
  3. This repo

    结果:

    The command "ls" exited with 0.
    
    $ npm ansible-common-test/test
    
    Usage: npm <command>
    
    where <command> is one of:
    
        add-user, adduser, apihelp, author, bin, bugs, c, cache,
    
        completion, config, ddp, dedupe, deprecate, docs, edit,
    
        explore, faq, find, find-dupes, get, help, help-search,
    
        home, i, info, init, install, isntall, issues, la, link,
    
        list, ll, ln, login, ls, outdated, owner, pack, prefix,
    
        prune, publish, r, rb, rebuild, remove, repo, restart, rm,
    
        root, run-script, s, se, search, set, show, shrinkwrap,
    
        star, stars, start, stop, submodule, t, tag, test, tst, un,
    
        uninstall, unlink, unpublish, unstar, up, update, v,
    
        version, view, whoami
    

    ATTEMPT2

    $ sh ansible-common-test/test.sh
    
    ansible-common-test/test.sh: 4: ansible-common-test/test.sh: ---: not found
    
    ansible-common-test/test.sh: 5: ansible-common-test/test.sh: sudo:: not found
    
    ansible-common-test/test.sh: 7: ansible-common-test/test.sh: env:: not found
    
    ansible-common-test/test.sh: 8: ansible-common-test/test.sh: -: not found
    
    ansible-common-test/test.sh: 9: ansible-common-test/test.sh: version:: not found
    
    ansible-common-test/test.sh: 10: ansible-common-test/test.sh: init:: not found
    
    ansible-common-test/test.sh: 11: ansible-common-test/test.sh: run_opts:: not found
    
    ansible-common-test/test.sh: 13: ansible-common-test/test.sh: services:: not found
    
    ansible-common-test/test.sh: 14: ansible-common-test/test.sh: -: not found
    
    ansible-common-test/test.sh: 16: ansible-common-test/test.sh: before_install:: not found
    
    ansible-common-test/test.sh: 18: ansible-common-test/test.sh: -: not found
    
    ansible-common-test/test.sh: 20: ansible-common-test/test.sh: -: not found
    
    ansible-common-test/test.sh: 22: ansible-common-test/test.sh: script:: not found
    
    ansible-common-test/test.sh: 23: ansible-common-test/test.sh: -: not found
    
    ansible-common-test/test.sh: 25: ansible-common-test/test.sh: -: not found
    
    ansible-common-test/test.sh: 31: ansible-common-test/test.sh: -: not found
    
    ansible-common-test/test.sh: 34: ansible-common-test/test.sh: -: not found
    
    ansible-common-test/test.sh: 38: ansible-common-test/test.sh: Syntax error: newline unexpected
    

    讨论:

    来自.travis.yml的重复代码被移动到一个公共仓库,既不能运行.sh也不能运行yml。无论尝试什么,似乎都无法从通用仓库运行travis代码以避免代码重复。

    期望如下:

    1. 包含每个仓库使用的.travis.yml的公共仓库由travis克隆
    2. 运行公共代码

0 个答案:

没有答案