Skip to content

Commit 16b50cf

Browse files
authored
Merge branch 'master' into server-ansible-cleanup
2 parents 9e63ce8 + b9d4867 commit 16b50cf

File tree

256 files changed

+3823
-1716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+3823
-1716
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ jobs:
4242
4343
- name: Build and test with Maven
4444
run: ./mvnw -B clean install -Pdocker -Pit -Pjdk${{ matrix.jdk_version }}
45+
46+
- name: Build with debian docker images
47+
run: ./mvnw -C -B -f docker-images install -DskipTests -Pdocker -Pdebian -Pjdk${{ matrix.jdk_version }}

CHANGELOG.md

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,80 @@
11
# Change log
22

3-
## [1.97.0] - Unreleased
3+
## [1.98.1] - 2022-12-22
4+
5+
### Changed
6+
7+
- concord-server: @Inject refactoring (part 1)
8+
([#658](https://github.com/walmartlabs/concord/pull/658));
9+
- concord-server, oidc: OIDC team/role mapping. Maps
10+
OpenID properties (e.g. `groups`) to Concord teams and
11+
roles
12+
([#682](https://github.com/walmartlabs/concord/pull/682));
13+
- concord-server: `process_queue` table split (part 1)
14+
([#668](https://github.com/walmartlabs/concord/pull/668));
15+
- runtime-v2: do not create log segments for expressions
16+
by default. Logs produced by expression blocks without
17+
`name` will no longer be displayed as a separate log
18+
"segment";
19+
([#689](https://github.com/walmartlabs/concord/pull/689));
20+
- concord-console: new compact view for the Log tab
21+
([#690](https://github.com/walmartlabs/concord/pull/690));
22+
- concord-server-db: a migration task to update secrets using
23+
the updated hashing algorithm
24+
([#691](https://github.com/walmartlabs/concord/pull/691));
25+
- concord-task: fix concurrency issue when collecting output
26+
of processes
27+
([#693](https://github.com/walmartlabs/concord/pull/693));
28+
- concord-server-db: pass secret salt as a base64 value
29+
([#694][https://github.com/walmartlabs/concord/pull/689]).
30+
31+
32+
33+
## [1.98.0] - 2022-12-07
34+
35+
### Added
36+
37+
- runtime-v2: provide checkpoint name after restore
38+
([#677](https://github.com/walmartlabs/concord/pull/677));
39+
- policy: new policy to restrict raw payload
40+
([#679](https://github.com/walmartlabs/concord/pull/679));
41+
- concord-cli: provide default process configuration
42+
([#649](https://github.com/walmartlabs/concord/pull/649));
43+
- policy: policy to restrict runtime of process
44+
([#671](https://github.com/walmartlabs/concord/pull/671));
45+
- resource-task: add printJson() method
46+
([#676](https://github.com/walmartlabs/concord/pull/676));
47+
- server: cleanup agent commands
48+
([#674](https://github.com/walmartlabs/concord/pull/674));
49+
- policy-engine: `cron` trigger policy
50+
([#686](https://github.com/walmartlabs/concord/pull/686)).
51+
52+
### Changed
53+
54+
- runtime-v2: fix parallel loop execution when no out variable defined
55+
([#659](https://github.com/walmartlabs/concord/pull/659));
56+
- console2: repository list now with paging
57+
([#643](https://github.com/walmartlabs/concord/pull/643));
58+
- server: api for list project repositories with limit/offset
59+
([#643](https://github.com/walmartlabs/concord/pull/643));
60+
- runtime-v2: "throw" with a string value shouldn't produce a stacktrace
61+
([#673](https://github.com/walmartlabs/concord/pull/673));
62+
- concord-server: deprecate `process_queue.commit_msg`
63+
([#670](https://github.com/walmartlabs/concord/pull/670));
64+
- runtime-v2: move expression evaluator into sdk
65+
([#667](https://github.com/walmartlabs/concord/pull/667));
66+
- cli: log checkpoint instead of throwing Exception
67+
([#665](https://github.com/walmartlabs/concord/pull/665));
68+
- http-task: allow any value as json body
69+
([#675](https://github.com/walmartlabs/concord/pull/675));
70+
- docker-images: change the default shell to bash in
71+
Debian-based images
72+
([#644](https://github.com/walmartlabs/concord/pull/675));
73+
- runtime-v2: fix `entryPoint` calculation in effective YAML
74+
([#685](https://github.com/walmartlabs/concord/pull/685)).
75+
76+
77+
## [1.97.0] - 2022-10-11
478

579
### Added
680

agent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.walmartlabs.concord</groupId>
88
<artifactId>parent</artifactId>
9-
<version>1.97.1-SNAPSHOT</version>
9+
<version>1.98.2-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

agent/src/main/java/com/walmartlabs/concord/agent/cfg/ServerConfiguration.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ public class ServerConfiguration {
4747
private final long readTimeout;
4848
private final String userAgent;
4949
private final long maxNoHeartbeatInterval;
50+
private final long processRequestDelay;
51+
private final long reconnectDelay;
5052

5153
@Inject
5254
public ServerConfiguration(Config cfg, AgentConfiguration agentCfg) {
@@ -71,6 +73,9 @@ public ServerConfiguration(Config cfg, AgentConfiguration agentCfg) {
7173
this.userAgent = getStringOrDefault(cfg, "server.userAgent", () -> "Concord-Agent: id=" + agentCfg.getAgentId());
7274

7375
this.maxNoHeartbeatInterval = cfg.getDuration("server.maxNoHeartbeatInterval", TimeUnit.MILLISECONDS);
76+
77+
this.processRequestDelay = cfg.getDuration("server.processRequestDelay", TimeUnit.MILLISECONDS);
78+
this.reconnectDelay = cfg.getDuration("server.reconnectDelay", TimeUnit.MILLISECONDS);
7479
}
7580

7681
public String getApiBaseUrl() {
@@ -113,6 +118,14 @@ public long getMaxNoHeartbeatInterval() {
113118
return maxNoHeartbeatInterval;
114119
}
115120

121+
public long getProcessRequestDelay() {
122+
return processRequestDelay;
123+
}
124+
125+
public long getReconnectDelay() {
126+
return reconnectDelay;
127+
}
128+
116129
private static String[] getWebsocketUrls(Config cfg) {
117130
// we had a silly typo ("websockeR") in our configs, so for backward compatibility we must check the old variant first
118131
String oldKey = "server.websockerUrl";

agent/src/main/java/com/walmartlabs/concord/agent/executors/runner/RunnerCommandBuilder.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ public String[] build() {
104104

105105
// speeds up the start, we don't care much about all potential optimizations done by HotSpot
106106
l.add("-client");
107-
// don't do bytecode verification
108-
l.add("-noverify");
107+
if (majorJavaVersion < 13) {
108+
// don't do bytecode verification
109+
l.add("-noverify");
110+
}
109111
// enable support for calling vararg methods in JUEL
110112
l.add("-Djavax.el.varArgs=true");
111113
// avoid blocking on crypto

agent/src/main/java/com/walmartlabs/concord/agent/executors/runner/RunnerJobExecutor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,9 @@ private void validateDependencies(RunnerJob job, Collection<DependencyEntity> re
415415

416416
CheckResult<DependencyRule, DependencyEntity> result = policyEngine.getDependencyPolicy().check(resolvedDepEntities);
417417
result.getWarn().forEach(d ->
418-
processLog.warn("Potentially restricted artifact '{}' (dependency policy: {})", d.getEntity(), d.getRule().getMsg()));
418+
processLog.warn("Potentially restricted artifact '{}' (dependency policy: {})", d.getEntity(), d.getRule().msg()));
419419
result.getDeny().forEach(d ->
420-
processLog.warn("Artifact '{}' is forbidden by the dependency policy {}", d.getEntity(), d.getRule().getMsg()));
420+
processLog.warn("Artifact '{}' is forbidden by the dependency policy {}", d.getEntity(), d.getRule().msg()));
421421

422422
if (!result.getDeny().isEmpty()) {
423423
throw new ExecutionException("Found restricted dependencies");

agent/src/main/java/com/walmartlabs/concord/agent/remote/QueueClientProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public QueueClient get() {
5454
.connectTimeout(serverCfg.getConnectTimeout())
5555
.pingInterval(serverCfg.getPingInterval())
5656
.maxNoActivityPeriod(serverCfg.getMaxNoActivityPeriod())
57+
.processRequestDelay(serverCfg.getProcessRequestDelay())
58+
.reconnectDelay(serverCfg.getReconnectDelay())
5759
.build());
5860

5961
queueClient.start();

agent/src/main/resources/concord-agent.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ concord-agent {
127127

128128
# maximum time interval without a heartbeat before the process fails
129129
maxNoHeartbeatInterval = "5 minutes"
130+
131+
# delay between successful polling attempts
132+
processRequestDelay = "1 seconds"
133+
134+
# delay between re-connection attempts if the server is unreachable or unhealthy
135+
reconnectDelay = "5 seconds"
130136
}
131137

132138
docker {

cli/pom.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.walmartlabs.concord</groupId>
88
<artifactId>parent</artifactId>
9-
<version>1.97.1-SNAPSHOT</version>
9+
<version>1.98.2-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

@@ -87,6 +87,10 @@
8787
<groupId>com.fasterxml.jackson.core</groupId>
8888
<artifactId>jackson-databind</artifactId>
8989
</dependency>
90+
<dependency>
91+
<groupId>com.fasterxml.jackson.dataformat</groupId>
92+
<artifactId>jackson-dataformat-yaml</artifactId>
93+
</dependency>
9094

9195
<dependency>
9296
<groupId>org.junit.jupiter</groupId>

cli/src/main/java/com/walmartlabs/concord/cli/Run.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*/
2222

2323
import com.fasterxml.jackson.databind.ObjectMapper;
24+
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
25+
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
2426
import com.google.inject.Injector;
2527
import com.walmartlabs.concord.cli.runner.*;
2628
import com.walmartlabs.concord.common.ConfigurationUtils;
@@ -196,7 +198,7 @@ public Integer call() throws Exception {
196198
Map<String, Object> overlayArgs = MapUtils.getMap(overlayCfg, Constants.Request.ARGUMENTS_KEY, Collections.emptyMap());
197199
Map<String, Object> args = ConfigurationUtils.deepMerge(cfg.arguments(), overlayArgs, extraVars);
198200
if (verbose) {
199-
System.out.println("Process arguments: " + args);
201+
dumpArguments(args);
200202
}
201203
args.put(Constants.Context.TX_ID_KEY, instanceId.toString());
202204
args.put(Constants.Context.WORK_DIR_KEY, targetDir.toAbsolutePath().toString());
@@ -231,7 +233,7 @@ public Integer call() throws Exception {
231233
runnerCfg,
232234
() -> cfg,
233235
new ProcessDependenciesModule(targetDir, runnerCfg.dependencies(), cfg.debug()),
234-
new CliServicesModule(secretStoreDir, targetDir, new VaultProvider(vaultDir, vaultId), dependencyManager))
236+
new CliServicesModule(secretStoreDir, targetDir, new VaultProvider(vaultDir, vaultId), dependencyManager, verbose))
235237
.create();
236238

237239
Runner runner = injector.getInstance(Runner.class);
@@ -309,6 +311,16 @@ private DependencyManagerConfiguration getDependencyManagerConfiguration() {
309311
return DependencyManagerConfiguration.of(depsCacheDir);
310312
}
311313

314+
private static void dumpArguments(Map<String, Object> args) {
315+
ObjectMapper om = new ObjectMapper(new YAMLFactory().disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER));
316+
try {
317+
System.out.println("Process arguments:");
318+
System.out.println(om.writerWithDefaultPrettyPrinter().writeValueAsString(args));
319+
} catch (Exception e) {
320+
throw new RuntimeException(e);
321+
}
322+
}
323+
312324
private static class CopyNotifier implements FileVisitor {
313325

314326
private final long notifyOnCount;

cli/src/main/java/com/walmartlabs/concord/cli/runner/CliCheckpointService.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* *****
55
* Concord
66
* -----
7-
* Copyright (C) 2017 - 2020 Walmart Inc.
7+
* Copyright (C) 2017 - 2023 Walmart Inc.
88
* -----
99
* Licensed under the Apache License, Version 2.0 (the "License");
1010
* you may not use this file except in compliance with the License.
@@ -20,17 +20,25 @@
2020
* =====
2121
*/
2222

23+
import com.walmartlabs.concord.runtime.common.SerializationUtils;
2324
import com.walmartlabs.concord.runtime.v2.runner.ProcessSnapshot;
2425
import com.walmartlabs.concord.runtime.v2.runner.checkpoints.CheckpointService;
2526
import com.walmartlabs.concord.svm.Runtime;
2627
import com.walmartlabs.concord.svm.ThreadId;
2728

29+
import java.io.ByteArrayOutputStream;
2830
import java.util.UUID;
2931

3032
public class CliCheckpointService implements CheckpointService {
3133

3234
@Override
3335
public void create(ThreadId threadId, UUID correlationId, String name, Runtime runtime, ProcessSnapshot snapshot) {
36+
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
37+
SerializationUtils.serialize(baos, snapshot.vmState());
38+
} catch (Exception e) {
39+
throw new RuntimeException("Checkpoint create error", e);
40+
}
41+
3442
System.out.println("Checkpoint '" + name + "' ignored");
3543
}
3644
}

cli/src/main/java/com/walmartlabs/concord/cli/runner/CliServicesModule.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.walmartlabs.concord.runtime.v2.runner.guice.BaseRunnerModule;
3131
import com.walmartlabs.concord.runtime.v2.runner.logging.RunnerLogger;
3232
import com.walmartlabs.concord.runtime.v2.runner.logging.SimpleLogger;
33+
import com.walmartlabs.concord.runtime.v2.runner.remote.EventRecordingExecutionListener;
3334
import com.walmartlabs.concord.runtime.v2.sdk.DockerService;
3435
import com.walmartlabs.concord.runtime.v2.sdk.LockService;
3536
import com.walmartlabs.concord.runtime.v2.sdk.SecretService;
@@ -44,16 +45,19 @@ public class CliServicesModule extends AbstractModule {
4445
private final Path workDir;
4546
private final VaultProvider vaultProvider;
4647
private final DependencyManager dependencyManager;
48+
private final boolean verbose;
4749

4850
public CliServicesModule(Path secretStoreDir,
4951
Path workDir,
5052
VaultProvider vaultProvider,
51-
DependencyManager dependencyManager) {
53+
DependencyManager dependencyManager,
54+
boolean verbose) {
5255

5356
this.secretStoreDir = secretStoreDir;
5457
this.workDir = workDir;
5558
this.vaultProvider = vaultProvider;
5659
this.dependencyManager = dependencyManager;
60+
this.verbose = verbose;
5761
}
5862

5963
@Override
@@ -76,7 +80,10 @@ protected void configure() {
7680
bind(DependencyManager.class).toInstance(dependencyManager);
7781
bind(com.walmartlabs.concord.runtime.v2.sdk.DependencyManager.class).to(DefaultDependencyManager.class).in(Singleton.class);
7882

79-
Multibinder.newSetBinder(binder(), ExecutionListener.class);
83+
Multibinder<ExecutionListener> executionListeners = Multibinder.newSetBinder(binder(), ExecutionListener.class);
84+
if (verbose) {
85+
executionListeners.addBinding().to(EventLoggerExecutionListener.class);
86+
}
8087
}
8188

8289
@SuppressWarnings("unchecked")
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
package com.walmartlabs.concord.cli.runner;
2+
3+
/*-
4+
* *****
5+
* Concord
6+
* -----
7+
* Copyright (C) 2017 - 2023 Walmart Inc.
8+
* -----
9+
* Licensed under the Apache License, Version 2.0 (the "License");
10+
* you may not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS,
17+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
* =====
21+
*/
22+
23+
import com.walmartlabs.concord.runtime.v2.model.*;
24+
import com.walmartlabs.concord.runtime.v2.runner.vm.StepCommand;
25+
import com.walmartlabs.concord.svm.Runtime;
26+
import com.walmartlabs.concord.svm.*;
27+
28+
public class EventLoggerExecutionListener implements ExecutionListener {
29+
30+
@Override
31+
public Result beforeCommand(Runtime runtime, VM vm, State state, ThreadId threadId, Command cmd) {
32+
if (!(cmd instanceof StepCommand)) {
33+
return Result.CONTINUE;
34+
}
35+
36+
StepCommand<?> s = (StepCommand<?>) cmd;
37+
38+
Location loc = s.getStep().getLocation();
39+
40+
System.out.println(">>> '" + getDescription(s.getStep()) + "' at " + loc.fileName() + ":" + loc.lineNum());
41+
42+
return Result.CONTINUE;
43+
}
44+
45+
private static String getDescription(Step step) {
46+
// TODO: add 'description' into step? so we will not miss description for new steps...
47+
if (step instanceof FlowCall) {
48+
return "Flow call: " + ((FlowCall) step).getFlowName();
49+
} else if (step instanceof Expression) {
50+
return "Expression: " + ((Expression) step).getExpr();
51+
} else if (step instanceof ScriptCall) {
52+
return "Script: " + ((ScriptCall) step).getLanguageOrRef();
53+
} else if (step instanceof IfStep) {
54+
return "Check: " + ((IfStep) step).getExpression();
55+
} else if (step instanceof SwitchStep) {
56+
return "Switch: " + ((SwitchStep) step).getExpression();
57+
} else if (step instanceof SetVariablesStep) {
58+
return "Set variables";
59+
} else if (step instanceof Checkpoint) {
60+
return "Checkpoint: " + ((Checkpoint) step).getName();
61+
} else if (step instanceof FormCall) {
62+
return "Form call: " + ((FormCall) step).getName();
63+
} else if (step instanceof GroupOfSteps) {
64+
return "Group of steps";
65+
} else if (step instanceof ParallelBlock) {
66+
return "Parallel block";
67+
} else if (step instanceof ExitStep) {
68+
return "Exit";
69+
} else if (step instanceof ReturnStep) {
70+
return "Return";
71+
} else if (step instanceof TaskCall) {
72+
return "Task: " + ((TaskCall) step).getName();
73+
}
74+
75+
return step.getClass().getName();
76+
}
77+
}

0 commit comments

Comments
 (0)