Rerun Worker

JFrog REST APIs

Content Type
REST API

Description: Trigger a rerun of a specific run from your Worker run history, identified with the pair workerKey and historyEntryId (this is the endpoint that is also used by the UI).

Since: 7.115.2

Security: Requires one of the following:

  • Admin user

  • Project admin user when the Worker is shared or scoped to the project. Also, the project to which the user belongs and the Worker project key must match

  • Authenticated Non-Admin user when the Worker is shared

Usage:POST /worker/api/v1/rerun/<WORKER_KEY>[?forceRecord=false]

Produces: application/json

Header parameter: Authorization: Bearer

Sample Usage

curl -XPOST --location
 'https://<JFrogPlatform>/worker/api/v1/rerun/my-worker?forceRecord=true \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <MY-TOKEN>' \
--data '{
	historyEntryId: "587c08d2-e886-454a-8664-fcf33e380ba2"
}

Usage Parameters

Name

Datatype

Mandatory

Description

forceRecord

Boolean

Optional

Default: false. If set to true, both failed and successful runs will be recorded in the run history.

historyEntryId

String

Mandatory

The ID for the run that you wish to rerun. To find the ID for a worker run through the JFrog Platfom UI, go to the Run History page for the worker, click the run, and copy the ID from the Payload field. Alternatively, to get the run ID via REST API use the Get Worker Execution History endpoint.

Sample Response

{
    "executionId": "A038f4199-11e3-4757-9189-6801d5c85fd3",
    "logs": "[info ] - Artifactory ping success\n",
    "executionMetrics": {
        "cpuTimeMillis": 20,
        "topMemoryUsageBytes": 19169280,
        "executionDurationMillis": 5538
    },
    "executionLimits": {
        "maxCpuTimeMillis": 1000,
        "maxMemoryUsageBytes": 125829120,
        "maxExecutionDurationMillis": 6000
    },
    "result": {
        "data": {
            "message": "proceed",
            "executionStatus": 4
        },
        "executionStatus": "STATUS_SUCCESS"
    }
}

Response Parameters

Parameter

Datatype

Description

workerKey

string

The name of the worker (unique ID).

workerType

Action

The action on which the worker is hooked. It is an enum string of Action Enum (see below for available values).

executionStatus

string

Can be either STATUS_SUCCES or STATUS_FAIL.

executionPayload

object |  null

Forevent driven workers this will be an object containing data about the event that triggered the worker. For manual (http request) workers, it will contain the data passed in the body of the HTTP request. Can be null if the body is not defined.

executionResult.result

object

Contains what the worker returned. In case of an uncaught exception, the result will contain a single property message whose value is the error message.

executionResult.logs

string

Containing the worker’s script logs output.

executionResult.workerStats.cpuTimeMillis

number

The total calculation time performed by the worker’s script.

executionResult.workersStats.topMemoryUsageBytes

number

The top memory usage for this worker.

executionResult.workerStats.executionDurationMillis

number

The total execution time.

startTimeMillis

number

The time by which the execution started in milliseconds.

endTimeMillis

number

The time by which the execution ended in milliseconds.

triggeredBy

number

Specifies who or what triggered the worker.

For a test run using the Run button in the online Workers editor, the value is testRun (with the username).

For event-driven workers, the service name that triggered the worker is provided.

For Generic Event Workers, the value is the username.

Success Response Codes:

200: Ok successful.

Error Response Codes:

400 The request payload is malformed or call limit was exceeded.

401 Invalid credentials.

403 Insufficient permissions.

404 The Worker key or history entry ID do not exist.

Error Response

{
    "errors": [
        {
            "status": number // The HTTP error status code
            "message": string // The reason of the error
        }
    ]
}