From 94efbd63ddb1552fca28afde694e43e8a0b2a1d0 Mon Sep 17 00:00:00 2001 From: "leedongmyung(desktop)" Date: Mon, 31 Mar 2025 15:31:33 +0900 Subject: [PATCH] =?UTF-8?q?contain=20pipeline=EC=97=90=20string=ED=98=95?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/example.yaml | 4 ++-- assets/pipeline-test2.yaml | 10 ++++++++++ lib/oto/core/data_composer.dart | 1 - lib/oto/pipeline/pipeline_contain.dart | 19 +++++++++++-------- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/assets/example.yaml b/assets/example.yaml index d922902..f6a15f6 100644 --- a/assets/example.yaml +++ b/assets/example.yaml @@ -25,7 +25,7 @@ pipeline: #property의 내용은 기본 dynamic(Object)형으로써, 비교시 정확한 캐스팅 필요, 적지 않을시 기본 string condition: == [int] #false도 가능, true/false로 선언시 일반적인 else와 동일 - true: + on-true: - exe: #일반적인 while문과 동일 @@ -39,7 +39,7 @@ pipeline: - if: #version에 대한 비교시, 자릿수는 같아야 한다 0.0.0 or 0.0.0.0 condition: == 1.0.1 [version] - true: + on-true: #조건문 내에도 선언 가능, 반대도 가능 - while: condition-int: < 10 diff --git a/assets/pipeline-test2.yaml b/assets/pipeline-test2.yaml index 6223331..31736b2 100644 --- a/assets/pipeline-test2.yaml +++ b/assets/pipeline-test2.yaml @@ -7,6 +7,11 @@ property: pipeline: id: main workflow: + - contain: + list: this is test + target: back + on-true: + - exe: print0 - exe: read-web - exe: json-read-web - exe: json-read-local @@ -28,6 +33,11 @@ pipeline: commands: +- command: Print + id: print0 + param: + message: test + - command: FileInfo id: info param: diff --git a/lib/oto/core/data_composer.dart b/lib/oto/core/data_composer.dart index a82d5e5..a5b3ea8 100644 --- a/lib/oto/core/data_composer.dart +++ b/lib/oto/core/data_composer.dart @@ -65,7 +65,6 @@ echo -e ' }' '''; var result = await ProcessExecutor.run(StringBuffer(script)); - print('===================>\n${result.stdout}'); jenkinsMap = getMapFromJson(result.stdout)!; //write build data diff --git a/lib/oto/pipeline/pipeline_contain.dart b/lib/oto/pipeline/pipeline_contain.dart index d6c3b85..127ee24 100644 --- a/lib/oto/pipeline/pipeline_contain.dart +++ b/lib/oto/pipeline/pipeline_contain.dart @@ -39,18 +39,21 @@ class PipelineContain extends PipelineExecutor { @override Future execute() async { - List list; - var listRaw = data.list; - if(listRaw is String) { - list = Command.replaceSingleTagValue(listRaw); - } else { - list = listRaw as List; - } var result = ConditionCheckResult(); var value = Command.replaceSingleTagValue(data.target); value ??= data.target; result.conditionValue = 'Contain in "$value".'; - result.result = list.contains(value); + + var listRaw = data.list; + if(listRaw is String) { + var str = Command.replaceTagValue(listRaw) as String; + result.result = str.contains(value); + } else { + var list = listRaw as List; + result.result = list.contains(value); + } + + await PipelineExecutor.printCondition('Contain', 'Contain in "${data.target}"', getPostfix(result.result), result); if (result.result) { await _pipelineTrue?.execute();