Create a Before Create Token Worker

JFrog Platform Administration Documentation

Content Type
Administration / Platform
ft:sourceType
Paligo

Before Create Token events are executed just before a token is created.

  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 Access section lists workers with a predefined Access system action.

    access-select-worker.png
  4. Click Add on the required type of worker.

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

    before-create-token-01.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.

  8. 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.

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

    enable-debug-worker-01.png
  10. You can edit the JSON payload in the BeforeCreateTokenRequest pane.

    before-create-token-code-01.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.

  11. Click Run Test to test the worker.

    The results appear in the Execution Results pane.

    Execution_Results
  12. 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.

  13. Click Save to save the worker.