Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
*/
public enum FlowEnvs implements EnvKey {

FLOW_NAME(true, false, null),

/**
* Indicate flow is configured for git
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ private Job createJob(String path, JobCategory eventType, Map<String, String> en
job.setUpdatedAt(ZonedDateTime.now());

// setup job env variables
job.putEnv(FlowEnvs.FLOW_NAME, root.getName());
job.putEnv(JobEnvs.FLOW_JOB_BUILD_CATEGORY, eventType.name());
job.putEnv(JobEnvs.FLOW_JOB_BUILD_NUMBER, job.getNumber().toString());
job.putEnv(JobEnvs.FLOW_JOB_LOG_PATH, logUrl(job));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public Node createEmptyFlow(final String flowName) {
}

// init env variables
flow.putEnv(FlowEnvs.FLOW_NAME, flowName);
flow.putEnv(FlowEnvs.FLOW_STATUS, StatusValue.PENDING);
flow.putEnv(FlowEnvs.FLOW_YML_STATUS, YmlStatusValue.NOT_FOUND);
flow.putEnv(GitEnvs.FLOW_GIT_WEBHOOK, hooksUrl(flow));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private Node init_flow(String gitUrl) throws Throwable {
Node loaded = nodeService.find(flowPath).root();

Assert.assertNotNull(loaded);
Assert.assertEquals(12, loaded.getEnvs().size());
Assert.assertEquals(13, loaded.getEnvs().size());
Assert.assertEquals(FlowEnvs.YmlStatusValue.FOUND.value(), loaded.getEnv(FlowEnvs.FLOW_YML_STATUS));

return loaded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ public void should_list_env() {

// then: check the flow actual envs size
Node flow = nodeService.find(node.getPath()).root();
Assert.assertEquals(10, flow.getEnvs().size());
Assert.assertEquals(11, flow.getEnvs().size());

// when: list none editable only which from copied node envs
Map<String, String> noneEditable = envService.list(node, false);
Assert.assertEquals(8, noneEditable.size());
Assert.assertEquals(9, noneEditable.size());
Assert.assertTrue(noneEditable.containsKey(FLOW_STATUS.name()));
Assert.assertTrue(noneEditable.containsKey(FLOW_YML_STATUS.name()));
Assert.assertTrue(noneEditable.containsKey(FLOW_GIT_WEBHOOK.name()));

// then: check the actual flow envs size not changed
Assert.assertEquals(10, flow.getEnvs().size());
Assert.assertEquals(11, flow.getEnvs().size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ public void should_save_node_env() throws Throwable {
// then:
String webhook = HttpURL.build(apiDomain).append("/hooks/git").append(emptyFlow.getName()).toString();
Node loaded = nodeService.find("flow1").root();
Assert.assertEquals(15, loaded.getEnvs().size());
Assert.assertEquals(16, loaded.getEnvs().size());
Assert.assertEquals("flow1", loaded.getEnv(FlowEnvs.FLOW_NAME));
Assert.assertEquals("hello", loaded.getEnv("FLOW_NEW_1"));
Assert.assertEquals("world", loaded.getEnv("FLOW_NEW_2"));
Assert.assertEquals("done", loaded.getEnv("FLOW_NEW_3"));
Expand All @@ -213,7 +214,7 @@ public void should_save_node_env() throws Throwable {

// check env been sync with yml
Node flow = flowDao.get("flow1");
Assert.assertEquals(15, flow.getEnvs().size());
Assert.assertEquals(16, flow.getEnvs().size());
Assert.assertEquals("hello", flow.getEnv("FLOW_NEW_1"));
Assert.assertEquals("world", flow.getEnv("FLOW_NEW_2"));
Assert.assertEquals("done", flow.getEnv("FLOW_NEW_3"));
Expand Down