Home > docs > processes v1 > Processes v1
Regardless of how the process was started – using a project and a Git repository or by sending a payload archive, Concord assumes a certain structure of the process’s working directory:
concord.yml
: a Concord DSL file containing the main flow,
configuration, profiles and other declarations;concord/*.yml
: directory containing extra Concord YAML files;forms
: directory with custom forms.Anything else is copied as-is and available for the process. Plugins can require other files to be present in the working directory.
The same structure should be used when storing your project in a Git repository. Concord simply clones the repository into the process’ working directory.
The default use case with the Concord DSL is to maintain everything in the one
concord.yml
file. The usage of a concord
folder and files within it allows
you to reduce the individual file sizes.
./concord/test.yml
:
configuration:
arguments:
nested:
name: "stranger"
flows:
default:
- log: "Hello, ${nested.name}!"
./concord.yml
:
configuration:
arguments:
nested:
name: "Concord"
The above example prints out Hello, Concord!
, when running the default flow.
Concord folder merge rules:
Concord DSL files contain configuration, flows, profiles and other declarations.
The top-level syntax of a Concord DSL file is:
configuration:
...
flows:
...
publicFlows:
...
forms:
...
triggers:
...
profiles:
...
resources:
...
imports:
...
Let’s take a look at each section:
Flows listed in the publicFlows
section are the only flows allowed as
entry point values. This also limits the
flows listed in the repository run dialog. When the publicFlows
is omitted,
all flows are considered public.
Flows from an imported repository are subject to the same
setting. publicFlows
defined in the imported repository are merged
with those defined in the main repository.
publicFlows:
- default
- enterHere
flows:
default:
- log: "Hello!"
- call: internalFlow
enterHere:
- "Using alternative entry point."
# not listed in the UI repository start popup
internalFlow:
- log: "Only callable from another flow."
Process arguments, saved process state and automatically provided variables are exposed as flow variables:
flows:
default:
- log: "Hello, ${initiator.displayName}"
In the example above the expression ${initator.displayName}
references an
automatically provided variable inititator
and retrieves it’s displayName
field value.
Flow variables can be defined using the DSL’s set step, the arguments section in the process configuration, passed in the API request when the process is created, etc.
Concord automatically provides several built-in variables upon process execution in addition to the defined variables:
execution
or context
: a reference to the current execution’s context,
instance of com.walmartlabs.concord.sdk.Context;txId
- an unique identifier of the current process;parentInstanceId
- an identifier of the parent process;tasks
- allows access to available tasks (for example:
${tasks.get('oneops')}
);workDir
- path to the working directory of a current process;initiator
- information about the user who started a process:
initiator.username
- login, string;initiator.displayName
- printable name, string;initiator.email
- email address, string;initiator.groups
- list of user’s groups;initiator.attributes
- other LDAP attributes; for example
initiator.attributes.mail
contains the email address.currentUser
- information about the current user. Has the same structure
as initiator
;requestInfo
- additional request data (see the note below):
requestInfo.query
- query parameters of a request made using user-facing
endpoints (e.g. the portal API);requestInfo.ip
- client IP address, where from request is generated.requestInfo.headers
- headers of request made using user-facing endpoints.projectInfo
- project’s data:
projectInfo.orgId
- the ID of the project’s organization;projectInfo.orgName
- the name of the project’s organization;projectInfo.projectId
- the project’s ID;projectInfo.projectName
- the project’s name;projectInfo.repoId
- the project’s repository ID;projectInfo.repoName
- the repository’s name;projectInfo.repoUrl
- the repository’s URL;projectInfo.repoBranch
- the repository’s branch;projectInfo.repoPath
- the repository’s path (if configured);projectInfo.repoCommitId
- the repository’s last commit ID;projectInfo.repoCommitAuthor
- the repository’s last commit author;projectInfo.repoCommitMessage
- the repository’s last commit message.processInfo
- the current process’ data:
processInfo.activeProfiles
- list of active profiles used for the current
execution;processInfo.sessionToken
- the current process’
session token can be
used to call Concord API from flows.LDAP attributes must be white-listed in the configuration.
Note: only the processes started using the browser link
provide the requestInfo
variable. In other cases (e.g. processes
triggered by GitHub) the variable might be undefined
or empty.
Availability of other variables and “beans” depends on the installed Concord plugins and the arguments passed in at the process invocation and stored in the request data.
The context
variable provides access to the current process’ state:
variables, current flow name, etc. The context
variable is available at
any moment during the flow execution and can be accessed using expressions,
scripts or in
tasks:
flows:
default:
- log: "All variables: ${context.toMap()}"
- script: javascript
body: |
var allVars = execution.toMap();
print('Getting all variables in a JavaScript snippet: ' + allVars);
Note: in the script
environment the context
variable called execution
to avoid clashes with the JSR 223 scripting context.
Concord has the ability to return process data when a process completes.
The names or returned variables should be declared when a process starts
using multipart/form-data
parameters:
$ curl ... -F out=myVar1 http://concord.example.com/api/v1/process
{
"instanceId" : "5883b65c-7dc2-4d07-8b47-04ee059cc00b"
}
# wait for completion
$ curl .. http://concord.example.com/api/v1/process/5883b65c-7dc2-4d07-8b47-04ee059cc00b
{
"instanceId" : "5883b65c-7dc2-4d07-8b47-04ee059cc00b",
"meta": {
out" : {
"myVar1" : "my value"
},
}
}
or declared in the configuration
section:
configuration:
out:
- myVar1
It is also possible to retrieve a nested value:
$ curl ... -F out=a.b.c http://concord.example.com/api/v1/process
In this example, Concord looks for variable a
, its field b
and
the nested field c
.
Additionally, the output variables can be retrieved as a JSON file:
$ curl ... http://concord.example.com/api/v1/process/5883b65c-7dc2-4d07-8b47-04ee059cc00b/attachment/out.json
{"myVar1":"my value"}
Any value type that can be represented as JSON is supported.