Run a job from a third-party scheduler

There are several ways to initiate job execution: via ClearSQL and via a third-party scheduler like Jenkins, JetBrains TeamCity, etc.

ClearSQL creates a standalone batch file to initiate job execution via a command line script from a third-party scheduler. The file is generated in CMD format. This helps integrate script analysis into a development lifecycle, initiate it without user interference, and run analysis on regular basis.

ClearSQL supports source2project and project2source synchronization, which allows for analysis of dynamically changing content. To make sure only the latest scripts are analyzed during job execution, ClearSQL can refresh contents of an imported folder before running the job. For details, see the procedure below.
To initiate job execution via a third-party scheduler
1
In the Job and Schedule Manager, click New Job, select Based on an embedded ClearSQL Project, and then click Create.
2
Enter a new project name and click OK.
3
In the New Project Assistant, From Files tab, select a folder that stores scripts that should be analyzed. For example, it can be a version control system repository.
4
Click Add & Link. The selected folder will be imported to the new project tree on the right. This folder is linked to its source on the disk.
5
Click Create. The new project will be created. After that, click Create Job in the New Job window.
6
On the Job tab, right-click the imported folder, and then click Selection Sync Settings.
7
In the Synchronization Settings window, select Define individual settings to make the options below active.
8
Select the Import New Child Files Linked Files on Refresh from Linked Source and Recursively check boxes, and then click Apply.
9
On the Job tab, make sure the following options are enabled: Refresh selection before analysis, Analyze selected scripts.
Make sure the following options are disabled: Write back changes after analysis, Autosave.
10
Select Create ClearSQL Report and/or Export analysis data to get a project analysis report and/or to export analysis results to a shared source after the job is completed.
11
Once all setting are defined, click Save All.
12
Click Create Batch File to create a CMD file that allows initiating job execution via a command line script from a third-party scheduler, like Jenkins, etc.
13
Integrate the CMD file into a third-party scheduler and run the job.
To create a job on an embedded ClearSQL Project
1
Follow three first steps described earlier in this topic.
2
Select Based on an embedded ClearSQL Project.
3
Click Create, enter a new project name, or select it from the recent drop-down list, and then click OK.
4
In the New Project Assistant, select items (files, folders, DB objects) in the left pane, click Add or Add & Link to import them to the new project, and then click Create. A new ClearSQL project is created.
5
In the New Job window, click Create Job. The newly created job will be added to the job list in the left pane.
6
In the New Project Assistant, select items (files, folders, DB objects) in the left pane, click Add or Add & Link to import them to the new project, and then click Create. A new ClearSQL project is created.
7
Follow the rest of the steps described earlier in this topic.
This document was last updated on February 22, 2020
Helpful?