Schedule Your First Automation¶
Overview¶
In this guide, you will:
- Create a simple automation that prints
"Hello World"
every day. - Use Ballerina Integrator to develop the automation.
- Push the automation to Devant from the Ballerina Integrator which automatically builds the automation.
- Schedule the automation to run every day.
Prerequisites¶
- GitHub account: Create a GitHub account if you don't have one already.
- If signing in to Devant for the first time, create an organization:
- Go to https://console.devant.dev/ and sign in using your preferred sign-in option.
- Enter a unique organization name. For example,
Stark Industries
. - Read and accept the privacy policy and terms of use and click Create.
- Select your region and click Confirm.
- VS Code: Install VS Code if you don't have it installed already.
Step 1: Attach a Git repository¶
- Go to https://console.devant.dev/new and sign in. This opens the new integration page.
-
On the new integration page, click Attach a Git Repository.
Tip
If you're using a public Git repository, you can skip ahead to sub-step 8. Click Use a Third-Party Public Git Repository and enter the repository URL.
-
Click Authorize with GitHub to connect Devant to your GitHub account. If you haven't connected your GitHub repository to Devant, authorize the WSO2 cloud app with your GitHub account WSO2 Cloud App.
- Under the Organization dropdown, click + Add. This redirects you to the Install WSO2 Cloud App page.
-
Select your GitHub account and install WSO2 Cloud App
Note
The WSO2 Cloud App requires:
- Read and write access to code and pull requests.
- Read access to issues and metadata.
You can revoke access at any time. Write access is used to push changes directly to your repository.
-
Select your organization under the Organization dropdown. If your organization is not listed, click the Refetch button.
- Select a repository to save your integration.
- Select a Branch and a Path of the selected repository to save your integration.
- The Name and Identifier fields are automatically populated. Optionally, you can edit them to your preference.
- Select the Technology as
Ballerina Integrator
. - Choose the Integration Type as
Automation
and click Create.
This redirects you to the overview page of the automation. Now, let's design the automation.
Step 2: Install the Ballerina Integrator extension¶
- Click Install Ballerina Integrator extension on the overview page. This opens the VS Code extensions page.
- Click Install to install the extension. This installs both Ballerina Integrator and Ballerina extensions on VS Code.
Step 3: Set up Ballerina Integrator for the first time¶
-
Click the Ballerina Integrator icon on the sidebar.
-
Click
Set Up Ballerina Integrator
. The setup wizard installs and configures the Ballerina distribution required for the Ballerina Integrator. -
Click
Restart VS Code
to complete the setup.
Step 4: Develop automation in VS Code¶
- Go to the Overview page of the integration you have created and click Develop in Ballerina Integrator. This will clone your project and open in Ballerina Integrator.
- In Ballerina Integrator design view, click Add Artifact.
- Select Automation from the Constructs menu. Since Automation is chosen from the Devant console, other options are disabled.
- Click Create to create an automation. This directs you to the automation diagram view.
- Click + after the Start node to open the node panel.
- Select Call Function and select println.
- Click + Add Another Value, type
"Hello World"
and click Save. -
Click Run in the top right corner to run the automation. This compiles the automation and runs it in the embedded Ballerina runtime.
Step 5: Push to Devant¶
- Click the Source Control icon on the sidebar.
- Click + to stage all changes.
- Add an appropriate commit message and commit.
- Click Sync Changes to push the changes to remote.
Step 6: Schedule Automation¶
-
Once you push the changes, the overview page of the Devant automation will automatically refresh and show you the Latest Commit and automatically build your automation showing the Build Status.
Note
The build process may take some time. Once complete, the build status changes to Success. You can see the Build History by clicking Build in the left navigation.
-
Once the Build Status shows
Build completed
, click Test to run your automation once. - The development card automatically updates with execution details. Click the refresh button in the top right corner if it is not automatically updated.
- Click View Logs on an execution. You will see the
Hello World
log printed along with the execution time. - Click Schedule to schedule the automation.
- In the BY INTERVAL tab, select Day from the dropdown.
- Enter
1
in the Repeat every text box. - Enter
01:00 AM
in the At text box and click Update. -
Your automation will now run every day at 01:00 AM. You can see the next execution time as Next run in in the Development card.