refactor(runner): 출력 포트 경계를 연결한다
core data composition과 Application 출력 경계에서 CLI Color 의존을 분리하고, 기존 CLI 출력 의미를 adapter 테스트로 보존하기 위해 변경한다.
This commit is contained in:
parent
04adcaf93a
commit
fcde95985d
11 changed files with 1344 additions and 395 deletions
|
|
@ -37,34 +37,42 @@ task=m-runner-output-boundary/03+01,02_core_cli_adapter, plan=1, tag=REFACTOR
|
|||
|
||||
| 항목 | 완료 여부 |
|
||||
|------|---------|
|
||||
| [REFACTOR-1] DataComposer Neutral Output | [ ] |
|
||||
| [REFACTOR-2] CLI Adapter Wiring | [ ] |
|
||||
| [REFACTOR-1] DataComposer Neutral Output | [x] |
|
||||
| [REFACTOR-2] CLI Adapter Wiring | [x] |
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] `01_output_port_contract`와 `02+01_pipeline_output_port` complete.log를 확인한다.
|
||||
- [ ] DataComposer/Jenkins collector signature를 CLI `Color` 없는 output port 또는 domain-neutral style 계약으로 바꾼다.
|
||||
- [ ] Application이 build 시작 시 context output을 CLI adapter로 설정하고 `logEnable=false` 및 scheduler log 경계를 유지한다.
|
||||
- [ ] CLI adapter가 기존 `CLI.printString`, `CLI.println`, build step banner 의미를 보존하도록 연결한다.
|
||||
- [ ] `apps/runner/lib/oto/core/data_composer.dart`와 `apps/runner/lib/oto/pipeline/**`에 `package:oto/cli` import 또는 `CLI.` direct call이 남지 않게 한다.
|
||||
- [ ] core/CLI 관련 테스트와 CLI smoke를 실행한다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
- [x] `01_output_port_contract`와 `02+01_pipeline_output_port` complete.log를 확인한다.
|
||||
- [x] DataComposer/Jenkins collector signature를 CLI `Color` 없는 output port 또는 domain-neutral style 계약으로 바꾼다.
|
||||
- [x] Application이 build 시작 시 context output을 CLI adapter로 설정하고 `logEnable=false` 및 scheduler log 경계를 유지한다.
|
||||
- [x] CLI adapter가 기존 `CLI.printString`, `CLI.println`, build step banner 의미를 보존하도록 연결한다.
|
||||
- [x] `apps/runner/lib/oto/core/data_composer.dart`와 `apps/runner/lib/oto/pipeline/**`에 `package:oto/cli` import 또는 `CLI.` direct call이 남지 않게 한다.
|
||||
- [x] core/CLI 관련 테스트와 CLI smoke를 실행한다.
|
||||
- [x] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 코드리뷰 전용 체크리스트
|
||||
|
||||
- [ ] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
||||
- [ ] active review/plan 파일을 `.log`로 아카이브한다.
|
||||
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
||||
- [x] active review/plan 파일을 `.log`로 아카이브한다.
|
||||
- [x] `.gitignore`의 Agent-Ops 관리 block이 task `.md`/`.log` artifact를 unignore하는지 확인한다.
|
||||
- [x] FAIL이고 user-review gate가 트리거되지 않아 다음 active `PLAN-local-G06.md`와 `CODE_REVIEW-local-G06.md`를 작성하고 `complete.log`를 작성하지 않는다.
|
||||
- [ ] PASS이면 `complete.log` 작성 후 active task 디렉터리를 archive로 이동한다.
|
||||
- [ ] PASS split 작업이면 parent 유지/정리 상태를 확인한다.
|
||||
- [ ] PASS이고 task group이 `m-<milestone-slug>`이면 완료 이벤트 메타데이터를 보고한다.
|
||||
|
||||
## 계획 대비 변경 사항
|
||||
|
||||
_구현 에이전트가 계획과 다르게 구현한 부분을 이유와 함께 기록한다._
|
||||
- `apps/runner/lib/cli/runner_output_adapter.dart`를 새로 추가했다. adapter는 CLI 소유 경계에 두는 것이 맞고, 기존 `cli.dart`에 섞는 것보다 output port 매핑 책임을 좁게 유지할 수 있다.
|
||||
- `Application.build`에 선택적 `RunnerOutputPort? output` 인자를 추가했다. CLI 기본 출력은 adapter로 유지하면서 테스트와 후속 server/agent 경로에서 명시 output port를 주입할 수 있게 하기 위함이다.
|
||||
- `logEnable=false` 보존을 위해 `_LogGateOutputPort`를 Application 내부에 두고 default/custom output 모두 같은 gate를 통과하게 했다.
|
||||
|
||||
## 주요 설계 결정
|
||||
|
||||
_구현 에이전트가 주요 설계 결정 사항을 기록한다._
|
||||
- `DataComposer.compose`와 `JenkinsEnvironmentCollector.collect`는 `RunnerOutputPort`만 받도록 변경해 `data_composer.dart`에서 CLI import와 `Color` type을 제거했다.
|
||||
- `CliRunnerOutputPort`는 `RunnerOutputStyle`을 CLI `Color`로 매핑하고, `line`은 `CLI.println`, `block`/`buildStep`은 `CLI.printString`을 사용한다. build step banner 문자열은 기존 `Application.printBuildStep` 형태를 유지한다.
|
||||
- `Application.build`는 시작 시 `context.output`을 준비하고 Build Data, 실패 error/stacktrace, 성공/실패 build step을 모두 output port로 emit한다.
|
||||
- scheduler의 파일 로그 연결은 `setCliOutputLogHandler(log)` helper로 유지해 기존 `CLI.logFunc` 경계를 adapter 파일 안으로 이동했다.
|
||||
- 테스트는 Application output port 주입, `logEnable=false` output 억제, Jenkins composer/collector output style을 추가로 검증한다.
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
|
|
@ -90,41 +98,57 @@ _기본값은 `없음`이다. 구현 중 사용자 결정, 사용자 소유 외
|
|||
|
||||
```bash
|
||||
$ cd apps/runner && dart analyze
|
||||
(output)
|
||||
Analyzing runner...
|
||||
No issues found!
|
||||
|
||||
$ cd apps/runner && dart test test/oto_core_test.dart test/oto_application_test.dart
|
||||
(output)
|
||||
All tests passed! (+68)
|
||||
```
|
||||
|
||||
### REFACTOR-2 중간 검증
|
||||
|
||||
```bash
|
||||
$ cd apps/runner && dart analyze
|
||||
(output)
|
||||
Analyzing runner...
|
||||
No issues found!
|
||||
|
||||
$ cd apps/runner && dart test test/oto_application_test.dart test/oto_cli_runtime_test.dart test/oto_validate_cli_test.dart
|
||||
(output)
|
||||
All tests passed! (+47)
|
||||
```
|
||||
|
||||
### 최종 검증
|
||||
|
||||
```bash
|
||||
$ cd apps/runner && dart analyze
|
||||
(output)
|
||||
Analyzing runner...
|
||||
No issues found!
|
||||
|
||||
$ cd apps/runner && dart test test/oto_application_test.dart test/oto_context_test.dart test/oto_core_test.dart test/oto_system_runtime_test.dart
|
||||
(output)
|
||||
All tests passed! (+76)
|
||||
|
||||
$ cd apps/runner && dart test test/oto_cli_runtime_test.dart test/oto_catalog_cli_test.dart test/oto_validate_cli_test.dart
|
||||
(output)
|
||||
All tests passed! (+18)
|
||||
|
||||
$ cd apps/runner && dart run bin/main.dart --help
|
||||
(output)
|
||||
exit=0; 현재 CLI 동작대로 `--help`는 command-not-found error 문구와 함께 Usage/Available Command 도움말을 출력한다.
|
||||
|
||||
$ ! rg --sort path -n "package:oto/cli|CLI\\.|Color\\." apps/runner/lib/oto/pipeline apps/runner/lib/oto/core/data_composer.dart
|
||||
(output)
|
||||
no output; no-match 조건 충족
|
||||
```
|
||||
|
||||
## 코드리뷰 결과
|
||||
|
||||
_리뷰 에이전트가 append한다._
|
||||
### 2026-06-07 - 코드리뷰 판정
|
||||
|
||||
- 종합 판정: FAIL
|
||||
- 차원별 평가:
|
||||
- correctness: Fail
|
||||
- completeness: Fail
|
||||
- test coverage: Fail
|
||||
- API contract: Pass
|
||||
- code quality: Pass
|
||||
- plan deviation: Fail
|
||||
- verification trust: Pass
|
||||
- 발견된 문제:
|
||||
- Required: [apps/runner/lib/oto/application.dart](/config/workspace/oto/apps/runner/lib/oto/application.dart:187)에서 최종 성공 배너가 기존 `Color.cyan` 대신 기본 `RunnerOutputStyle.success`로 출력된다. 기존 구현은 `printBuildStep('Build Successfully Complete', Color.cyan)`였고, 새 adapter의 `success`는 `Color.green`으로 매핑되므로 “기존 CLI 출력 의미 보존” 계획 항목이 미충족이다. 최종 성공 배너의 cyan 의미를 보존하도록 explicit style/adapter mapping을 복원하고, 해당 style을 검증하는 테스트를 추가한다.
|
||||
- 다음 단계: FAIL이므로 user-review gate 없이 후속 `PLAN-*-G??.md`와 `CODE_REVIEW-*-G??.md`를 작성한다.
|
||||
|
|
@ -0,0 +1,180 @@
|
|||
<!-- task=m-runner-output-boundary/03+01,02_core_cli_adapter plan=1 tag=REVIEW_REFACTOR -->
|
||||
|
||||
# Code Review Reference - REVIEW_REFACTOR
|
||||
|
||||
> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
|
||||
> The task is NOT complete until every implementation-owned section below is filled in.
|
||||
> Complete the `구현 체크리스트`; the final checklist item is mandatory before saving.
|
||||
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
|
||||
> If implementation is blocked by a user-only decision, user-owned external environment prerequisite, or scope conflict, fill `사용자 리뷰 요청` with evidence and stop with active files in place; code-review decides whether to write `USER_REVIEW.md`. Evidence gaps that a follow-up agent can close by rerunning commands or collecting artifacts are normal follow-up issues, not user-review blockers by themselves.
|
||||
> Do not ask the user directly, present choices in chat, or call `request_user_input` during implementation; record the needed decision in `사용자 리뷰 요청` and stop for code-review.
|
||||
> Finalization (`코드리뷰 결과`, log rename, `complete.log`, archive moves, `코드리뷰 전용 체크리스트`) is review-agent-only, even after compaction/resume.
|
||||
> Follow the ownership table at the bottom of this file for which sections you own.
|
||||
|
||||
## 개요
|
||||
|
||||
date=2026-06-07
|
||||
task=m-runner-output-boundary/03+01,02_core_cli_adapter, plan=1, tag=REVIEW_REFACTOR
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/phase/independent-control-plane/milestones/runner-output-boundary.md`
|
||||
- Task ids:
|
||||
- `core`: data composition 경로의 printer/color 의존을 output port 또는 domain-neutral 계약으로 정리한다.
|
||||
- `cli-adapter`: 기존 CLI 출력 의미를 유지하는 adapter를 연결한다. 검증: CLI smoke 출력이 회귀하지 않는다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 이 파일을 읽는 리뷰 에이전트에게
|
||||
|
||||
> **[REVIEW AGENT ONLY]** 아래 종결 절차는 코드리뷰 에이전트 전용이다. 구현 에이전트는 이 섹션을 실행하지 않는다.
|
||||
|
||||
각 항목의 구현을 실제 소스 파일과 대조하고, `검증 결과` 섹션의 출력이 코드와 일치하는지 확인하세요.
|
||||
리뷰 완료는 아래 순서까지 끝난 상태를 의미합니다.
|
||||
|
||||
1. 판정을 append한다.
|
||||
2. `CODE_REVIEW-local-G06.md` -> `code_review_local_G06_N.log`, `PLAN-local-G06.md` -> `plan_local_G06_M.log`로 아카이브한다.
|
||||
3. PASS이면 `complete.log` 작성 후 active task 디렉터리를 archive로 이동한다. WARN/FAIL이면 user-review gate를 확인한 뒤 다음 active plan/review 파일 또는 `USER_REVIEW.md`를 작성한다.
|
||||
4. PASS이고 task group이 `m-<milestone-slug>`이면 완료 이벤트 메타데이터를 보고한다. roadmap 수정이나 `update-roadmap` 호출은 하지 않는다.
|
||||
5. 적용 가능한 `코드리뷰 전용 체크리스트` 항목을 최종 `.log` 위치에서 체크한 뒤 보고한다.
|
||||
|
||||
---
|
||||
|
||||
## 구현 항목별 완료 여부
|
||||
|
||||
| 항목 | 완료 여부 |
|
||||
|------|---------|
|
||||
| [REVIEW_REFACTOR-1] Final Success Banner Cyan Preservation | [x] |
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [x] 최종 `Build Successfully Complete` build step이 기존 `Color.cyan` 의미를 보존하도록 `RunnerOutputStyle.progress` 스타일을 명시하였다.
|
||||
- [x] 성공 배너 style/color 회귀를 잡는 테스트를 추가하거나 기존 output-port 테스트를 보강하였다. (기존 테스트에 style 검증 보강 + CliRunnerOutputPort adapter mapping 테스트 추가)
|
||||
- [x] core/CLI 관련 검증과 no-match `rg` 검증을 실행하였다.
|
||||
- [x] CODE_REVIEW-local-G06.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 코드리뷰 전용 체크리스트
|
||||
|
||||
> **[REVIEW AGENT ONLY]** 이 체크리스트는 코드리뷰 에이전트만 사용한다.
|
||||
> 구현 에이전트는 이 섹션을 수정하거나 체크하지 않는다.
|
||||
|
||||
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
||||
- [x] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
|
||||
- [x] active `CODE_REVIEW-*-G??.md`를 `code_review_{review_lane}_GNN_N.log`로 아카이브한다.
|
||||
- [x] active `PLAN-*-G??.md`를 `plan_{build_lane}_GNN_M.log`로 아카이브한다.
|
||||
- [x] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하고 `agent-roadmap/current.md`를 ignore하는지 확인한다.
|
||||
- [x] PASS이면 `agent-ops/skills/common/code-review/templates/complete-log-template.md` 기준으로 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
|
||||
- [x] PASS이면 active task 디렉터리 `agent-task/m-runner-output-boundary/03+01,02_core_cli_adapter/`를 `agent-task/archive/YYYY/MM/m-runner-output-boundary/03+01,02_core_cli_adapter/`로 이동하고 최종 archive 경로에서 이 체크리스트를 갱신한다.
|
||||
- [x] PASS이고 task group이 `m-<milestone-slug>`이면 런타임이 읽을 완료 이벤트 메타데이터를 보고하고, roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다.
|
||||
- [x] PASS split 작업이면 이동 후 빈 active parent `agent-task/m-runner-output-boundary/`를 제거하거나, 남은 sibling/file이 있어 유지했다고 확인한다.
|
||||
- [ ] WARN/FAIL이고 user-review gate가 트리거되지 않았으면 다음 active `PLAN-{build_lane}-GNN.md`와 `CODE_REVIEW-{review_lane}-GNN.md`를 작성하고 `complete.log`를 작성하지 않는다.
|
||||
- [ ] USER_REVIEW이면 `agent-ops/skills/common/code-review/templates/user-review-template.md` 기준으로 `USER_REVIEW.md`를 작성하고 active `PLAN-*.md`, `CODE_REVIEW-*.md`, `complete.log`를 남기지 않는다.
|
||||
- [ ] USER_REVIEW가 사용자 결정으로 완료/PASS 해소되면 `USER_REVIEW.md`를 해소 상태로 갱신하고 `complete.log`를 작성한 뒤 task directory를 archive로 이동한다.
|
||||
|
||||
## 계획 대비 변경 사항
|
||||
|
||||
PLAN에 명시된 두 가지 선택지(좁은 변경 vs 명확한 계약 변경) 중 "좁은 변경"을 채택했다. `RunnerOutputStyle.progress`가 이미 `Color.cyan`으로 매핑되어 있으므로, 성공 배너 호출부에서 해당 스타일을 명시하면 기존 cyan 의미를 보존할 수 있다. 새 style enum 값을 추가하는 명확한 계약 변경은 범위를 벗어난다.
|
||||
|
||||
## 주요 설계 결정
|
||||
|
||||
1. **RunnerOutputStyle.progress 사용**: 기존 `CliRunnerOutputPort._colorFor(RunnerOutputStyle.progress)`가 `Color.cyan`으로 매핑되어 있으므로, 성공 배너에서 이를 명시하여 cyan 색상 복원을 달성했다.
|
||||
2. **테스트 보강 전략**: 기존 `_RecordingOutputPort`에 `stepStyles` 필드를 추가하여 style까지 기록하도록 개편하고, 실행 시점과 adapter 시점 두 층위에서 회귀를 검증하도록 했다.
|
||||
3. **CliRunnerOutputPort adapter mapping 테스트**: CliRunnerOutputPort가 각 `RunnerOutputStyle` enum을 `Color` enum으로 올바르게 매핑하는지 검증하는 테스트 그룹을 새로 추가했다.
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
_기본값은 `없음`이다. 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경 없이는 안전하게 진행할 수 없으면 아래 항목을 실제 내용으로 교체하고, 구현을 중단한 뒤 active 파일을 그대로 둔 채 리뷰를 요청한다. 구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하지 않는다. 후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 작성하지 않는다._
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 리뷰어를 위한 체크포인트
|
||||
|
||||
- 최종 `Build Successfully Complete` 출력이 기존 cyan 의미를 보존하는지 확인한다.
|
||||
- 새 테스트가 단순 문자열 존재가 아니라 style 또는 adapter color 회귀를 잡는지 확인한다.
|
||||
- 기존 `Build Data`, 실패 배너, phase start/Jenkins Variables 출력 의미가 바뀌지 않았는지 확인한다.
|
||||
|
||||
## 검증 결과
|
||||
|
||||
_구현 에이전트가 각 중간 검증 및 최종 검증 명령 실행 후 출력을 여기에 붙여 넣는다._
|
||||
|
||||
필수 규칙:
|
||||
- 검증 명령은 고정된 계약이다. 임의로 대체하지 않는다.
|
||||
- 대체가 필요하면 `계획 대비 변경 사항`에 이유와 대체 명령을 기록한다.
|
||||
- `검증 결과`에는 실제 stdout/stderr를 붙여 넣는다.
|
||||
- 사용자 리뷰 요청으로 명령을 끝까지 실행하지 못했다면 `사용자 리뷰 요청`에 실행한 명령, 실제 출력, 미실행 명령의 사유를 기록한다.
|
||||
- mobile/UI hang, timeout, 또는 2분 무진행은 blind retry를 중단하고 focused rerun 명령과 screenshot/window/UI-tree evidence path를 남기며, 불가능하면 정확한 사유를 남긴다.
|
||||
|
||||
### REVIEW_REFACTOR-1 중간 검증
|
||||
|
||||
```bash
|
||||
$ cd apps/runner && dart analyze
|
||||
Analyzing runner...
|
||||
No issues found!
|
||||
|
||||
$ cd apps/runner && dart test test/oto_application_test.dart
|
||||
00:04 +41: All tests passed!
|
||||
```
|
||||
|
||||
### 최종 검증
|
||||
|
||||
```bash
|
||||
$ cd apps/runner && dart analyze
|
||||
No issues found!
|
||||
|
||||
$ cd apps/runner && dart test test/oto_application_test.dart test/oto_context_test.dart test/oto_core_test.dart test/oto_system_runtime_test.dart
|
||||
00:01 +78: All tests passed!
|
||||
|
||||
$ cd apps/runner && dart test test/oto_cli_runtime_test.dart test/oto_catalog_cli_test.dart test/oto_validate_cli_test.dart
|
||||
00:06 +18: All tests passed!
|
||||
|
||||
$ cd apps/runner && dart run bin/main.dart --help
|
||||
Error: The --help command does not exist.
|
||||
...
|
||||
|
||||
$ ! rg --sort path -n "package:oto/cli|CLI\\.|Color\\." apps/runner/lib/oto/pipeline apps/runner/lib/oto/core/data_composer.dart
|
||||
(no matches -- exit 1)
|
||||
```
|
||||
|
||||
|
||||
**검증 증명:** 테스트 실행 시 `Build Successfully Complete` 배너가 cyan(`[36m`) 색상으로 출력됨을 확인. adapter mapping 테스트 2개(38~39번)가 `Color.cyan` 매핑을 검증. `rg` 결과 0 매칭으로 pipeline/data_composer에 CLI/Color 의존 없음.
|
||||
---
|
||||
|
||||
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section: completion table, implementation checklist, changes from plan, design decisions, and verification output?**
|
||||
> If anything is blank, go back and fill it in before saving this file.
|
||||
> Leave review-agent-only sections unchanged.
|
||||
|
||||
## Section Ownership
|
||||
|
||||
| 섹션 | 소유자 | 설명 |
|
||||
|------|--------|------|
|
||||
| 헤더 주석, 개요(date/task/plan/tag), 리뷰 에이전트 지시 | 스텁 생성 시 고정 | 구현 에이전트가 수정하거나 실행하지 않음 |
|
||||
| Roadmap Targets | follow-up plan에서 복사해 스텁 생성 시 고정 | 구현 에이전트가 수정하지 않음; PASS 시 code-review가 `complete.log`의 `Roadmap Completion`으로 복사 |
|
||||
| 구현 항목별 완료 여부 (항목명) | 스텁 생성 시 고정 | `[ ]` -> `[x]` 체크만 구현 에이전트가 수행 |
|
||||
| 구현 체크리스트 (항목 텍스트/순서) | follow-up plan에서 복사해 스텁 생성 시 고정 | 구현 에이전트가 `[ ]` -> `[x]` 체크만 수행; 마지막 체크박스는 저장 전 필수 |
|
||||
| 코드리뷰 전용 체크리스트 | Review agent only | Implementing agent must not modify or check this section |
|
||||
| 계획 대비 변경 사항, 주요 설계 결정 | 구현 에이전트가 채움 | placeholder 텍스트를 실제 내용으로 교체 |
|
||||
| 사용자 리뷰 요청 | 구현 에이전트가 채움 | 진행에 사용자 입력이 필요하지 않으면 `상태: 없음` 유지 |
|
||||
| 리뷰어를 위한 체크포인트 | 스텁 생성 시 고정 | 계획에서 추출한 리뷰 포인트 |
|
||||
| 검증 결과 (섹션 제목 + 명령) | 스텁 생성 시 고정 | 실행 출력만 구현 에이전트가 채움 |
|
||||
| 코드리뷰 결과 | 리뷰 에이전트가 append | 스텁에 포함하지 않음 |
|
||||
|
||||
## 코드리뷰 결과
|
||||
|
||||
### 2026-06-07 - 코드리뷰 판정
|
||||
|
||||
- 종합 판정: PASS
|
||||
- 차원별 평가:
|
||||
- correctness: Pass
|
||||
- completeness: Pass
|
||||
- test coverage: Pass
|
||||
- API contract: Pass
|
||||
- code quality: Pass
|
||||
- plan deviation: Pass
|
||||
- verification trust: Pass
|
||||
- 발견된 문제: 없음
|
||||
- 다음 단계: PASS이므로 active plan/review를 `.log`로 아카이브하고 `complete.log` 작성 후 task directory를 archive로 이동한다.
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# Complete - m-runner-output-boundary/03+01,02_core_cli_adapter
|
||||
|
||||
## 완료 일시
|
||||
|
||||
2026-06-07
|
||||
|
||||
## 요약
|
||||
|
||||
runner core/DataComposer의 CLI color 의존을 output port 경계로 정리하고 CLI adapter를 연결했으며, 2회 리뷰에서 성공 배너 cyan 회귀를 보완한 뒤 PASS로 종료했다.
|
||||
|
||||
## 루프 이력
|
||||
|
||||
| Plan | Review | Verdict | 메모 |
|
||||
|------|--------|---------|------|
|
||||
| `plan_cloud_G07_0.log` | `code_review_cloud_G07_0.log` | FAIL | 최종 성공 배너가 기존 cyan 의미를 잃고 green으로 출력되는 회귀가 있어 follow-up을 생성했다. |
|
||||
| `plan_local_G06_1.log` | `code_review_local_G06_1.log` | PASS | 성공 배너가 `RunnerOutputStyle.progress`를 사용해 기존 cyan 의미를 보존하고, style/color 회귀 테스트와 검증이 통과했다. |
|
||||
|
||||
## 구현/정리 내용
|
||||
|
||||
- `DataComposer.compose`와 `JenkinsEnvironmentCollector.collect`를 `RunnerOutputPort` 기반으로 전환해 core data composition 경로에서 CLI `Color` 의존을 제거했다.
|
||||
- `CliRunnerOutputPort` adapter를 추가하고 `Application.build`가 output port를 구성해 Build Data, failure, success, pipeline build step 출력을 adapter 경계로 전달하도록 했다.
|
||||
- 최종 `Build Successfully Complete` 배너가 기존 cyan 의미를 보존하도록 `RunnerOutputStyle.progress`를 명시하고, output style 및 adapter color mapping 테스트를 보강했다.
|
||||
- 리뷰 중 문서 오타와 테스트의 빈 setup을 정리하고 `dart format`을 적용했다.
|
||||
|
||||
## 최종 검증
|
||||
|
||||
- `cd apps/runner && dart analyze` - PASS; `No issues found!`
|
||||
- `cd apps/runner && dart test test/oto_application_test.dart` - PASS; `All tests passed!` (`+41`)
|
||||
- `cd apps/runner && dart test test/oto_application_test.dart test/oto_context_test.dart test/oto_core_test.dart test/oto_system_runtime_test.dart` - PASS; `All tests passed!` (`+80`)
|
||||
- `cd apps/runner && dart test test/oto_cli_runtime_test.dart test/oto_catalog_cli_test.dart test/oto_validate_cli_test.dart` - PASS; `All tests passed!` (`+18`)
|
||||
- `cd apps/runner && dart run bin/main.dart --help` - PASS; exit 0, 현재 CLI 동작대로 command-not-found error 뒤 Usage/Available Command 도움말 출력
|
||||
- `cd apps/runner && ! rg --sort path -n "package:oto/cli|CLI\\.|Color\\." apps/runner/lib/oto/pipeline apps/runner/lib/oto/core/data_composer.dart` - PASS; no matches
|
||||
|
||||
## Roadmap Completion
|
||||
|
||||
- Milestone: `agent-roadmap/phase/independent-control-plane/milestones/runner-output-boundary.md`
|
||||
- Completed task ids:
|
||||
- `core`: PASS; evidence=`agent-task/archive/2026/06/m-runner-output-boundary/03+01,02_core_cli_adapter/plan_cloud_G07_0.log`, `agent-task/archive/2026/06/m-runner-output-boundary/03+01,02_core_cli_adapter/code_review_cloud_G07_0.log`, `agent-task/archive/2026/06/m-runner-output-boundary/03+01,02_core_cli_adapter/plan_local_G06_1.log`, `agent-task/archive/2026/06/m-runner-output-boundary/03+01,02_core_cli_adapter/code_review_local_G06_1.log`; verification=`cd apps/runner && dart analyze`, `cd apps/runner && dart test test/oto_application_test.dart test/oto_context_test.dart test/oto_core_test.dart test/oto_system_runtime_test.dart`, `cd apps/runner && ! rg --sort path -n "package:oto/cli|CLI\\.|Color\\." apps/runner/lib/oto/pipeline apps/runner/lib/oto/core/data_composer.dart`
|
||||
- `cli-adapter`: PASS; evidence=`agent-task/archive/2026/06/m-runner-output-boundary/03+01,02_core_cli_adapter/plan_cloud_G07_0.log`, `agent-task/archive/2026/06/m-runner-output-boundary/03+01,02_core_cli_adapter/code_review_cloud_G07_0.log`, `agent-task/archive/2026/06/m-runner-output-boundary/03+01,02_core_cli_adapter/plan_local_G06_1.log`, `agent-task/archive/2026/06/m-runner-output-boundary/03+01,02_core_cli_adapter/code_review_local_G06_1.log`; verification=`cd apps/runner && dart test test/oto_cli_runtime_test.dart test/oto_catalog_cli_test.dart test/oto_validate_cli_test.dart`, `cd apps/runner && dart run bin/main.dart --help`
|
||||
- Not completed task ids: 없음
|
||||
|
||||
## 잔여 Nit
|
||||
|
||||
- 없음
|
||||
|
||||
## 후속 작업
|
||||
|
||||
- 없음
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
<!-- task=m-runner-output-boundary/03+01,02_core_cli_adapter plan=1 tag=REVIEW_REFACTOR -->
|
||||
|
||||
# Plan - REVIEW_REFACTOR
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/phase/independent-control-plane/milestones/runner-output-boundary.md`
|
||||
- Task ids:
|
||||
- `core`: data composition 경로의 printer/color 의존을 output port 또는 domain-neutral 계약으로 정리한다.
|
||||
- `cli-adapter`: 기존 CLI 출력 의미를 유지하는 adapter를 연결한다. 검증: CLI smoke 출력이 회귀하지 않는다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 배경
|
||||
|
||||
1차 리뷰는 output port 연결 자체와 검증 명령은 통과했지만, 최종 성공 배너의 기존 색상 의미가 보존되지 않아 FAIL로 종료했다.
|
||||
|
||||
- Archived plan: `agent-task/m-runner-output-boundary/03+01,02_core_cli_adapter/plan_cloud_G07_0.log`
|
||||
- Archived review: `agent-task/m-runner-output-boundary/03+01,02_core_cli_adapter/code_review_cloud_G07_0.log`
|
||||
- Required finding: `apps/runner/lib/oto/application.dart:187`의 `Build Successfully Complete` 배너가 기존 `Color.cyan`에서 adapter 기본 `RunnerOutputStyle.success -> Color.green`으로 바뀌었다.
|
||||
|
||||
## 구현 에이전트 지시
|
||||
|
||||
- 사용자에게 직접 질문하거나 선택지를 제시하지 않는다.
|
||||
- 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경이 필요하면 active `CODE_REVIEW-local-G06.md`의 `사용자 리뷰 요청` 섹션을 채우고 중단한다.
|
||||
- 검증 증거 부족은 사용자 리뷰 요청 사유가 아니다. 명령을 재실행해 실제 stdout/stderr를 기록한다.
|
||||
- 범위는 최종 성공 배너의 기존 cyan 의미 복원과 테스트 보강으로 제한한다. DataComposer, pipeline, agent, scheduler 동작은 재설계하지 않는다.
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] 최종 `Build Successfully Complete` build step이 기존 `Color.cyan` 의미를 보존하도록 `RunnerOutputStyle` 사용 또는 adapter mapping을 수정한다.
|
||||
- [ ] 성공 배너 style/color 회귀를 잡는 테스트를 추가하거나 기존 output-port 테스트를 보강한다.
|
||||
- [ ] core/CLI 관련 검증과 no-match `rg` 검증을 실행한다.
|
||||
- [ ] CODE_REVIEW-local-G06.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 수정 파일 요약
|
||||
|
||||
| 파일 | 항목 |
|
||||
|------|------|
|
||||
| `apps/runner/lib/oto/application.dart` | REVIEW_REFACTOR-1 |
|
||||
| `apps/runner/lib/oto/core/output_port.dart` | REVIEW_REFACTOR-1, 필요 시 |
|
||||
| `apps/runner/lib/cli/runner_output_adapter.dart` | REVIEW_REFACTOR-1, 필요 시 |
|
||||
| `apps/runner/test/oto_application_test.dart` | REVIEW_REFACTOR-1 |
|
||||
|
||||
## [REVIEW_REFACTOR-1] Final Success Banner Cyan Preservation
|
||||
|
||||
### 문제
|
||||
|
||||
기존 구현은 최종 성공 배너를 cyan으로 출력했다.
|
||||
|
||||
```dart
|
||||
await printBuildStep('Build Successfully Complete', Color.cyan);
|
||||
```
|
||||
|
||||
현재 구현은 style을 명시하지 않아 `RunnerOutputStyle.success` 기본값을 사용하고, `CliRunnerOutputPort`는 이를 `Color.green`으로 매핑한다.
|
||||
|
||||
```dart
|
||||
await printBuildStep('Build Successfully Complete');
|
||||
```
|
||||
|
||||
이는 1차 계획의 “기존 CLI 출력 의미 보존” 항목과 맞지 않는다.
|
||||
|
||||
### 해결 방법
|
||||
|
||||
최종 성공 배너만 기존 cyan 의미를 유지하도록 명시한다. 선택지는 둘 중 하나다.
|
||||
|
||||
- 좁은 변경: 기존 `RunnerOutputStyle.progress`가 cyan으로 매핑되어 있으므로 성공 배너 호출에서 해당 style을 명시한다.
|
||||
- 명확한 계약 변경: `RunnerOutputStyle.complete` 같은 style을 추가하고 `CliRunnerOutputPort`에서 `Color.cyan`으로 매핑한 뒤 성공 배너에서 사용한다.
|
||||
|
||||
선택한 방식은 테스트에서 style 또는 adapter color까지 확인해야 한다.
|
||||
|
||||
### 수정 파일 및 체크리스트
|
||||
|
||||
- [ ] `Application.build`의 최종 성공 배너가 cyan 의미를 보존하게 수정
|
||||
- [ ] 테스트 recording output이 style을 기록하도록 보강하거나 adapter 주입 테스트로 `Color.cyan` 매핑을 검증
|
||||
- [ ] 기존 build data, failure, phase start 출력 의미가 바뀌지 않았는지 확인
|
||||
|
||||
### 테스트 작성
|
||||
|
||||
- 작성/보강: `apps/runner/test/oto_application_test.dart`
|
||||
- 목표: 성공 build 완료 시 `Build Successfully Complete` 이벤트가 기존 cyan에 해당하는 style로 emit되는지 검증한다.
|
||||
|
||||
### 중간 검증
|
||||
|
||||
```bash
|
||||
cd apps/runner && dart analyze
|
||||
cd apps/runner && dart test test/oto_application_test.dart
|
||||
```
|
||||
|
||||
## 최종 검증
|
||||
|
||||
```bash
|
||||
cd apps/runner && dart analyze
|
||||
cd apps/runner && dart test test/oto_application_test.dart test/oto_context_test.dart test/oto_core_test.dart test/oto_system_runtime_test.dart
|
||||
cd apps/runner && dart test test/oto_cli_runtime_test.dart test/oto_catalog_cli_test.dart test/oto_validate_cli_test.dart
|
||||
cd apps/runner && dart run bin/main.dart --help
|
||||
! rg --sort path -n "package:oto/cli|CLI\\.|Color\\." apps/runner/lib/oto/pipeline apps/runner/lib/oto/core/data_composer.dart
|
||||
```
|
||||
|
||||
모든 코드 변경 완료 후 반드시 `CODE_REVIEW-local-G06.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
|
||||
72
apps/runner/lib/cli/runner_output_adapter.dart
Normal file
72
apps/runner/lib/cli/runner_output_adapter.dart
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
import 'package:oto/cli/cli.dart';
|
||||
import 'package:oto/oto/core/output_port.dart';
|
||||
|
||||
typedef CliOutputPrinter =
|
||||
Future<dynamic> Function(String value, {Color? color, Color? background});
|
||||
|
||||
class CliRunnerOutputPort implements RunnerOutputPort {
|
||||
final bool Function() enabled;
|
||||
final String Function() leadingPrefix;
|
||||
final CliOutputPrinter _printString;
|
||||
final CliOutputPrinter _println;
|
||||
|
||||
CliRunnerOutputPort({
|
||||
required this.enabled,
|
||||
required this.leadingPrefix,
|
||||
CliOutputPrinter? printString,
|
||||
CliOutputPrinter? println,
|
||||
}) : _printString = printString ?? CLI.printString,
|
||||
_println = println ?? CLI.println;
|
||||
|
||||
@override
|
||||
Future<void> line(
|
||||
String message, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.normal,
|
||||
}) async {
|
||||
if (!enabled()) return;
|
||||
await _println(message, color: _colorFor(style));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> block(
|
||||
String message, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.normal,
|
||||
}) async {
|
||||
if (!enabled()) return;
|
||||
await _printString(message, color: _colorFor(style));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> buildStep(
|
||||
String name, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.success,
|
||||
}) async {
|
||||
if (!enabled()) return;
|
||||
final message =
|
||||
'''${leadingPrefix()}*********************************************************************************************
|
||||
* $name
|
||||
*********************************************************************************************''';
|
||||
await _printString(message, color: _colorFor(style) ?? Color.green);
|
||||
}
|
||||
|
||||
Color? _colorFor(RunnerOutputStyle style) {
|
||||
switch (style) {
|
||||
case RunnerOutputStyle.normal:
|
||||
return null;
|
||||
case RunnerOutputStyle.success:
|
||||
return Color.green;
|
||||
case RunnerOutputStyle.warning:
|
||||
return Color.yellowStrong;
|
||||
case RunnerOutputStyle.error:
|
||||
return Color.redStrong;
|
||||
case RunnerOutputStyle.accent:
|
||||
return Color.magenta;
|
||||
case RunnerOutputStyle.progress:
|
||||
return Color.cyan;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void setCliOutputLogHandler(void Function(String) logHandler) {
|
||||
CLI.logFunc = logHandler;
|
||||
}
|
||||
|
|
@ -5,12 +5,13 @@ import 'dart:io';
|
|||
import 'package:dart_framework/log/log.dart';
|
||||
import 'package:dart_framework/utils/string_util.dart';
|
||||
import 'package:dart_framework/utils/system_util.dart';
|
||||
import 'package:oto/cli/cli.dart';
|
||||
import 'package:oto/cli/runner_output_adapter.dart';
|
||||
import 'package:oto/oto/commands/command.dart';
|
||||
import 'package:oto/oto/commands/command_registry.dart';
|
||||
import 'package:oto/oto/core/build_result.dart';
|
||||
import 'package:oto/oto/core/defined_data.dart';
|
||||
import 'package:oto/oto/core/execution_context.dart';
|
||||
import 'package:oto/oto/core/output_port.dart';
|
||||
import 'package:oto/oto/core/system_runtime.dart';
|
||||
import 'package:oto/oto/pipeline/pipeline.dart';
|
||||
import 'package:oto/oto/data/command_data.dart';
|
||||
|
|
@ -45,10 +46,10 @@ class Application {
|
|||
SystemRuntime systemRuntime = const DefaultSystemRuntime();
|
||||
|
||||
Map<BuildType, DataComposer Function()> get _mapComposer => {
|
||||
BuildType.test: () => DataComposerTest(),
|
||||
BuildType.jenkins: () => DataComposerJenkins(runtime: systemRuntime),
|
||||
BuildType.file: () => DataComposerFile(),
|
||||
};
|
||||
BuildType.test: () => DataComposerTest(),
|
||||
BuildType.jenkins: () => DataComposerJenkins(runtime: systemRuntime),
|
||||
BuildType.file: () => DataComposerFile(),
|
||||
};
|
||||
|
||||
ExecutionContext context = ExecutionContext();
|
||||
|
||||
|
|
@ -73,14 +74,18 @@ class Application {
|
|||
return _buildType;
|
||||
}
|
||||
|
||||
Future<BuildResult> build(BuildType buildType,
|
||||
{String? yamlContent,
|
||||
DataBuild? buildData,
|
||||
bool logEnable = true,
|
||||
String? logPath,
|
||||
List<BuildArtifact> artifacts = const []}) async {
|
||||
Future<BuildResult> build(
|
||||
BuildType buildType, {
|
||||
String? yamlContent,
|
||||
DataBuild? buildData,
|
||||
bool logEnable = true,
|
||||
String? logPath,
|
||||
RunnerOutputPort? output,
|
||||
List<BuildArtifact> artifacts = const [],
|
||||
}) async {
|
||||
_buildType = buildType;
|
||||
_logEnable = logEnable;
|
||||
context.output = _buildOutputPort(output);
|
||||
context.resetStepEvents();
|
||||
dataCommandMap = {};
|
||||
commandStates = {};
|
||||
|
|
@ -96,10 +101,10 @@ class Application {
|
|||
commonData = DataCommon.fromJson(LocalData.commonMap());
|
||||
build = buildData!;
|
||||
_logFile = File(logPath!);
|
||||
CLI.logFunc = log;
|
||||
setCliOutputLogHandler(log);
|
||||
} else {
|
||||
composer = _mapComposer[buildType]!();
|
||||
await composer.compose(yamlContent, printBuildStep);
|
||||
await composer.compose(yamlContent, context.output);
|
||||
commonData = composer.commonData;
|
||||
final buildMap = getMapFromYamlA(composer.buildYaml);
|
||||
final mapValidate = _validateBuildMap(buildMap);
|
||||
|
|
@ -109,8 +114,9 @@ class Application {
|
|||
..message = mapValidate.message;
|
||||
throw Exception(ex);
|
||||
}
|
||||
final commandValidate =
|
||||
_validateCommandList(buildMap!['commands'] as List);
|
||||
final commandValidate = _validateCommandList(
|
||||
buildMap!['commands'] as List,
|
||||
);
|
||||
if (!commandValidate.enable) {
|
||||
final ex = ExceptionData()
|
||||
..phase = 'Validate command list'
|
||||
|
|
@ -120,9 +126,10 @@ class Application {
|
|||
build = DataBuild.fromJson(buildMap);
|
||||
}
|
||||
if (_logEnable) {
|
||||
await CLI.printString(
|
||||
'$enter********************************* Build Data *************************************',
|
||||
color: Color.magenta);
|
||||
await context.output.block(
|
||||
'$enter********************************* Build Data *************************************',
|
||||
style: RunnerOutputStyle.accent,
|
||||
);
|
||||
if (composer != null) log(composer.buildYaml);
|
||||
}
|
||||
|
||||
|
|
@ -142,8 +149,10 @@ class Application {
|
|||
}
|
||||
|
||||
//Parse pipeline & validate
|
||||
var validateResult = Pipeline.pipelineInitialize(build.pipeline!.workflow,
|
||||
context: context);
|
||||
var validateResult = Pipeline.pipelineInitialize(
|
||||
build.pipeline!.workflow,
|
||||
context: context,
|
||||
);
|
||||
if (!validateResult.enable) {
|
||||
var ex = ExceptionData();
|
||||
ex.phase = 'Validate Pipeline';
|
||||
|
|
@ -156,27 +165,42 @@ class Application {
|
|||
await pipeline.execute();
|
||||
} catch (e, stacktrace) {
|
||||
if (_logEnable) {
|
||||
await CLI.printString(e.toString(), color: Color.redStrong);
|
||||
await CLI.printString(stacktrace.toString(), color: Color.yellowStrong);
|
||||
await printBuildStep('Build Failed', Color.redStrong);
|
||||
await context.output.block(
|
||||
e.toString(),
|
||||
style: RunnerOutputStyle.error,
|
||||
);
|
||||
await context.output.block(
|
||||
stacktrace.toString(),
|
||||
style: RunnerOutputStyle.warning,
|
||||
);
|
||||
await printBuildStep('Build Failed', style: RunnerOutputStyle.error);
|
||||
}
|
||||
return BuildResult.failure(e, stacktrace,
|
||||
stepEvents: List<StepEvent>.of(context.stepEvents),
|
||||
artifacts: artifacts);
|
||||
return BuildResult.failure(
|
||||
e,
|
||||
stacktrace,
|
||||
stepEvents: List<StepEvent>.of(context.stepEvents),
|
||||
artifacts: artifacts,
|
||||
);
|
||||
}
|
||||
|
||||
if (logEnable) {
|
||||
await printBuildStep('Build Successfully Complete', Color.cyan);
|
||||
await printBuildStep(
|
||||
'Build Successfully Complete',
|
||||
style: RunnerOutputStyle.progress,
|
||||
);
|
||||
}
|
||||
return BuildResult.success(
|
||||
stepEvents: List<StepEvent>.of(context.stepEvents),
|
||||
artifacts: artifacts);
|
||||
stepEvents: List<StepEvent>.of(context.stepEvents),
|
||||
artifacts: artifacts,
|
||||
);
|
||||
}
|
||||
|
||||
Future setUTF8() async {
|
||||
if (systemRuntime.isWindows) {
|
||||
var data = await systemRuntime.startShell(StringBuffer('chcp 65001'),
|
||||
logHandler: logWithType);
|
||||
var data = await systemRuntime.startShell(
|
||||
StringBuffer('chcp 65001'),
|
||||
logHandler: logWithType,
|
||||
);
|
||||
await data.waitForExit();
|
||||
log('Set Korean: ${data.exitCode == 0}');
|
||||
}
|
||||
|
|
@ -194,8 +218,11 @@ class Application {
|
|||
}
|
||||
} else {
|
||||
if (_logEnable || logType == LogType.error) {
|
||||
_logFile?.writeAsStringSync('[${getDates()}] $message\n',
|
||||
mode: FileMode.append, flush: true);
|
||||
_logFile?.writeAsStringSync(
|
||||
'[${getDates()}] $message\n',
|
||||
mode: FileMode.append,
|
||||
flush: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -207,41 +234,57 @@ class Application {
|
|||
final property = map['property'];
|
||||
if (property != null && property is! Map) {
|
||||
return _ValidateResult(
|
||||
false, '"property" must be a map, got: ${property.runtimeType}.');
|
||||
false,
|
||||
'"property" must be a map, got: ${property.runtimeType}.',
|
||||
);
|
||||
}
|
||||
if (map['commands'] == null) {
|
||||
return _ValidateResult(
|
||||
false, 'Build YAML is missing required section: "commands".');
|
||||
false,
|
||||
'Build YAML is missing required section: "commands".',
|
||||
);
|
||||
}
|
||||
if (map['commands'] is! List) {
|
||||
return _ValidateResult(false,
|
||||
'"commands" must be a list, got: ${map['commands'].runtimeType}.');
|
||||
return _ValidateResult(
|
||||
false,
|
||||
'"commands" must be a list, got: ${map['commands'].runtimeType}.',
|
||||
);
|
||||
}
|
||||
final pipeline = map['pipeline'];
|
||||
if (pipeline == null) {
|
||||
return _ValidateResult(
|
||||
false, 'Build YAML is missing required section: "pipeline".');
|
||||
false,
|
||||
'Build YAML is missing required section: "pipeline".',
|
||||
);
|
||||
}
|
||||
if (pipeline is! Map) {
|
||||
return _ValidateResult(
|
||||
false, '"pipeline" must be a map, got: ${pipeline.runtimeType}.');
|
||||
false,
|
||||
'"pipeline" must be a map, got: ${pipeline.runtimeType}.',
|
||||
);
|
||||
}
|
||||
final pipelineId = pipeline['id'];
|
||||
if (pipelineId is! String || pipelineId.trim().isEmpty) {
|
||||
return _ValidateResult(
|
||||
false, '"pipeline.id" must be a non-empty string.');
|
||||
false,
|
||||
'"pipeline.id" must be a non-empty string.',
|
||||
);
|
||||
}
|
||||
final workflow = pipeline['workflow'];
|
||||
if (workflow == null) {
|
||||
return _ValidateResult(false, '"pipeline.workflow" is missing.');
|
||||
}
|
||||
if (workflow is! List) {
|
||||
return _ValidateResult(false,
|
||||
'"pipeline.workflow" must be a list, got: ${workflow.runtimeType}.');
|
||||
return _ValidateResult(
|
||||
false,
|
||||
'"pipeline.workflow" must be a list, got: ${workflow.runtimeType}.',
|
||||
);
|
||||
}
|
||||
if (workflow.isEmpty) {
|
||||
return _ValidateResult(
|
||||
false, '"pipeline.workflow" must contain at least one task.');
|
||||
false,
|
||||
'"pipeline.workflow" must contain at least one task.',
|
||||
);
|
||||
}
|
||||
return _ValidateResult(true, '');
|
||||
}
|
||||
|
|
@ -255,22 +298,30 @@ class Application {
|
|||
final id = entry['id'];
|
||||
if (id is! String || id.trim().isEmpty) {
|
||||
return _ValidateResult(
|
||||
false, 'commands[$i] "id" must be a non-empty string.');
|
||||
false,
|
||||
'commands[$i] "id" must be a non-empty string.',
|
||||
);
|
||||
}
|
||||
final type = entry['command'];
|
||||
if (type is! String || type.trim().isEmpty) {
|
||||
return _ValidateResult(false,
|
||||
'commands[$i] (id: "$id") "command" must be a non-empty string.');
|
||||
return _ValidateResult(
|
||||
false,
|
||||
'commands[$i] (id: "$id") "command" must be a non-empty string.',
|
||||
);
|
||||
}
|
||||
final typeStr = type.toString();
|
||||
final matched = CommandType.values.where((e) => e.name == typeStr);
|
||||
if (matched.isEmpty) {
|
||||
return _ValidateResult(
|
||||
false, 'commands[$i] (id: "$id") has unknown type "$typeStr".');
|
||||
false,
|
||||
'commands[$i] (id: "$id") has unknown type "$typeStr".',
|
||||
);
|
||||
}
|
||||
if (!Command.registeredTypes.contains(matched.first)) {
|
||||
return _ValidateResult(false,
|
||||
'commands[$i] (id: "$id") type "$typeStr" is not registered.');
|
||||
return _ValidateResult(
|
||||
false,
|
||||
'commands[$i] (id: "$id") type "$typeStr" is not registered.',
|
||||
);
|
||||
}
|
||||
}
|
||||
return _ValidateResult(true, '');
|
||||
|
|
@ -279,7 +330,7 @@ class Application {
|
|||
static dynamic _yamlToPlain(dynamic value) {
|
||||
if (value is YamlMap) {
|
||||
return {
|
||||
for (final e in value.entries) e.key.toString(): _yamlToPlain(e.value)
|
||||
for (final e in value.entries) e.key.toString(): _yamlToPlain(e.value),
|
||||
};
|
||||
} else if (value is YamlList) {
|
||||
return [for (final item in value) _yamlToPlain(item)];
|
||||
|
|
@ -298,13 +349,21 @@ class Application {
|
|||
commandStates[target] = state;
|
||||
}
|
||||
|
||||
Future printBuildStep(String name, Color? color) async {
|
||||
if (!_logEnable) return simpleFuture;
|
||||
var message =
|
||||
'''$enter*********************************************************************************************
|
||||
* $name
|
||||
*********************************************************************************************''';
|
||||
await CLI.printString(message, color: color ?? Color.green);
|
||||
RunnerOutputPort _buildOutputPort(RunnerOutputPort? output) {
|
||||
final target =
|
||||
output ??
|
||||
CliRunnerOutputPort(
|
||||
enabled: () => _logEnable,
|
||||
leadingPrefix: () => enter,
|
||||
);
|
||||
return _LogGateOutputPort(target, () => _logEnable);
|
||||
}
|
||||
|
||||
Future printBuildStep(
|
||||
String name, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.success,
|
||||
}) async {
|
||||
await context.output.buildStep(name, style: style);
|
||||
return simpleFuture;
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +437,9 @@ class Application {
|
|||
}
|
||||
|
||||
static _ValidateResult _populateCommandMap(
|
||||
DataBuild build, ExecutionContext context) {
|
||||
DataBuild build,
|
||||
ExecutionContext context,
|
||||
) {
|
||||
for (var command in build.commands) {
|
||||
if (context.dataCommandMap.containsKey(command.id)) {
|
||||
return _ValidateResult(
|
||||
|
|
@ -393,6 +454,40 @@ class Application {
|
|||
}
|
||||
}
|
||||
|
||||
class _LogGateOutputPort implements RunnerOutputPort {
|
||||
final RunnerOutputPort _target;
|
||||
final bool Function() _enabled;
|
||||
|
||||
_LogGateOutputPort(this._target, this._enabled);
|
||||
|
||||
@override
|
||||
Future<void> line(
|
||||
String message, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.normal,
|
||||
}) async {
|
||||
if (!_enabled()) return;
|
||||
await _target.line(message, style: style);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> block(
|
||||
String message, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.normal,
|
||||
}) async {
|
||||
if (!_enabled()) return;
|
||||
await _target.block(message, style: style);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> buildStep(
|
||||
String name, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.success,
|
||||
}) async {
|
||||
if (!_enabled()) return;
|
||||
await _target.buildStep(name, style: style);
|
||||
}
|
||||
}
|
||||
|
||||
class _ValidateResult {
|
||||
final bool enable;
|
||||
final String message;
|
||||
|
|
@ -406,10 +501,10 @@ class YamlValidationResult {
|
|||
final int exitCode;
|
||||
|
||||
const YamlValidationResult.success()
|
||||
: valid = true,
|
||||
phase = 'Validate YAML',
|
||||
message = 'YAML is valid.',
|
||||
exitCode = 0;
|
||||
: valid = true,
|
||||
phase = 'Validate YAML',
|
||||
message = 'YAML is valid.',
|
||||
exitCode = 0;
|
||||
|
||||
const YamlValidationResult.failure({
|
||||
required this.phase,
|
||||
|
|
@ -418,11 +513,11 @@ class YamlValidationResult {
|
|||
}) : valid = false;
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'schemaVersion': 1,
|
||||
'type': 'yamlValidation',
|
||||
'valid': valid,
|
||||
'phase': phase,
|
||||
'message': message,
|
||||
'exitCode': exitCode,
|
||||
};
|
||||
'schemaVersion': 1,
|
||||
'type': 'yamlValidation',
|
||||
'valid': valid,
|
||||
'phase': phase,
|
||||
'message': message,
|
||||
'exitCode': exitCode,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import 'dart:convert';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:dart_framework/utils/system_util.dart';
|
||||
import 'package:oto/cli/cli.dart';
|
||||
import 'package:oto/oto/application.dart';
|
||||
import 'package:oto/oto/core/output_port.dart';
|
||||
import 'package:oto/oto/data/base_data.dart';
|
||||
import 'package:oto/oto/core/defined_data.dart';
|
||||
import 'package:oto/oto/core/system_runtime.dart';
|
||||
|
|
@ -12,14 +12,14 @@ abstract class DataComposer {
|
|||
DataCommon? commonData;
|
||||
String buildYaml = '';
|
||||
|
||||
Future compose(String? yaml, Future Function(String, Color?) printer) async {
|
||||
Future compose(String? yaml, RunnerOutputPort output) async {
|
||||
return simpleFuture;
|
||||
}
|
||||
}
|
||||
|
||||
class DataComposerTest extends DataComposer {
|
||||
@override
|
||||
Future compose(String? yaml, Future Function(String, Color?) printer) async {
|
||||
Future compose(String? yaml, RunnerOutputPort output) async {
|
||||
commonData = DataCommon.fromJson(TestData.jenkinsMap!);
|
||||
buildYaml = TestData.buildYaml;
|
||||
return simpleFuture;
|
||||
|
|
@ -28,7 +28,7 @@ class DataComposerTest extends DataComposer {
|
|||
|
||||
class DataComposerFile extends DataComposer {
|
||||
@override
|
||||
Future compose(String? yaml, Future Function(String, Color?) printer) async {
|
||||
Future compose(String? yaml, RunnerOutputPort output) async {
|
||||
commonData = DataCommon.fromJson(LocalData.commonMap());
|
||||
buildYaml = yaml ?? '---';
|
||||
return simpleFuture;
|
||||
|
|
@ -52,17 +52,17 @@ class JenkinsEnvironmentCollector {
|
|||
|
||||
JenkinsEnvironmentCollector({required this.runtime});
|
||||
|
||||
Future<JenkinsEnvironmentSnapshot?> collect(
|
||||
Future Function(String, Color?) printer) async {
|
||||
Future<JenkinsEnvironmentSnapshot?> collect(RunnerOutputPort output) async {
|
||||
if (runtime.isMacOS || runtime.isLinux) {
|
||||
return _collectUnix();
|
||||
}
|
||||
if (runtime.isWindows) {
|
||||
return _collectWindows();
|
||||
}
|
||||
await printer(
|
||||
'is not Mac/Windows/Linux. build must be execute in Mac/Windows os system',
|
||||
Color.redStrong);
|
||||
await output.buildStep(
|
||||
'is not Mac/Windows/Linux. build must be execute in Mac/Windows os system',
|
||||
style: RunnerOutputStyle.error,
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -103,10 +103,12 @@ echo -e '
|
|||
|
||||
Future<JenkinsEnvironmentSnapshot> _collectWindows() async {
|
||||
String jsonStr = '';
|
||||
await runtime.runExecutable('cmd', [
|
||||
'/C',
|
||||
'${Directory.current.path}/assets/script/batch/jenkins_env_params.bat'
|
||||
]).then((ProcessResult result) => jsonStr = result.stdout);
|
||||
await runtime
|
||||
.runExecutable('cmd', [
|
||||
'/C',
|
||||
'${Directory.current.path}/assets/script/batch/jenkins_env_params.bat',
|
||||
])
|
||||
.then((ProcessResult result) => jsonStr = result.stdout);
|
||||
jsonStr = jsonStr.substring(jsonStr.indexOf('{'));
|
||||
jsonStr = jsonStr.replaceAll('\\', '/');
|
||||
final variables = getMapFromJson(jsonStr)!;
|
||||
|
|
@ -166,17 +168,17 @@ class DataComposerJenkins extends DataComposer {
|
|||
DataComposerJenkins({required this.runtime});
|
||||
|
||||
@override
|
||||
Future compose(String? yaml, Future Function(String, Color?) printer) async {
|
||||
Future compose(String? yaml, RunnerOutputPort output) async {
|
||||
Application.log('Current OS: ${Platform.operatingSystem}');
|
||||
Application.log('Start build...');
|
||||
|
||||
final collector = JenkinsEnvironmentCollector(runtime: runtime);
|
||||
final snapshot = await collector.collect(printer);
|
||||
final snapshot = await collector.collect(output);
|
||||
if (snapshot == null) return simpleFuture;
|
||||
|
||||
commonData = DataCommon.fromJson(snapshot.variables);
|
||||
buildYaml = snapshot.buildYaml;
|
||||
await printer('Jenkins Variables', Color.green);
|
||||
await output.buildStep('Jenkins Variables');
|
||||
Application.log(snapshot.rawVariablesJson);
|
||||
|
||||
return simpleFuture;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -13,6 +13,7 @@ void main() {
|
|||
Application.instance.property = {};
|
||||
Application.instance.commandStates = {};
|
||||
Application.instance.dataCommandMap = {};
|
||||
Application.instance.context.output = const NoopRunnerOutputPort();
|
||||
});
|
||||
|
||||
test('parses minimal build yaml into DataBuild', () {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import 'dart:io';
|
|||
import 'package:dart_framework/platform/process.dart';
|
||||
import 'package:oto/oto/application.dart';
|
||||
import 'package:oto/oto/core/data_composer.dart';
|
||||
import 'package:oto/oto/core/output_port.dart';
|
||||
import 'package:oto/oto/core/system_runtime.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
|
|
@ -15,8 +16,13 @@ class _ShellCall {
|
|||
final bool printStdout;
|
||||
final bool printStderr;
|
||||
final Converter<List<int>, String>? decoder;
|
||||
_ShellCall(this.shell, this.workspace, this.printStdout, this.printStderr,
|
||||
this.decoder);
|
||||
_ShellCall(
|
||||
this.shell,
|
||||
this.workspace,
|
||||
this.printStdout,
|
||||
this.printStderr,
|
||||
this.decoder,
|
||||
);
|
||||
}
|
||||
|
||||
class _RunExecutableCall {
|
||||
|
|
@ -32,7 +38,11 @@ class _StartExecutableCall {
|
|||
final String? workingDirectory;
|
||||
final ProcessStartMode mode;
|
||||
_StartExecutableCall(
|
||||
this.program, this.args, this.workingDirectory, this.mode);
|
||||
this.program,
|
||||
this.args,
|
||||
this.workingDirectory,
|
||||
this.mode,
|
||||
);
|
||||
}
|
||||
|
||||
class FakeProcessData extends ProcessData {
|
||||
|
|
@ -71,10 +81,10 @@ class FakeSystemRuntime implements SystemRuntime {
|
|||
Map<String, String> environment = const {},
|
||||
this.runShellStdout = '',
|
||||
this.startShellStdout = '',
|
||||
}) : _isWindows = isWindows,
|
||||
_isMacOS = isMacOS,
|
||||
_isLinux = isLinux,
|
||||
_environment = environment;
|
||||
}) : _isWindows = isWindows,
|
||||
_isMacOS = isMacOS,
|
||||
_isLinux = isLinux,
|
||||
_environment = environment;
|
||||
|
||||
@override
|
||||
bool get isWindows => _isWindows;
|
||||
|
|
@ -94,8 +104,15 @@ class FakeSystemRuntime implements SystemRuntime {
|
|||
Converter<List<int>, String>? decoder,
|
||||
LogHandler? logHandler,
|
||||
}) async {
|
||||
startShellCalls.add(_ShellCall(
|
||||
shell.toString(), workspace, printStdout, printStderr, decoder));
|
||||
startShellCalls.add(
|
||||
_ShellCall(
|
||||
shell.toString(),
|
||||
workspace,
|
||||
printStdout,
|
||||
printStderr,
|
||||
decoder,
|
||||
),
|
||||
);
|
||||
return FakeProcessData(stdoutText: startShellStdout);
|
||||
}
|
||||
|
||||
|
|
@ -108,8 +125,15 @@ class FakeSystemRuntime implements SystemRuntime {
|
|||
Converter<List<int>, String>? decoder,
|
||||
LogHandler? logHandler,
|
||||
}) async {
|
||||
runShellCalls.add(_ShellCall(
|
||||
shell.toString(), workspace, printStdout, printStderr, decoder));
|
||||
runShellCalls.add(
|
||||
_ShellCall(
|
||||
shell.toString(),
|
||||
workspace,
|
||||
printStdout,
|
||||
printStderr,
|
||||
decoder,
|
||||
),
|
||||
);
|
||||
return ProcessResult(0, 0, runShellStdout, '');
|
||||
}
|
||||
|
||||
|
|
@ -132,8 +156,9 @@ class FakeSystemRuntime implements SystemRuntime {
|
|||
String? workingDirectory,
|
||||
ProcessStartMode mode = ProcessStartMode.normal,
|
||||
}) async {
|
||||
startExecutableCalls
|
||||
.add(_StartExecutableCall(program, args, workingDirectory, mode));
|
||||
startExecutableCalls.add(
|
||||
_StartExecutableCall(program, args, workingDirectory, mode),
|
||||
);
|
||||
throw UnsupportedError('FakeSystemRuntime does not return a real Process');
|
||||
}
|
||||
|
||||
|
|
@ -158,9 +183,9 @@ void main() {
|
|||
});
|
||||
|
||||
test(
|
||||
'DataComposerJenkins composes linux env and BuildData from runtime stdout',
|
||||
() async {
|
||||
const jenkinsJson = '''
|
||||
'DataComposerJenkins composes linux env and BuildData from runtime stdout',
|
||||
() async {
|
||||
const jenkinsJson = '''
|
||||
{
|
||||
"workspace": "/workspace",
|
||||
"jenkinsHome": "/jenkins",
|
||||
|
|
@ -176,28 +201,32 @@ void main() {
|
|||
"buildTag": "myjob-42"
|
||||
}
|
||||
''';
|
||||
const buildYaml = 'property:\n workspace: .\ncommands: []\n';
|
||||
final fake = FakeSystemRuntime(
|
||||
isLinux: true,
|
||||
runShellStdout: jenkinsJson,
|
||||
startShellStdout: buildYaml,
|
||||
);
|
||||
const buildYaml = 'property:\n workspace: .\ncommands: []\n';
|
||||
final fake = FakeSystemRuntime(
|
||||
isLinux: true,
|
||||
runShellStdout: jenkinsJson,
|
||||
startShellStdout: buildYaml,
|
||||
);
|
||||
|
||||
final composer = DataComposerJenkins(runtime: fake);
|
||||
await composer.compose(null, (msg, color) async {});
|
||||
final composer = DataComposerJenkins(runtime: fake);
|
||||
final output = _RecordingOutputPort();
|
||||
await composer.compose(null, output);
|
||||
|
||||
expect(fake.runShellCalls, hasLength(1));
|
||||
expect(fake.startShellCalls, hasLength(1));
|
||||
expect(fake.startShellCalls.single.printStdout, isFalse);
|
||||
expect(composer.commonData, isNotNull);
|
||||
expect(composer.commonData!.workspace, '/workspace');
|
||||
expect(composer.buildYaml, buildYaml);
|
||||
});
|
||||
expect(fake.runShellCalls, hasLength(1));
|
||||
expect(fake.startShellCalls, hasLength(1));
|
||||
expect(fake.startShellCalls.single.printStdout, isFalse);
|
||||
expect(composer.commonData, isNotNull);
|
||||
expect(composer.commonData!.workspace, '/workspace');
|
||||
expect(composer.buildYaml, buildYaml);
|
||||
expect(output.steps.single.message, 'Jenkins Variables');
|
||||
expect(output.steps.single.style, RunnerOutputStyle.success);
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'JenkinsEnvironmentCollector collects linux env and build yaml from runtime',
|
||||
() async {
|
||||
const jenkinsJson = '''
|
||||
'JenkinsEnvironmentCollector collects linux env and build yaml from runtime',
|
||||
() async {
|
||||
const jenkinsJson = '''
|
||||
{
|
||||
"workspace": "/workspace",
|
||||
"jenkinsHome": "/jenkins",
|
||||
|
|
@ -213,24 +242,44 @@ void main() {
|
|||
"buildTag": "myjob-42"
|
||||
}
|
||||
''';
|
||||
const buildYaml = 'property:\n workspace: .\ncommands: []\n';
|
||||
final fake = FakeSystemRuntime(
|
||||
isLinux: true,
|
||||
runShellStdout: jenkinsJson,
|
||||
startShellStdout: buildYaml,
|
||||
);
|
||||
const buildYaml = 'property:\n workspace: .\ncommands: []\n';
|
||||
final fake = FakeSystemRuntime(
|
||||
isLinux: true,
|
||||
runShellStdout: jenkinsJson,
|
||||
startShellStdout: buildYaml,
|
||||
);
|
||||
|
||||
final collector = JenkinsEnvironmentCollector(runtime: fake);
|
||||
final snapshot = await collector.collect((msg, color) async {});
|
||||
final collector = JenkinsEnvironmentCollector(runtime: fake);
|
||||
final snapshot = await collector.collect(const NoopRunnerOutputPort());
|
||||
|
||||
expect(snapshot, isNotNull);
|
||||
expect(snapshot!.variables['workspace'], '/workspace');
|
||||
expect(snapshot.buildYaml, buildYaml);
|
||||
expect(snapshot.rawVariablesJson, jenkinsJson);
|
||||
expect(fake.runShellCalls, hasLength(1));
|
||||
expect(fake.startShellCalls, hasLength(1));
|
||||
expect(fake.startShellCalls.single.printStdout, isFalse);
|
||||
});
|
||||
expect(snapshot, isNotNull);
|
||||
expect(snapshot!.variables['workspace'], '/workspace');
|
||||
expect(snapshot.buildYaml, buildYaml);
|
||||
expect(snapshot.rawVariablesJson, jenkinsJson);
|
||||
expect(fake.runShellCalls, hasLength(1));
|
||||
expect(fake.startShellCalls, hasLength(1));
|
||||
expect(fake.startShellCalls.single.printStdout, isFalse);
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'JenkinsEnvironmentCollector emits unsupported OS through output port',
|
||||
() async {
|
||||
final fake = FakeSystemRuntime(
|
||||
isWindows: false,
|
||||
isMacOS: false,
|
||||
isLinux: false,
|
||||
);
|
||||
final output = _RecordingOutputPort();
|
||||
|
||||
final collector = JenkinsEnvironmentCollector(runtime: fake);
|
||||
final snapshot = await collector.collect(output);
|
||||
|
||||
expect(snapshot, isNull);
|
||||
expect(output.steps.single.message, contains('is not Mac/Windows/Linux'));
|
||||
expect(output.steps.single.style, RunnerOutputStyle.error);
|
||||
},
|
||||
);
|
||||
|
||||
test('fake system runtime records process calls', () async {
|
||||
final fake = FakeSystemRuntime(
|
||||
|
|
@ -261,8 +310,10 @@ void main() {
|
|||
expect(fake.runShellCalls.single.workspace, '/var/www');
|
||||
|
||||
// runExecutable
|
||||
await fake.runExecutable('git', ['status', '--short'],
|
||||
workingDirectory: '/repo');
|
||||
await fake.runExecutable('git', [
|
||||
'status',
|
||||
'--short',
|
||||
], workingDirectory: '/repo');
|
||||
expect(fake.runExecutableCalls, hasLength(1));
|
||||
expect(fake.runExecutableCalls.single.exe, 'git');
|
||||
expect(fake.runExecutableCalls.single.args, ['status', '--short']);
|
||||
|
|
@ -270,8 +321,12 @@ void main() {
|
|||
|
||||
// startExecutable (detached)
|
||||
await expectLater(
|
||||
fake.startExecutable('my_daemon', ['--port', '8080'],
|
||||
workingDirectory: '/srv', mode: ProcessStartMode.detached),
|
||||
fake.startExecutable(
|
||||
'my_daemon',
|
||||
['--port', '8080'],
|
||||
workingDirectory: '/srv',
|
||||
mode: ProcessStartMode.detached,
|
||||
),
|
||||
throwsUnsupportedError,
|
||||
);
|
||||
expect(fake.startExecutableCalls, hasLength(1));
|
||||
|
|
@ -294,3 +349,40 @@ void main() {
|
|||
expect(fake.environment['HOME'], '/home/test');
|
||||
});
|
||||
}
|
||||
|
||||
class _OutputRecord {
|
||||
final String message;
|
||||
final RunnerOutputStyle style;
|
||||
|
||||
_OutputRecord(this.message, this.style);
|
||||
}
|
||||
|
||||
class _RecordingOutputPort implements RunnerOutputPort {
|
||||
final List<_OutputRecord> lines = [];
|
||||
final List<_OutputRecord> blocks = [];
|
||||
final List<_OutputRecord> steps = [];
|
||||
|
||||
@override
|
||||
Future<void> line(
|
||||
String message, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.normal,
|
||||
}) async {
|
||||
lines.add(_OutputRecord(message, style));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> block(
|
||||
String message, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.normal,
|
||||
}) async {
|
||||
blocks.add(_OutputRecord(message, style));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> buildStep(
|
||||
String name, {
|
||||
RunnerOutputStyle style = RunnerOutputStyle.success,
|
||||
}) async {
|
||||
steps.add(_OutputRecord(name, style));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue