How to validate when creating Bitbucket repository in Jira using Run CLI Actions in Jira
This article explains how to add a validation on the creation of a Bitbucket repository from Jira using the Run CLI Actions in Jira app.
Instructions
- Log into the Jira instance as an administrator.
- Edit the workflow where Run CLI is to be added as a validator.
- Select the transition to which the CLI validator is to be added, and then click Validators.
- Click Add validator and select CLI action from the list of validation options.
Add the CLI action in the Action field and enter the CLI find pattern 1 value as the CLI action output. Replace the details as per your requirement in your instance.
CLI action:-a getRepositoryList --server "http://example.com/" --user "admin" --password "admin" --project "%original_customfield_12700%" --regex "%original_customfield_12701%"
- Add the post function to create the Bitbucket repository.
Once the transition is performed, if the repository is not present in the Bitbucket instance as per the added validation, you can see the newly created Bitbucket repository.
If the validation fails, it throws an error as shown in the following sample:
- It is recommended to test this scenario in a test environment before deploying it in production, or run the action with --simulate parameter to verify the behaviour before deploying.
- To create a Bitbucket repository during a workflow transition, refer to the How to create Bitbucket repository during a workflow transition using Run CLI Actions in Jira article.