only:xxx代表只有合到xxx分支时,会调用脚本。

stages:
  - build
  - test
  - deploy
打包文件:
  stage: build
  script:
    - echo "I am job"
    - rm -f /tmp/ctest.tar.gz
    - tar -czf /tmp/ctest.tar.gz *
  only:
    - local #只有dev分支提交代码才会执行这个任务。也可以是分支名称或触发器名称
    - test
    - master
  tags:
    - cocos #只有标签为XX的runner才会执行这个任务

本地测试服:
  stage: test
  script:
    - scp /tmp/ctest.tar.gz root@"$test":/tmp/
    - ssh root@"$test" "sh /home/sh/cocos-ctest.sh"
  only:
    - local #只有dev分支提交代码才会执行这个任务。也可以是分支名称或触发器名称
  tags:
    - cocos
    

标签: none

添加新评论