Configure Event Driven Workers for Artifactory

JFrog Platform Administration Documentation

Content Type
Administration / Platform
ft:sourceType
Paligo

This topic provides a step-by-step instruction to configure an event-driven worker for Artifactory. Event-driven workers are a powerful tool that allows you to automate actions in response to specific events occurring within your Artifactory environment.

Prerequisite

Before starting the configuration, ensure that you have selected the desired project for which you want to apply the worker.

To configure an event driven worker for Artifactory, follow these steps:

Step 1: Navigate to the Workers Configuration

Navigate to the Administration module and click Workers.

+ Add your first Worker: If you are creating a worker for the first time, click Select button in the Event Driven Worker tile.

AddNewEventWorker1.png

+ Add Additional Worker: For the second and more workers, click + New Worker, and then click New Event Driven Worker.

AddNewEventWorker2.png
  1. From the Create New Worker drop-down, click Artifactory to see available Artifactory Workers.

  2. Locate the desired Artifactory Worker, and then click Add.

AddNewEventWorker3.png

Step 2: Configure Worker Fields

In the Add New Worker window, enter the details in the relevant fields:

  1. Name: Enter a descriptive name for the worker.

  2. Script: Enter or modify the script in the TypeScript Editor. Use the auto-complete function for improved efficiency while coding.

AddNewEventWorker4.png

Worker Settings

Click the Settings icon from the top-right corner of the window, and then enter the details in the relevant fields:

AddNewEventWorker5.png
  1. Enable Worker: Enable the worker in the Worker Settings modal by clicking the toggle button.

    Note

    The worker can also be enabled later from the Add New Worker window or Configured window. Repositories must be selected to enable the worker. Once enabled, the worker triggers when a predefined event occurs.

  2. Description: Enter a brief description of the worker.

    AddNewEventWorker6.png
  3. Repositories: Click the + icon in the Repositories field.

    You can either:

    • Select Repositories: Move selected repositories from the Available Repositories list.

      AddNewEventWorker7.png
    • Set Patterns: Use wildcards (for example, *, **, ?) to define patterns for repository selection.

      Example Patterns:

      • com/t?st.zip - Matches com/test.zip, com/tast.zip, etc.

      • com/*.zip - Matches all .zip files in the com directory.

      • com/**/test.zip - Matches all test.zip files in subdirectories of com.

      You can add multiple patterns to the filter. After you enter a pattern, click + to add that pattern to the filter.

      Note

      For more information, see AntPathMatcher Documentation.

      AddNewEventWorker8.png
  4. Select Secrets: Secrets are stored securely and not in plain text. The secret's clear-text value is never returned in an API or UI and will be masked from all the logs.

    To add a secret:

    1. Enter the Name and Value of the secret.

    2. Click + Add secret to add more secrets.

    3. Click Delete icon to remove any secret.

    Note

    Use secrets in your code with the syntax: context.secrets.get('secretName').

    AddNewEventWorker9.png
  5. Enable Debugging: Click the checkbox for Show Status of Successful Executions in the Troubleshooting tab to view successful execution results. By default, only unsuccessful executions are shown.

  6. Click OK when done.

Step 3: Testing Pane

Edit the JSON payload used to simulate the worker's events.

Click Run to test the worker.

AddNewEventWorker10.png

Review results in:

  • Execution Results tab: for responses

  • Execution Logs tab: for logs

  • Metrics tab: for run time, memory, and CPU utilization details.

Step 4: Save Your Configuration

  • Click Save to finalize the worker configuration.

  • To cancel the configuration, click Close, and then click Discard to discard changes.

Related Information