# Task Runner Agent - Command Reference

TaskRunner configuration may be provided with system properties or as a configuration file in JSON format.&#x20;

* When a ‘*propertyA’* is provided as a command line parameter, it should have **a prefix ‘*****sl.*****’**.
* When same ‘*propertyA*’ is provided in a configuration file, it should be **without the prefix**.

TaskRunner configuration contains channel-specific properties and common properties. Channel-specific properties have a channel prefix (*github, bitbucketServer*) following the ‘*sl.*’ prefix and before the property name.

## GitHub Entreprise Server Integration <a href="#github-entreprise-server-integration" id="github-entreprise-server-integration"></a>

### Starting the Task Runner Agent via Configuration File <a href="#starting-the-task-runner-agent-via-configuration-file" id="starting-the-task-runner-agent-via-configuration-file"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
java -Dsl.config.file=<arg> -jar ./sl_task_runner.jar
```

{% endcode %}

### Starting the Task Runner Agent using CLI parameters  <a href="#starting-the-task-runner-agent-using-cli-parameters" id="starting-the-task-runner-agent-using-cli-parameters"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
java {-Dsl.token=<arg> | -tokenfile=<arg>} -Dsl.github.url=<arg> -Dsl.github.appId=<appID> -Dsl.github.privateKeyFile=</path/to/private-key-file> {-Dsl.github.checkRunName=<arg>} {-Dsl.proxy=<arg>} -jar ./sl_task_runner.jar
```

{% endcode %}

### Configuration parameters  <a href="#configuration-parameters" id="configuration-parameters"></a>

<table data-header-hidden><thead><tr><th width="179.70703125">Property</th><th width="150.29296875">Default</th><th width="126.55859375">Required</th><th>Description</th></tr></thead><tbody><tr><td>sl.config.file</td><td>-</td><td>mandatory*</td><td>Path to JSON file containing the Task Runner configuration</td></tr><tr><td>sl.token</td><td>-</td><td>mandatory **</td><td>Access token generated from the SeaLights server (Agent token)</td></tr><tr><td>sl.tokenFile</td><td>-</td><td>mandatory **</td><td>Path to file containing the access token generated from the SeaLights server</td></tr><tr><td>sl.buildSessionId</td><td>-</td><td>optional</td><td>The PR build-session-id to poll for. In this mode only this build will be updated in the SCM</td></tr><tr><td>sl.buildSessionIdFile</td><td>-</td><td>optional</td><td>Path to file containing the build-session-id to poll for. In this mode only this build will be updated in the SCM</td></tr><tr><td>sl.bsidPollingTimeoutMins</td><td>6</td><td>optional</td><td>Specifies the maximum amount of time to wait for the result for the specified build when working in the one time build session ID mode</td></tr><tr><td>sl.github.enabled</td><td>false</td><td>optional</td><td>Flag allows support of github channel.<br>Property is set automatically true, if any other property is defined.</td></tr><tr><td>sl.github.url</td><td><a href="http://bitbucket.internal/">-</a></td><td>mandatory</td><td>Repository url</td></tr><tr><td>sl.github.appId</td><td>-           </td><td>mandatory</td><td>Github Application ID assigned to Sealighs' app</td></tr><tr><td>sl.github.privateKeyFile</td><td>-           </td><td>mandatory</td><td>Github private key file</td></tr><tr><td>sl.github.checkRunName</td><td>Sealights     </td><td>optional</td><td>Check-run name (string)</td></tr><tr><td>sl.taskPollingIntervalSecs</td><td>60/10</td><td>optional</td><td>Interval in second for getting SL tasks for execution<br>Default 60 when using when used as a service.<br>Default 10 when used for one time build session ID mode</td></tr><tr><td>sl.taskTimeoutSecs</td><td>60</td><td>optional</td><td>Time in second allocated for task execution.<br>If it expires, task will be aborted and reported with timeout status.</td></tr><tr><td>sl.logs.sendIntervalMin</td><td>5</td><td>optional</td><td>Interval in minutes for sending accumulated logs to the cloud.<br>If not defined, parameter is forced to the default value on start (5 minutes).</td></tr><tr><td>sl.proxy</td><td>-</td><td>optional</td><td>The proxy configuration for connection to Sealights.</td></tr></tbody></table>

