Note
You use the same Create Worker API to create all workers. You differentiate between the type of worker in the payload. See more.
Artifactory Event Driven
Code samples and procedures for creating Artifactory event-driven workers are provided below.
Event | Sample Code | Create using Platform UI | Using API |
---|---|---|---|
Before downloading an artifact in Artifactory Note: Only customers with JFrog Advanced Security (JAS) can block an artifact download. Otherwise Artifactory proceeds with the download but the system will log an error. | POST ${baseUrl}/worker/api/v1/workers | ||
After downloading an artifact in Artifactory | Create a Before Download Worker POST ${baseUrl}/worker/api/v1/workers | ||
Before an upload request is run in Artifactory Note: Only customers with JFrog Advanced Security (JAS) can block an artifact upload. Otherwise Artifactory proceeds with the upload but the system logs an error. | POST ${baseUrl}/worker/api/v1/workers | ||
After creating an artifact in Artifactory | POST ${baseUrl}/worker/api/v1/workers | ||
Before deleting an Artifactory property | POST ${baseUrl}/worker/api/v1/workers | ||
Before deleting an artifact | POST ${baseUrl}/worker/api/v1/workers | ||
After moving an artifact from one repository to another in Artifactory | POST ${baseUrl}/worker/api/v1/workers | ||
After build info has been saved in Artifactory storage | POST ${baseUrl}/worker/api/v1/workers |
Access Event Driven
Code samples and procedures for creating Access event-driven workers are provided below.
Event | Sample Code | Create using Platform UI | Using API |
---|---|---|---|
Before creating a token | POST ${baseUrl}/worker/api/v1/workers | ||
Before revoking a token | POST ${baseUrl}/worker/api/v1/workers |
HTTP Triggered
Code samples and procedures for creating HTTP triggered workers are provided below.
Event | Sample Code | Create using Platform UI | Using API |
---|---|---|---|
Create a custom code worker independent of any events in the JFrog Platform | POST ${baseUrl}/worker/api/v1/workers | ||
Runs custom code independent of any events in the JFrog Platform, can create a generic event | Execute Worker for Generic Event- POST ${baseUrl}/worker/api/v1/execute/{workerKey} |
Using the Create Worker API
You use the same API to create all the workers. You differentiate between the type of worker created using the action parameter in the request payload. Using the action parameter in the API request payload, you specify the event with which the worker is associated.
Sample Request Payload
{ "key": string, "description": string, "enabled": boolean, "sourceCode": string, "action": string, "filterCriteria": { "artifactFilterCriteria": { "includePatterns": undefined | string[], "excludePatterns": undefined | string[], "repoKeys": string[] } }, "secrets": undefined | Secret[], "shared": boolean, "debug": boolean, "projectKey": undefined | string }