登录
ZH▾
语言
下载
测试版 此语言为测试版:由 AI 翻译和检查,尚未经过母语人士审校。 此页面尚未翻译,因此以英文显示。
文档 › 参考

流水线文件参考

.mcdock/pipeline.yml 的每项设置、作业获得的变量以及限制。

Pipelines are defined in .mcdock/pipeline.yml in the repository. They run on every push and merge, from the web page or through the API. Runners are the same MCDock program, started in runner mode on any Windows or Linux machine; they only make outbound connections.

stages: [build, test, deploy]

jobs:
  build:
    stage: build
    runs-on: [windows]
    shell: powershell
    script:
      - dotnet build -c Release
    artifacts: [bin/Release/**]

  test:
    stage: test
    script:
      - dotnet test --logger junit
    junit: [**/TestResults/*.xml]

  deploy-staging:
    stage: deploy
    environment: staging
    branches: [main, release/*]
    when: manual
    script:
      - ./deploy.ps1 -Target staging

Top level

SettingMeaning
stagesThe stages in order. Default: build, test, deploy. Each name only once.
jobsOne to 50 jobs, each a name followed by its settings. Names use letters, digits, spaces and - _ . : /.

Job settings

SettingMeaningDefault
stageOne of stages.the first stage
runs-onRunner labels the job needs, e.g. [windows].any runner
shellpowershell, pwsh, cmd, bash or sh.the runner's default
scriptThe commands, one per line. Required.
branchesBranches the job runs for; wildcards like release/* work.every branch
tagstrue to run for tag pushes too.false
whenon_success, manual (started by a person) or always.on_success
environmentDeploys to this environment; its approvals and allowed branches apply.
junitTest result files to read; results show on the pipeline and the pull request.
artifactsFiles to keep after the job.
timeoutMinutes, 1 to 1440.60
variablesNAME: value lines for this job.
allow-failuretrue so a failure doesn't fail the pipeline.false

An unknown setting stops the pipeline with the line number, so a typo never runs silently.

Variables every job gets

CI=true, MCDOCK_CI, MCDOCK_REPO, MCDOCK_REF, MCDOCK_BRANCH or MCDOCK_TAG, MCDOCK_SHA, MCDOCK_SHORT_SHA, MCDOCK_PIPELINE_ID, MCDOCK_JOB_ID, MCDOCK_JOB_NAME, MCDOCK_STAGE, MCDOCK_TRIGGERED_BY and MCDOCK_ENVIRONMENT.

Variables set in the job come next, then server, repository and environment variables (later ones win). Protected variables reach only protected branches and tags. Secret values are encrypted on the server and hidden in logs.

Limits

  • A job log keeps up to 10 MB; further output is dropped with a note.
  • Jobs are retried on request; each attempt is kept.

更新于 2026/11/24 · 缺少内容?请在此提问: 社区.