No description
- Split BuildIOS command into build_ios_archive and build_ios_build - Split Git command into git_branch, git_remote, git_revision, git_stash - Add cli_style.dart and printer.dart for consistent CLI output - Add macos_signing.dart for macOS/iOS code signing - Refactor pipeline system (pipeline, pipeline_condition, pipeline_contain, etc.) - Update tag_system, defined_data, pipeline_data - Update application and command files for new structure - Add tests for new command catalog and core functionality - Update README with new features |
||
|---|---|---|
| .antigravitycli | ||
| .claude | ||
| .gemini | ||
| .vscode | ||
| agent-ops | ||
| agent-task/archive/2026/05 | ||
| assets | ||
| bin | ||
| lib | ||
| test | ||
| .clinerules | ||
| .codex | ||
| .cursorrules | ||
| .gitignore | ||
| AGENTS.md | ||
| analysis_options.yaml | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| GEMINI.md | ||
| pubspec.yaml | ||
| README.md | ||
OTO CLI
YAML로 정의된 CI/CD 파이프라인을 실행하는 Dart 기반 자동화 도구. Jenkins, FTP, Git, Slack/Mattermost, iOS/Flutter/Android 빌드 등 다양한 작업을 커맨드로 추상화하고, 파이프라인 엔진이 순차 실행한다.
설치
dart pub get
dart compile exe bin/main.dart -o oto
실행 모드
| 플래그 | 모드 | 설명 |
|---|---|---|
-j |
jenkins |
Jenkins 환경 변수에서 워크스페이스·YAML 읽기 |
-t |
test |
하드코딩된 테스트 데이터로 로컬 실행 |
-f <path> |
file |
지정한 YAML 파일 경로에서 파이프라인 실행 |
| (daemon) | scheduler |
스케줄러 데몬 모드 |
oto -j # Jenkins CI 모드
oto -t # 로컬 테스트 모드
oto -f ./build.yaml # 파일 기반 실행
실행 흐름
bin/main.dart
└── Application (singleton)
└── DataComposer ← YAML + Jenkins env 파싱
└── Pipeline
└── Command.byType(CommandType) → execute(DataCommand)
YAML 파이프라인 구조
property:
workspace: /path/to/project
version: 1.0.0
env: prod
commands:
- command: BuildiOS
id: buildApp
param:
workspacePath: <!property.workspace>/ios/Runner.xcworkspace
scheme: Runner
pipeline:
workflow:
- exe: buildApp
태그 시스템
| 태그 | 방향 | 설명 |
|---|---|---|
<!property.key> |
읽기 | property에서 값 치환 |
<@property.key> |
쓰기 | 커맨드 결과를 property에 저장 |
- 태그가 문자열 전체이면 원본 타입(List, Map 등) 유지
- 태그가 문자열 일부이면
toString()변환 - 중첩 접근 지원:
<!property.build.version>
파이프라인 흐름 제어
exe — 단순 실행
- exe: buildApp
exe-handle — 성공/실패 분기
- exe-handle:
id: uploadArtifact
on-success:
- exe: notifySuccess
on-fail:
- exe: notifyError
if — 조건 분기
- if:
condition-string: "<!property.env> == prod"
on-true:
- exe: deployProd
on-false:
- exe: deployDev
지원 연산자: ==, !=, <, <=, >, >=
지원 타입: string, int, float, bool, date, version, object
foreach — 반복
- foreach:
iterator: <!property.platforms> # List 또는 Map
setValue: <@property.target>
on-do:
- exe: buildTarget
while — 조건 루프
- while:
condition-int: <!property.retry> < 3
on-do:
- exe: checkStatus
switch — 멀티 케이스
- switch:
condition-string: <!property.env>
cases:
- value: prod
tasks:
- exe: deployProd
- value: dev
tasks:
- exe: deployDev
wait-until — 대기
- async: buildStep
- wait-until-string: <!state.buildStep> != complete
async — 비동기 실행
- async: notifyStart # 완료를 기다리지 않고 다음 단계 진행
커맨드 카탈로그
등록된 커맨드는 Command.specs와 Command.catalogRows가 단일 진실 소스다.
샘플은 assets/yaml/sample/**에서 확인한다.
데이터 모델 구조
모든 커맨드 파라미터는 DataParam을 상속한다.
DataParam
├── workspace?: String // 기본 작업 디렉토리
├── passExitCodes?: List<int> // 성공으로 간주할 exit code
├── setResult?: String // 결과 저장 태그
├── setExitCode?: String // exit code 저장 태그
└── showPrint?: bool
// 예시
DataBuildiOS extends DataParam {
workspacePath: String
scheme: String
destination: String
...
}
워크스페이스 해석 우선순위:
param.workspaceproperty.workspaceDataCommon.workspace(Jenkins env)
새 커맨드 추가
1. lib/oto/data/*.dart DataParam 상속 모델 정의 + @JsonSerializable
2. lib/oto/commands/command.dart CommandType enum에 값 추가
3. lib/oto/commands/{category}/ Command 상속 클래스 구현
4. Command.register(..., spec: CommandSpec(type, category, dataModel, samplePath))에 구현체 등록
5. lib/oto/commands/command_registry.dart registerAllCommands()에 등록 함수 연결
6. dart run build_runner build *.g.dart 생성
등록된 커맨드 목록: Command.catalogRows (category별 정렬)
스케줄러
oto scheduler -r build.yaml # 스케줄러 등록
oto scheduler -l # 목록 조회
oto scheduler -e <alias> true # 활성화/비활성화
oto scheduler -u <alias> # 해제
YAML 스케줄러 설정:
scheduler:
alias: nightly-build
cron: "0 2 * * *" # cron 표현식 또는
# interval: 3600 # 초 단위 interval
enableLog: true
플랫폼별 실행 메커니즘:
- Linux: cron
- macOS: LaunchAgent
- Windows: Task Scheduler
프로젝트 구조
lib/
├── cli/ # CLI 인자 파싱, 스케줄러 관리
└── oto/
├── application.dart # 싱글턴 오케스트레이터
├── commands/ # 커맨드 구현체 (카테고리별)
├── core/ # 태그 시스템, 데이터 합성, 정의 데이터
├── data/ # JSON 직렬화 데이터 모델 (*.g.dart 포함)
├── pipeline/ # 파이프라인 흐름 제어 엔진
└── utils/ # 공통 유틸리티
기술 스택
- 언어: Dart (SDK >=2.18.6 <4.0.0)
- 의존성: dart_framework (커스텀), http, json_annotation, cron, xml
- 코드 생성: json_serializable + build_runner
dart run build_runner build # 데이터 모델 생성
에러 처리
Application.build()는catch (e, stacktrace)로 Exception과 Error 모두 처리- 실패 시
BuildResult.failure(..., exitCode: 10)을 반환하고 CLI가 부모 프로세스에 exit code 전달 passExitCodes로 성공으로 간주할 exit code 지정 가능