The operations for creating and managing a worker are provided below. These operations are performed by a Platform Administrator.
Tasks to Set Up Worker
# | Task | Using APIs |
---|---|---|
1 | Create a worker (Includes adding secrets and filtering repositories) | POST /worker/api/v1/workers |
2 | Delete a worker | DELETE /worker/api/v1/workers/{workerKey} |
3 | Get all workers | GET /worker/api/v1/workers |
3 | Get a specified worker | GET /worker/api/v1/workers/{workerKey} |
4 | Update a worker | PUT /worker/api/v1/workers |
5 | Get available actions for a worker | GET /worker/api/v1/system/actions |
6 | Test worker | POST /worker/api/v1/test/[/{workerKey}] |
7 | Service readiness of worker | GET /worker/api/v1/system/readiness |
8 | Service liveness of worker | GET /worker/api/v1/system/liveness |
9 | Filter repositories for worker | PUT /worker/api/v1/workers |
9 | Add secrets to worker | PUT /worker/api/v1/workers |
10 | Get worker's run history | GET /worker/api/v1/execution_history |
API Task Usage Overview
The API usage and request/response bodies for creating and managing a worker are provided below.
Task | API Usage and Request/Response |
---|---|
Create a worker (Includes adding secrets and filtering repositories) | POST /worker/api/v1/workers Request { "key": string, "description": string, "enabled": boolean, "sourceCode": string, "action": string, "filterCriteria": { "artifactFilterCriteria": { "includePatterns": undefined | string[], "excludePatterns": undefined | string[], "repoKeys": string[] } }, "secrets": undefined | Secret[] } You differentiate between the type of worker created using the action parameter. Choose the worker action with which the worker is associated. |
Delete a worker | DELETE /worker/api/v1/workers/{workerKey} |
Get all workers | GET /worker/api/v1/workers Response { "workers": [ { "key": string, "description": string, "enabled": boolean, "sourceCode": string, "action": string, "filterCriteria": { "artifactFilterCriteria": { "repoKeys": [ "repo1", "Repo2" ], "includePatterns": undefined | string[], "excludePatterns": undefined | string[] } }, "secrets": Secret[] } |
Get a specified worker | GET /worker/api/v1/workers/{workerKey} Response { "key": string, "description": string, "enabled": boolean, "sourceCode": string, "action": string, "filterCriteria": { "artifactFilterCriteria": { "repoKeys": [ "repo1", "Repo2" ], } }, "secrets": undefined | Secret[] { "executionStatus": "STATUS_SUCCESS" } |
Update a worker / Add secrets to worker / Filter repositories for worker | PUT /worker/api/v1/workers Request { "key": string, "description": string, "enabled": boolean, "sourceCode": string, "action": string, "filterCriteria": { "artifactFilterCriteria": { "includePatterns": undefined | string[], "excludePatterns": undefined | string[], "repoKeys": string[] } }, "secrets": undefined | Secret[] } |
Get available actions for a worker | GET /worker/api/v1/system/actions Response [ "BEFORE_DOWNLOAD", "AFTER_DOWNLOAD", "BEFORE_UPLOAD", "AFTER_CREATE", ] |
Test worker | POST /worker/api/v1/test/[/{workerKey}] Request { "code": string, "action": string, "data": object, // action specific payload "stagedSecrets": undefined | Secret[] } |
Service readiness of worker | GET /worker/api/v1/system/readiness |
Get Execution History | GET /worker/api/v1/execution_history Request { "workerKey": string, "showTestRun": boolean } |