【问题标题】:Run jobs when there are changes in a particular folder on feature branch, else run the job on master irrespective of the change当功能分支上的特定文件夹发生更改时运行作业,否则无论更改如何都在 master 上运行作业
【发布时间】:2019-11-30 19:36:26
【问题描述】:

我想检查我是否可以运行仅具有条件/更改的作业:当功能分支上的特定文件夹发生更改并且相同的作业应始终在主分支上运行时,无论更改条件如何遇到了。

thevers:
  stage: stage_1
  tags:
   - dind
   - stable
  before_script:
    - *install_grails_debian
  script:
    - ./grailsw clean-all --non-interactive
    - ./grailsw refresh-dependencies --non-interactive
    - ./grailsw maven-install
  only:
    changes:
      - thevers/**/*
  artifacts:
    name: "$CI_PROJECT_NAME-$CI_JOB_NAME-$CI_COMMIT_SHA"
    paths:
     - .m2/
    expire_in: 5 days
    when: always
  allow_failure: true

【问题讨论】:

    标签: git gitlab gitlab-ci git-branch jobs


    【解决方案1】:

    目前,完成您请求的唯一方法是复制该作业,其中一个作业指定 only:changes 部分,就像您现在拥有的一样,另一个指定:

    only:
      - master
    

    未来的版本将为 CI 作业引入更灵活的规则,这将使您更容易做到这一点。关注GitLab CE issue 60085

    【讨论】:

    • 很高兴它有帮助!如果这是您问题的正确答案,请接受答案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-27
    • 2020-08-11
    • 2020-01-28
    • 1970-01-01
    • 1970-01-01
    • 2020-05-17
    • 1970-01-01
    相关资源
    最近更新 更多