Automates the creation and deletion of custom fields in Jira Service Management (JSM) using the Jira REST API.
- Create multiple custom fields with options and default values
- Delete custom fields and clean up state
- Track created fields in a state file
- Command-line interface for easy usage
-
Python 3.7+
-
requestslibrary -
Jira Cloud account with admin permissions
-
A
secrets.pyfile in the project root with the following variables:JIRA_DOMAIN = "your-domain.atlassian.net" JIRA_USERNAME = "your-email@example.com" JIRA_API_TOKEN = "your-api-token"
You can generate an API token from your Atlassian account.
-
Clone the repository.
-
Install dependencies:
pip install requests
-
Create a
secrets.pyfile as described above.
Run the main script with the desired action:
python main.py apply --iterations 5apply: Creates or updates the custom fields as defined inutils.py.destroy: Deletes the custom fields tracked in the state file and removes the state file.
--iterations, -n N: Number of custom fields to create (default: 1)--state-file, -f FILE: Path to state file (default: state.json)--verbose, -v: Enable detailed messages for field creation and deletion
-
Create configuration for 5 custom fields:
python main.py apply --iterations 5
-
Remove existing configuration:
python main.py destroy
Edit utils.py to define the custom fields you want to create. Each field can have a name, description, type, options, and default value.
To manage custom field options and default values, this script uses the Jira REST API. For more details, refer to the official documentation:
🔗 Jira REST API - Field Context Options
- Ensure your Jira credentials in
secrets.pyare correct. - The script requires admin permissions in Jira.
- If you encounter API errors, check your network and Jira API limits.
- The state file (
jsm_state.jsonby default) tracks created fields. If you manually delete fields in Jira, you may need to delete or reset this file.
- manual_clean_field.py: Un script utilitaire pour nettoyer les champs personnalisés dans Jira en fonction d'un filtre de recherche.
See LICENSE.