oto/agent-ops/rules/project/domain/pipeline/rules.md

3.8 KiB

domain last_rule_review_commit last_rule_updated_at
pipeline 810532a097 2026-06-24

pipeline

목적 / 책임

YAML에서 파싱된 DataCommand 리스트를 순차 실행하고, 조건 분기·반복·대기 등 파이프라인 흐름 제어를 담당한다. 외부 시스템 작업은 실행하지 않고, command ID를 찾아 커맨드 도메인으로 위임한다.

포함 경로

  • apps/runner/lib/oto/pipeline/ — 파이프라인 실행 엔진 전체
  • apps/runner/lib/oto/data/pipeline_data.dart — workflow, 조건, 반복, switch 등 pipeline 데이터 모델

제외 경로

  • apps/runner/lib/oto/commands/ — 실제 커맨드 구현체 (pipeline은 dispatch만 한다)
  • apps/runner/lib/oto/core/ — 태그 치환·데이터 합성 (pipeline 이전 단계)

주요 구성 요소

  • Pipeline — 커맨드 디스패치 루프
  • PipelineValidateResult — workflow 초기화/검증 결과와 실행 컨텍스트 보관
  • PipelineExecutor — 모든 pipeline 노드의 공통 베이스
  • PipelineExe — 단일 커맨드 실행 핸들
  • PipelineAsync — 단일 커맨드 비동기 실행 핸들
  • PipelineExeHandle — 실행 결과 처리
  • PipelineCondition — 조건 평가
  • PipelineIf / PipelineSwitch — 분기 흐름
  • PipelineForeach / PipelineWhile — 반복 흐름
  • PipelineContain — 중첩 파이프라인
  • PipelineWaitUntil / PipelineWaitUntilSeconds — 조건 기반 또는 초 단위 대기 흐름
  • DataPipeline, DataIf, DataForeach, DataWhile, DataSwitch, DataExeHandle — pipeline YAML 구조 검증/파싱 모델
  • StepEvent 기록 — Pipeline.execute()가 각 workflow task의 started/completed/failed event를 core ExecutionContext에 기록

유지할 패턴

  • 파이프라인 노드는 단일 책임: 흐름 제어만 한다, I/O는 커맨드에 위임
  • 새 흐름 제어 유형은 Pipeline* 네이밍으로 추가
  • 새 흐름 제어 유형은 Pipeline.exeMap에 등록하고, 필요한 데이터 모델은 apps/runner/lib/oto/data/pipeline_data.dart에 둔다
  • 파이프라인 validate 단계에서 workflow task key, command ID 존재 여부, 하위 task 구조를 가능한 한 먼저 확인한다
  • 조건식은 PipelineCondition의 type caster와 Command.replaceTagValue() 흐름을 유지한다
  • workflow task 실행 전후 event는 core ExecutionContext.addStepEvent()에 기록하고, event schema 자체는 core 도메인에서 관리한다
  • pipeline 변경 후 dart analyze를 실행하고, if/foreach/while/switch/wait-until 중 영향을 받는 샘플 YAML 파싱 또는 실행 테스트를 확인한다

다른 도메인과의 경계

  • command: PipelineCommand.byType()을 호출하는 시점이 경계. 커맨드 내부 로직은 pipeline이 모른다
  • command data: DataCommand와 커맨드 파라미터 모델은 command 도메인이고, workflow 흐름 모델인 pipeline_data.dart만 pipeline 도메인이다
  • core: DataComposer가 YAML → DataCommand 변환을 마친 후 pipeline이 실행 시작
  • core events: step event 저장소와 BuildResult 직렬화는 core 도메인이다. pipeline은 실행 지점에서 event를 추가만 한다
  • sample: workflow 문법 변경 시 apps/runner/assets/yaml/sample/02_*~05_*와 README 흐름 제어 예시를 함께 점검

금지 사항

  • pipeline 코드에서 외부 시스템(Git, Jenkins 등)을 직접 호출하지 않는다
  • 커맨드별 비즈니스 로직을 pipeline에 넣지 않는다
  • pipeline에서 파일 시스템, 네트워크, shell 실행을 직접 수행하지 않는다
  • command param의 세부 필드를 pipeline에서 해석하지 않는다
  • step event schema나 build result JSON schema를 pipeline 도메인에서 바꾸지 않는다