File tree Expand file tree Collapse file tree 10 files changed +30
-19
lines changed
main/java/com/flowci/tree
java/com/flowci/tree/test Expand file tree Collapse file tree 10 files changed +30
-19
lines changed Original file line number Diff line number Diff line change @@ -22,9 +22,14 @@ public class StepNode extends Node {
2222 private String condition ;
2323
2424 /**
25- * Node execute script, can be null
25+ * bash script
2626 */
27- private String script ;
27+ private String bash ;
28+
29+ /**
30+ * powershell script
31+ */
32+ private String pwsh ;
2833
2934 /**
3035 * Plugin name
@@ -56,7 +61,7 @@ public boolean hasCondition() {
5661
5762 @ JsonIgnore
5863 public boolean hasScript () {
59- return !Strings .isNullOrEmpty (script );
64+ return !Strings .isNullOrEmpty (bash ) || ! Strings . isNullOrEmpty ( pwsh );
6065 }
6166
6267 @ JsonIgnore
Original file line number Diff line number Diff line change @@ -45,7 +45,9 @@ public class StepYml extends YmlBase<StepNode> {
4545 */
4646 private String condition ;
4747
48- private String script ;
48+ private String bash ; // bash script
49+
50+ private String pwsh ; // powershell script
4951
5052 private String plugin ;
5153
@@ -56,15 +58,17 @@ public class StepYml extends YmlBase<StepNode> {
5658 StepYml (StepNode node ) {
5759 setName (node .getName ());
5860 setEnvs (node .getEnvironments ());
59- setScript (node .getScript ());
61+ setBash (node .getBash ());
62+ setPwsh (node .getPwsh ());
6063 setPlugin (node .getPlugin ());
6164 setAllow_failure (node .isAllowFailure ());
6265 }
6366
6467 public StepNode toNode (Node parent , int index ) {
6568 StepNode node = new StepNode (buildName (index ), parent );
6669 node .setCondition (condition );
67- node .setScript (script );
70+ node .setBash (bash );
71+ node .setPwsh (pwsh );
6872 node .setPlugin (plugin );
6973 node .setExports (Sets .newHashSet (exports ));
7074 node .setAllowFailure (allow_failure );
Original file line number Diff line number Diff line change @@ -86,7 +86,8 @@ public void should_get_node_from_yml() {
8686
8787 StepNode step2 = steps .get (1 );
8888 Assert .assertEquals ("step2" , step2 .getName ());
89- Assert .assertEquals ("echo 2" , step2 .getScript ());
89+ Assert .assertEquals ("echo 2" , step2 .getBash ());
90+ Assert .assertEquals ("echo powershell" , step2 .getPwsh ());
9091
9192 DockerOption dockerOption = step2 .getDockers ().get (0 );
9293 Assert .assertNotNull (dockerOption );
Original file line number Diff line number Diff line change 2727
2828- name : step2
2929 allow_failure : false
30- script : " echo 2"
30+ bash : " echo 2"
Original file line number Diff line number Diff line change 2727
2828 - name : step;'2
2929 allow_failure : false
30- script : " echo 2"
30+ bash : " echo 2"
Original file line number Diff line number Diff line change 4242 - " 2700:2700"
4343 entrypoint : ["/bin/sh"]
4444 network : host
45- script : " echo 2"
45+ bash : " echo 2"
46+ pwsh : " echo powershell"
Original file line number Diff line number Diff line change @@ -16,14 +16,14 @@ steps:
1616 - image : " ubuntu:18.04"
1717 is_runtime : true
1818 - image : " mysql"
19- script : " echo 2"
19+ bash : " echo 2"
2020 plugin : " invalid"
2121
2222 steps :
2323 - name : step-2-1
24- script : |
24+ bash : |
2525 echo "step-1 in step2"
2626
2727 - name : step-2-2
28- script : |
28+ bash : |
2929 echo "step-2 in step2"
Original file line number Diff line number Diff line change 1717 MY_PW : " 12345"
1818 network_mode : none
1919
20- script : " echo 2"
20+ bash : " echo 2"
Original file line number Diff line number Diff line change @@ -16,16 +16,16 @@ steps:
1616 - image : " ubuntu:18.04"
1717 is_runtime : true
1818 - image : " mysql"
19- script : " echo 2"
19+ bash : " echo 2"
2020
2121 steps :
2222 - name : step-2-1
23- script : |
23+ bash : |
2424 echo "step-1 in step2"
2525
2626 - name : step-2-2
27- script : |
27+ bash : |
2828 echo "step-2 in step2"
2929
3030 - name : create test
31- script : " echo end"
31+ bash : " echo end"
Original file line number Diff line number Diff line change 3030 environment :
3131 MY_PW : " 12345"
3232 network : none
33- script : " echo 2"
33+ bash : " echo 2"
You can’t perform that action at this time.
0 commit comments