Continuous integration 不同阶段的Gitlab CI执行时间

Continuous integration 不同阶段的Gitlab CI执行时间,continuous-integration,gitlab,gitlab-ci,Continuous Integration,Gitlab,Gitlab Ci,我打赌这只是我遗漏了一些愚蠢的事情,但是我应该如何创建我的gitlab-ci.yml文件和时间表,以便每晚执行几个阶段(夜间测试),周末执行一次阶段(每周测试集) 目前我有如下设置: 我想每晚执行的所有阶段都是相似的,只是名字改变了 stage1: stage: stage1 only: - schedules script: - my execute script allow_failure: true artifacts: when: alwa

我打赌这只是我遗漏了一些愚蠢的事情,但是我应该如何创建我的gitlab-ci.yml文件和时间表,以便每晚执行几个阶段(夜间测试),周末执行一次阶段(每周测试集)

目前我有如下设置: 我想每晚执行的所有阶段都是相似的,只是名字改变了

stage1:
  stage: stage1
  only:
  - schedules

  script:
  - my execute script
  
  allow_failure: true
  
  artifacts:
   when: always
   paths:
    - stuff here
   reports:
     junit: filename here
我还有一个晚上执行的时间表,在晚上18:00触发执行

然后我有一个阶段,我想每周在周六上午10点执行一次:

stagex:
  stage: stagex
  only:
  - schedules
    - cron 0 10 * * 6

  script:
  - my execute script
  
  allow_failure: true
  
  artifacts:
   when: always
   paths:
    - stuff here
   reports:
     junit: filename here
上周六没有发生火灾。UI端没有单独的时间表。我应该把它放在那里吗?有关于如何让它工作的建议吗

另外,我希望能够从一个按钮执行第x阶段(每周),所以这需要时间表。如果gitlab通过其他方式启动它,它可以保持ofc的非活动状态。我尝试将变量设置到stage,并将它们放在UI端,但我没有让它以这种方式工作


有一点我肯定是遗漏了…

如果我理解了你的目标,你想知道吗

  • 仅在计划时执行阶段1(每日)
  • 仅在计划(每周)或手动管道运行时执行stagex
以下内容应能实现这一目标。您需要设置每日和每周的时间表。对于每周计划,您需要将计划的作业定义为“stagex”;设置时间表后,您可以按play,以便手动运行作业

variables:
  SCHEDULED_JOB: "stage1"

stage1:
  stage: stage1
  rules:
   - if: '$CI_PIPELINE_SOURCE == "schedule" && $SCHEDULED_JOB == $CI_JOB_NAME'

  script:
  - my execute script
  
  allow_failure: true
  
  artifacts:
   when: always
   paths:
    - stuff here
   reports:
     junit: filename here
     
    
stagex:
  stage: stagex
    - if: '$CI_PIPELINE_SOURCE == "schedule" && '$SCHEDULED_JOB == $CI_JOB_NAME'
  script:
  - my execute script
  
  allow_failure: true
  
  artifacts:
   when: always
   paths:
    - stuff here
   reports:
     junit: filename here