Creating Jobs

Automated tasks in Zirkul are handled by Jobs

Let's say you want to run a security scan automatically every time an application is deployed by your CICD process.

Jobs are used in Zirkul for setting up "recipes" or "playbooks" with the step-by-step instructions to be followed by the Agent.

There's a straightforward syntax used for building your Jobs, here's an example:


# Let's load a target by ID
target 150

# Create a new dynamic scan (DAST)
new scan dynamic scan
    targetid: target.id
    subject: 'Dynamic Scan for {{target.name}}'
    status: 'not started'
    url: target.url
    tool name: 'Zirkul Agent'
    submit
    -

# New scan data is stored in the object: scan
# Let's move the scan to 'In progress'
scan scan.id
    status: 'in progress'
    description: 'Scanning Target {{target.id}}'
    update
    -

# Now we can run the scan with Zirkul scanner
scanner
    url scan.url
    start spider
    -

# Update the scan when the scan is completed
scan scan.id
    status: 'completed'
    response message: 'Scan completed successfully'
    update
    -

# Now let's publish all the issues found so you can track them in Zirkul
publish issues

You will find more information on how to write Job scripts in the section: Agent CLI

Let's add your first script:

1 - In te section "Continuous Testing \ Jobs", click on "Add Job"

2 - Fill out the form as follows for creating the classic "Hello world" Job:

3 - For executing Jobs, you need the Agent running in service mode connected to Zirkul, download the Agent and run it with the following command:

zirkul --service true --agent cicd --server http://app.zirkul.com --apikey 'YOUR-API-KEY-HERE'

If everything is working as expected, you should see something like this:

4 - Let's run the Job from Zirkul clicking the "play" icon:

You can see the progress clicking the option "View executed jobs"

You should also see the Agent running the Job in the command line:

Once completed, the executed Job should look like this:

Of course, this was just a testing exercise, and you don't want to manually execute a Job every time it's needed, in the next section we're going to see the options available for automating the process for running Jobs.

Last updated