Create a Before Create Property Worker

JFrog Platform Administration Documentation

Content Type
Administration / Platform
ft:sourceType
Paligo

Before Create Property events are run just before Artifactory creates a property for an artifact.

  1. In Projects, select the relevant project or All.

  2. From the Administration module, click Workers.

    The Workers screen appears.

  3. Click + New Workers and select New Event Driven Worker.

    The Create Workers section appears that lists all the types of workers that you can create. The Artifactory section lists workers with a predefined Artifactory system action.

    workers-03.png
  4. Click Add on the required type of worker.

  5. Configure the worker in the Before Create Property screen.

    before-create-property-add.png
  6. Enter the name and description of the worker.

  7. Create your worker code in the code editor area.

    As you type in the code, the editor provides you an auto-complete function that boosts your productivity.

    samplecodewriting.gif
  8. Click the + symbol in the Repositories field to select the repositories that the worker monitors for events.

    You can use filters to select the repositories and filter the artifacts and paths that the worker impacts.

    For more information, see Worker Repository Filter.

    Note

    You can create a worker without specifying the repositories. But you cannot enable the worker without specifying the repositories.

  9. Click Add Secret.

    The Secrets screen appears, where you can add secrets to the worker.

    AddSecret.png

    Enter the name and a value for a secret.

    Click Add Secret if you want to add more secrets.

  10. To enable troubleshooting even when the worker is successful, toggle Enable Debug.

    enable-debug-worker-01.png
  11. You can edit the JSON payload in the BeforePropertyCreateRequest pane.

    before-create-property-code.png

    You can use this payload to be injected as the second parameter in your worker function. You can use this to simulate the payload the worker receives in the event.

  12. Click Run Test to test the worker.

    The results appear in the Execution Results pane.

    Execution_Results
  13. You can enable the worker with the Enabled switch.

    You can also save the worker and enable it only when required. You can enable the worker by editing the workers from the Configured tab in the Workers screen.

  14. Click Save to save the worker.