Tutorial 05: Create an Automation Pipeline
Introduction
This tutorial is is relevant for
Automation Experts who wants to learn how to create pipelines to streamline and automate the development, testing, deployment, and maintenance of applications within a low-code platform.
This tutorial is about
In this tutorial, you will learn how to create and execute such an automation pipeline script. To learn more about automation pipelines in detail, see this section of the documentation: Automation Pipeline and Commands.
You can have two main types of automation pipelines:
Ad-hoc automation pipeline: Doesn't need to be stored. The script is sent to the server, executed and then “forgotten”. Ad-hoc pipelines are good, for example, to execute an ad-hoc query, send ad-hoc messages, or to be called by client implementations.
Persisted automation pipeline: A pipeline script which is stored at server side in the property store under a unique key. The pipeline can be executed later by calling its unique key. This kind of pipeline is good to persist your execution logic, to create automation apps and to organize them into multiple pipelines.
Step 1: Execute an ad-hoc pipeline
Login to the portal https://NAMESPACE.pipeforce.net
Navigate to AUTOMATION → Playground
Here you can write any ad-hoc pipeline and execute it by pushing the RUN button.
You can write for example this hello world pipeline in the editor:
pipeline: - log: message: "Hello World!"
Execute it by pushing the RUN button.
You should then see the result in the output window below:
Now lets extend this automation pipeline a bit by sending a simple email using these steps:
Start typing inside the playground editor after the dash - and you should see command suggestions like this:
Lets select the command
mail.send
from the list. Finish the line with a colon:
, and then go to the next line and indent with two tabs[->|]
. To see the list of available parameters for the command, press[CTRL] + [SPACE]
, and you should again see the auto-completion list like this:Lets select the parameter
to
from the list, and set your email address and asubject
here as shown below:In your pipeline, you have now two commands:
The first one
log
simply logs a message, whilethe second one
mail.send
sends an email.
Note that each command
is listed below
pipeline:
,is indented with one tab from the left,
starts with a dash
-
followed by the command name.is finished with a colon
:
.can have optional parameters: You can specify them below the command after an additional indent using a tab.
can exchange data with other commands. If you want to learn more about this, have a look here: Automation Pipeline and Commands.
Now, let's execute this pipeline by pressing the RUN button.
After a while, you should receive the email in your inbox.
Since this is an ad-hoc pipeline, when you leave this playground view, your pipeline is gone. Therefore, you should persist (store) it if you later need it. We will see in the next section how to do this.
Step 2: Persist (save) a pipeline in the property store
Persisting a pipeline means “storing” a pipeline script at server side in the property store (Property Store (Document Database) ) under a unique key. From there you can then load and execute it later by using this unique key. Follow these steps to create such a persisted pipeline:
Select AUTOMATION → Properties.
In the property tree select the node of the app you’ve created in the last tutorial.
Click the plus icon at the top of the tree.
Click Pipeline.
Then name your pipeline and click Create.
You should now see an empty pipeline template.
Replace the content of this editor by pasting your clipboard content here (Ctrl + V).
Click SAVE.
Congrats: Now, you have your first persisted pipeline. This pipeline has the unique key
global/app/MY_APP/pipeline/mypipeline
.
Step 3: Execute a persisted pipeline
After you have persisted an automation pipeline in the property store, you can execute it by calling it using its unique property key.
There are many different possibilities in PIPEFORCE to do so. In this step, you will learn how to do it using the command pipeline.run
:
Go to AUTOMATION → Playground
Execute this pipeline:
pipeline: - pipeline.run: path: global/app/MY_APP/pipeline/mypipeline
In the parameter field
path
, copy the key of the pipeline you have created before, for example like this:global/app/MY_APP/pipeline/mypipeline
Execute the command by clicking RUN.
As a result, you should see the “Hello World” output and after a while you should have received the email in your inbox.
So have used an ad-hoc pipeline to execute a persisted (stored) pipeline using its path.
Congratulations!