## Bitbucket Enterprise Server Integration <a href="#bitbucket-entreprise-server-integration" id="bitbucket-entreprise-server-integration"></a>

### Starting the Task Runner Agent via Configuration File <a href="#starting-the-task-runner-agent-via-configuration-file.1" id="starting-the-task-runner-agent-via-configuration-file.1"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
java -Dsl.config.file= <arg> -jar sl_task_runner.jar
```

{% endcode %}

### Starting the Task Runner Agent using CLI parameters  <a href="#starting-the-task-runner-agent-using-cli-parameters.1" id="starting-the-task-runner-agent-using-cli-parameters.1"></a>

{% code overflow="wrap" lineNumbers="true" %}

```
java {-Dsl.token=<arg> | -tokenfile=<arg>} -Dsl.bitbucketServer.url=<url> -Dsl.bitbucketServer.token=<personal access token> {-Dsl.proxy=<arg>} -jar ./sl_task_runner.jar
```

{% endcode %}

### Configuration parameters  <a href="#configuration-parameters.1" id="configuration-parameters.1"></a>

<table><thead><tr><th width="178.1875">Property</th><th width="97.96875">Default</th><th width="130.671875">Required</th><th>Description</th></tr></thead><tbody><tr><td>sl.config.file</td><td>-</td><td>mandatory *</td><td>Path to JSON file containing the Task Runner configuration</td></tr><tr><td>sl.token</td><td> </td><td>mandatory **</td><td>Access token generated from the SeaLights server (Agent token)</td></tr><tr><td>sl.tokenFile</td><td> </td><td>mandatory **</td><td>Path to file containing the access token generated from the SeaLights server (Agent token)</td></tr><tr><td>sl.buildSessionId</td><td>-</td><td>optional</td><td>The PR build-session-id to poll for. In this mode only this build will be updated in the SCM</td></tr><tr><td>sl.buildSessionIdFile</td><td>-</td><td>optional</td><td>Path to file containing the build-session-id to poll for. In this mode only this build will be updated in the SCM</td></tr><tr><td>sl.bsidPollingTimeoutMins</td><td>6</td><td>optional</td><td>Specifies the maximum amount of time to wait for the result for the specified build when working in the one time build session ID mode</td></tr><tr><td>sl.bitbucketServer.enabled</td><td>false</td><td>optional</td><td>Flag allows support of bitbucket server channel; is set automatically true, if any other property is defined</td></tr><tr><td>sl.bitbucketServer.url</td><td> </td><td>mandatory</td><td>URL of the Bitbucket Server</td></tr><tr><td>sl.bitbucketServer.token</td><td> </td><td>mandatory</td><td>Personnal Access Token generated from your Bitbucket Server Instance</td></tr><tr><td>sl.taskPollingIntervalSecs</td><td>60/10</td><td>optional</td><td>Interval in second for getting SL tasks for execution<br>Default 60 when using when used as a service.<br>Default 10 when used for one time build session ID mode</td></tr><tr><td>sl.taskTimeoutSecs</td><td>60</td><td>optional</td><td>Time in second allocated for task execution; if expires, task will be aborted and reported with timeout status</td></tr><tr><td>sl.logs.sendIntervalMin</td><td>5</td><td>optional</td><td>Interval in minutes for sending accumulated logs to the cloud. If not defined, is forced to the default value on start</td></tr><tr><td>sl.proxy</td><td>-</td><td>optional</td><td>The proxy configuration for connection to Sealights.</td></tr></tbody></table>

## Logging <a href="#logging" id="logging"></a>

In order to enable logs you can set the following parameters as environment variables or as -Dsl.\* parameters

<table data-header-hidden><thead><tr><th width="167.7734375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>sl.log.level</td><td>Sets the log level to one of the following: "off", "error", "warn", "info", "debug"</td></tr><tr><td>sl.log.toConsole</td><td>Set to true to enable log output to the console</td></tr><tr><td>sl.log.toFile</td><td>Set to true to enable log output to a file</td></tr><tr><td>sl.log.folder</td><td>Provide a folder to save the log files in</td></tr><tr><td>sl.log.filename</td><td>Provide the name of the log file</td></tr><tr><td>sl.log.count</td><td>Limit the number of log files to create. Default: 10</td></tr><tr><td>sl.log.limit</td><td>Limit the size of the log file. Default: 10*1024 KB</td></tr></tbody></table>
