Skip to content

Commit 8ed5abd

Browse files
committed
rm script instead of bash and pwsh
1 parent fe6567f commit 8ed5abd

File tree

10 files changed

+30
-19
lines changed

10 files changed

+30
-19
lines changed

tree/src/main/java/com/flowci/tree/StepNode.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff 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

tree/src/main/java/com/flowci/tree/yml/StepYml.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff 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);

tree/src/test/java/com/flowci/tree/test/YmlParserTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

tree/src/test/resources/flow-with-exports.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ steps:
2727

2828
- name: step2
2929
allow_failure: false
30-
script: "echo 2"
30+
bash: "echo 2"

tree/src/test/resources/flow-with-invalid-name.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ steps:
2727
2828
- name: step;'2
2929
allow_failure: false
30-
script: "echo 2"
30+
bash: "echo 2"

tree/src/test/resources/flow.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ steps:
4242
- "2700:2700"
4343
entrypoint: ["/bin/sh"]
4444
network: host
45-
script: "echo 2"
45+
bash: "echo 2"
46+
pwsh: "echo powershell"

tree/src/test/resources/parent-step-with-plugin.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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"

tree/src/test/resources/runtime-with-command.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ steps:
1717
MY_PW: "12345"
1818
network_mode: none
1919

20-
script: "echo 2"
20+
bash: "echo 2"

tree/src/test/resources/step-in-step.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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"

tree/src/test/resources/step-with-dockers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ steps:
3030
environment:
3131
MY_PW: "12345"
3232
network: none
33-
script: "echo 2"
33+
bash: "echo 2"

0 commit comments

Comments
 (0)