JIRA 4.0 : Jelly Tags
This page last changed on Oct 05, 2009 by rosie@atlassian.com.
Jelly is a scripting and templating language from Apache's Jakarta project. It is similar to Ant, in that scripts are XML, and each tag maps to a Java class, but has a more sophisticated internal pipeline model for tag interaction, much like JSP taglibs. See the Jelly website for more details. JIRA comes with a number of Jelly tags implementing core operations in JIRA. This provides a scriptable interface to JIRA. There are many possible uses for JIRA Jelly tags, the most common being importing data into JIRA from other systems, and automating common administrative tasks (see the examples below). On this page:
Enabling JellyJIRA's Jelly support is disabled by default, as it is a potential security hazard. To enable Jelly support, set the jira.jelly.on system property when starting your application server. System properties are set with parameters to the java command, e.g. java -Djira.jelly.on=true .... How to set this property depends on your application server. For example, with Tomcat (JIRA standalone distribution), set the environment variable JAVA_OPTS=-Djira.jelly.on=true, or when running JIRA Standalone as a service, set the service JVM parameter. Running a Jelly scriptTo run a Jelly script once:
To run a Jelly script periodically: Writing a Jelly scriptScripts are generally of the form: <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <!-- Add your own Jelly XML here --> </JiraJelly> There are also a few extra tags that can be accessed by using the following outer tag, instead of the one above (these are tags that were formerly restricted to the now-defunct JIRA Enterprise edition): <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib"> <!-- Add your own Jelly XML here --> </JiraJelly> In addition to the JIRA tags, you can use tags from the email, http, soap, sql and core Jelly taglibs. More can be added by the user if necessary. Many of JIRA's Jelly tags set context variables, so subsequent tags can refer to their output by dereferencing the context variable (e.g. ${jira.new.username}). Other tags let you explicitly specify the name of a variable to store some output in, e.g., <jira:CreateUser> has issueKeyVar and issueIdVar parameters: <jira:CreateIssue project-key="TP" summary="Issue One" issueKeyVar="issuekey" issueIdVar="issueid"/> Raised issue ${issuekey} with id ${issueid} Note that the variable is only set after the tag is closed, not inside the tag.
The list of currently available tags:
jira:AddCommentThis function adds a comment to an Issue. Attributes
ExamplesCreate comment <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:AddComment comment="Issue comment" issue-key="ABC-1" groupLevel="admin-group"/> </JiraJelly> Create Issue and Comment <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateIssue project-key="TP" issueType="Bug" summary="Issue summary" issueKeyVar="key"/> <jira:AddComment issue-key="${key}" comment="A comment on ${key}"/> </JiraJelly> jira:AddComponentAdds a component to a project. Attributes
ExamplesCreate Component <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:AddComponent project-key="ABC" name="Comp 1" description="Comp 1 description"/> </JiraJelly> Create Component in a Project <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateProject key="ABC" name="A Project" lead="logged-in-user"> <jira:AddComponent name="Comp 1"/> </jira:CreateProject> </JiraJelly> Create Component with a Component Lead <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:AddComponent project-key="ABC" name="Comp 1" description="Comp 1 with lead" componentLead="user-name"/> </JiraJelly> jira:SelectComponentAssigneesSelects the default assignees for newly created issues of the component. Attributes
ExamplesSelect a Component Assignee <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib"> <jira:SelectComponentAssignees project-key="ABC" componentName="Comp 1" assigneeType="componentLead"/> </JiraJelly> jira:AddUserToGroupMakes a user a member of a Group. Adds the username and/or group name into the context if specified. Attributes
Username is set in the context if specified in the tag.Group name is set in the context if specified in the tag.h4. Examples Add User to Group <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:AddUserToGroup username="new-user" group-name="new-group"/> </JiraJelly> Add New User to Group <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateUser username="new-user" password="password" confirm="password" fullname="Full name" email="test@test.com"> <jira:AddUserToGroup group-name="new-group"/> </jira:CreateUser> </JiraJelly> Add User to New Group <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateGroup group-name="new-group"> <jira:AddUserToGroup username="new-user"/> </jira:CreateGroup> </JiraJelly> Add New User to New Group <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateUser username="new-user" password="password" confirm="password" fullname="Full name" email="test@test.com"/> <jira:CreateGroup group-name="new-group"> <jira:AddUserToGroup/> </jira:CreateGroup> </jira:CreateUser> </JiraJelly> jira:AddVersionAdds a version to a project.
ExamplesCreate a Version <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:AddVersion project-key="ABC" name="Ver 1"/> </JiraJelly> Create a Version in a Project <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateProject key="ABC" name="A Project" lead="logged-in-user"> <jira:AddVersion name="Ver 1"/> </jira:CreateProject> </JiraJelly> jira:CreateGroupCreates a Group in JIRA. Attributes
Context Variables
ExamplesCreate Group <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateGroup group-name="new-group"/> </JiraJelly> jira:AssignIssueAssigns an issue to a user. Attributes
ExamplesCreate and assign issue <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateIssue project-key="TST" summary="My Issue summary" issueKeyVar="keyvar"/> <jira:AssignIssue key="${keyvar}" assignee="testuser"/> </JiraJelly> jira:CreateIssueThis tag creates a new issue in JIRA and places the issue id in the context. Attributes
ExamplesCreate Issue <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateIssue project-key="ABC" assignee="-1" summary="Issue summary"> <!-- other jelly tags --> </jira:CreateIssue> </JiraJelly> Create Issue from Project <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateProject key="ABC" name="A Project" lead="logged-in-user"> <jira:CreatePermissionScheme name="admin-scheme"> <jira:AddPermission permissions="Assignable,Browse,Create,Assign" type="group"/> <jira:SelectProjectScheme/> </jira:CreatePermissionScheme> <jira:CreateIssue summary="Issue summary"> <!-- other jelly tags --> </jira:CreateIssue> </jira:CreateProject> </JiraJelly> Create Issue with Custom Field values
<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateIssue project-key="ABC" summary="Issue summary"> <jira:AddCustomFieldValue id="customfield_10000" value="field value"/> <jira:AddCustomFieldValue name="Environment Select list" value="Windows XP"/> <!-- For Cascading Selects : Note also that the value for cascading selects is the optionId--> <jira:AddCustomFieldValue id="customfield_10001" value="Parent Option Id" /> <jira:AddCustomFieldValue id="customfield_10001" value="Child Option Id" key="1" /> <!-- For Version Pickers and Single Version Pickers : Note also that the value for version pickers is the versionId--> <jira:AddCustomFieldValue id="customfield_10002" value="Version Id"/> <!-- For Multi Selects --> <jira:AddCustomFieldValue id="customfield_10003" value="Value 1" /> <jira:AddCustomFieldValue id="customfield_10003" value="Value 2" /> <!-- For Multi User Pickers : Note also that the value for multi user pickers is a comma separated list of users--> <jira:AddCustomFieldValue id="customfield_10004" value="User 1,User 2" /> </jira:CreateIssue> </JiraJelly>
jira:LinkIssueThis tag creates a link from one issue to another issue. Attributes
ExamplesCreate a Link between two existing issues <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:LinkIssue key="TST-1" linkKey="TST-2" linkDesc="duplicates"/> </JiraJelly> Create two issues and link them <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateIssue project-key="HSP" assignee="-1" summary="Issue summary 1" reporter="admin" issueKeyVar="issuekey1"/> <jira:CreateIssue project-key="NDT" assignee="-1" summary="Issue summary 2" reporter="admin" issueKeyVar="issuekey2"/> <jira:LinkIssue key="${issuekey1}" linkKey="${issuekey2}" linkDesc="duplicates"/> </JiraJelly> jira:TransitionWorkflow
This tag executes a workflow transition on an issue. Please keep in mind that if you are specifying field attribute/value pairs in your Jelly tag then these fields MUST be on the associted workflow transition screen. If the field is not on the screen then the value will not be set on the issue. For example, if you want to set the resolution attribute in your Jelly XML then your transition MUST have a screen associated with it that includes the resolution field on that screen. Attributes
ExamplesExecute Workflow Transition <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:TransitionWorkflow key="TST-6" user="testuser" workflowAction="Resolve issue" resolution="fixed" fixVersions="version 1,version 3" assignee="-automatic-" comment="Test comment" groupLevel="jira-developers" /> </JiraJelly> jira:CreateProjectThis tag creates a new project in JIRA and places the project id in the context. Attributes
Context Variables
ExamplesCreate Project <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateProject key="ABC" name="A Project" lead="a-user"> <!-- other jelly tags --> </jira:CreateProject> </JiraJelly> jira:CreateUserCreates a user in JIRA and places their username in the context. Attributes
Context Variables
ExamplesCreate User <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateUser username="new-user" password="password" confirm="password" fullname="Full name" email="test@test.com"/> </JiraJelly> jira:RemoveUserRemoves an existing JIRA user by their username Attributes
ExamplesRemove User <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:RemoveUser name="existing-user"/> </JiraJelly> jira:CreatePermissionSchemeCreates a Permission Scheme Attributes
Context Variables
jira:AddPermissionGrants permissions within a permission scheme. Often nested within a JIRADOC:CreatePermissionScheme tag. Attributes
ExamplesGrant permissions to jira-users and jira-developers in a new permission scheme <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreatePermissionScheme name="New Permission Scheme"> <jira:AddPermission group="jira-users" permissions="Browse,Create,Comment,Attach" type="group"/> <jira:AddPermission group="jira-developers" permissions="Move,Assignable,Link,ViewVersionControl" type="group"/> </jira:CreatePermissionScheme> </JiraJelly> Grant issue reporters the ability to edit/delete their own issues, in a new permission scheme <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib"> <jira:CreatePermissionScheme name="New Permission Scheme"> <jira:AddPermission type="reporter" permissions="Delete, Edit"/> </jira:CreatePermissionScheme> </JiraJelly> Make projects using default permission scheme visible to certain users <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib"> <jira:AddPermission schemeId="0" permissions="Browse" type="user" user="johnc"/> <jira:AddPermission schemeId="0" permissions="Browse" type="user" user="ebf"/> </JiraJelly> Granting a group selector custom field's members the ability to assign/be assigned the issue. <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:AddPermission schemeId="10164" type="groupCF" groupCF="customfield_10000" permissions="Assign,Assignable" /> </JiraJelly> jira:LoginThis tag logs a user into JIRA using the username and password provided. Use this tag when you are running the Jelly script in a manner in which you are not logged in (for example, if you are running a JellyService instead of using the Jelly Runner), or if you want to run the Jelly script as a different user to the one you are logged in as. Attributes
Context Variables
ExamplesLogin a user in with username and password and set in context <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:Login username="misc-user" password="password"> <!-- other jelly tags --> </jira:Login> </JiraJelly> jira:CreateCustomFieldThe tag creates a new Custom Field. Only System custom fields can be added with Jelly tags. Attributes
ExamplesCreate Cascading Custom Field <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateCustomField fieldType="cascadingselect" fieldScope="issuetype" fieldName="Issue cascadingselect Bug" issueType="Bug" description="Bank have requested Y2K fixes to be sent as an EBF." searcher="cascadingselectsearcher" > <jira:AddCustomFieldSelectValue value="Parent 1" /> <jira:AddCustomFieldSelectValue value="Parent 2"> <jira:AddCustomFieldSelectValue value="Child 1" /> <jira:AddCustomFieldSelectValue value="Child 2" /> </jira:AddCustomFieldSelectValue> <jira:AddCustomFieldSelectValue value="Parent 3" /> </jira:CreateCustomField> </JiraJelly> jira:AddFieldToScreenAdds a field to a specific tab on a screen. Can also specify in which position to insert the field. Attributes
ExamplesAdd Fields to a Screen <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <!-- Adds 'description' field to the 'Field Tab' on 'Default Screen' --> <jira:AddFieldToScreen fieldId="description" screen="Default Screen" tab="Field Tab"/> <!-- Adds 'duedate' field to same screen as above. duedate is inserted in position 1 --> <jira:AddFieldToScreen fieldId="duedate" screen="1" tab="0" fieldPosition="1"/> </JiraJelly> Create a new Customfield and Add it to a Screen <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateCustomField fieldType="cascadingselect" fieldScope="issuetype" fieldName="Issue cascadingselect Bug" issueType="Bug" description="Bank have requested Y2K fixes to be sent as an EBF." searcher="cascadingselectsearcher" customFieldIdVar="customField" > <jira:AddCustomFieldSelectValue value="Parent 1" /> <jira:AddCustomFieldSelectValue value="Parent 2"> <jira:AddCustomFieldSelectValue value="Child 1" /> <jira:AddCustomFieldSelectValue value="Child 2" /> </jira:AddCustomFieldSelectValue> <jira:AddCustomFieldSelectValue value="Parent 3" /> </jira:CreateCustomField> <jira:AddFieldToScreen screen="Default Screen" fieldId="${customField.getId()}"/> </JiraJelly> jira:AttachFileAttaches a file to an issue. Attributes
ExamplesAdding an attachment <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:AttachFile key="TST-1" filepath="/tmp/somefile" option="override"/> </JiraJelly> jira:RunSearchRequestThis tag runs a search request against JIRA using a predefined filter. [GenericEntity:Issue] [created,2007-11-01 15:51:25.0] [summary,Testing] [component,null] [workflowId,12530] [timeoriginalestimate,null] [fixfor,null] [type,2] [timespent,null] [environment,Windows] [resolution,null] [status,1] [updated,2007-11-01 15:51:25.0] [timeestimate,null] [id,11540] [key,TSTA-5] [duedate,null] [description,Test] [project,10063] [reporter,admin] [security,null] [votes,0] [assignee,null] [priority,3] To retrieve a value, e.g. key, you can call gv.getString("key"). For full details, see the OFBiz GenericValue API. Attributes
ExamplesRunning a search request and iterating through the keys of the returned issues <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:RunSearchRequest filterid="10524" var="issues" size-var="issuecount"/> <core:forEach var="issue" items="${issues}"> ${issue.key} </core:forEach> </JiraJelly> jira:AddActorsToDefaultProjectRoleThis tag will add 'actors' to the default membership for a given project role. Actors can be defined as groups or users, i.e. you can add both users and groups to a project role. Attributes
ExamplesAdding a list of default users or groups to a project role <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:AddActorsToDefaultProjectRole projectroleid="1" actors="fred,admin,tom" actortype="atlassian-user-role-actor" /> </JiraJelly> jira:AddActorsToProjectRoleThis tag will add 'actors' to a given project role for a particular project. Actors can be defined as groups or users, ie you can add both users and groups to a project role. Attributes
ExamplesAdding a list of users or groups to a project role <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:AddActorsToProjectRole projectroleid="1" actors="jira-administrators,jira-users" projectkey="MKY" actortype="atlassian-group-role-actor" /> </JiraJelly> jira:CreateProjectRoleThis tag will create a project role with the given name and description. Attributes
Context Variables
ExamplesCreating a new project role <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateProjectRole name="lion-tamer" description="tames the lions"> ${jelly.role.id} ${jelly.role.name} ${jelly.role.description} </jira:CreateProjectRole> </JiraJelly> jira:DeleteProjectRoleThis tag will delete the project role with the given id. Attributes
ExamplesDeleting a project role from JIRA <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:DeleteProjectRole projectroleid="1" confirm="true" /> </JiraJelly> jira:GetDefaultRoleActorsThis tag will return a ProjectRoleActors object for a given project role for a particular project. This object carries the members of a project role, i.e. users and/or groups. To get the collection of users in this object, use the expression ${roleactors.users} where roleactors is the variable name of the object. For more information on the RoleActors object, consult the JIRA API. Attributes
ExamplesReturning a List of role actors and iterating over the users in each of these actors. <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib" xmlns:core="jelly:core"> <jira:GetDefaultRoleActors projectroleid="1" var="roleactors" > <core:forEach var="actor" items="${roleactors.users}"> ${actor.name} </core:forEach> </jira:GetDefaultRoleActors> </JiraJelly> jira:GetProjectRoleThis tag will return the project role with the given id. Attributes
ExamplesReturning a project role <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:GetProjectRole projectroleid="1" var="role" > ${role.name} </jira:GetProjectRole> </JiraJelly> jira:GetProjectRoleActorsThis tag will return a ProjectRoleActors object for the given project role and project. This object is a placeholder for the internal members of a project role, i.e. users and/or groups. To get the collection of users in this object, use the expression ${roleactors.users} where roleactors is the variable name of the object. For more information on the RoleActors object, consult the JIRA API. Attributes
ExamplesReturn a list of users for a given 'Role Actors' object <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib" xmlns:core="jelly:core"> <jira:GetProjectRoleActors projectkey="MKY" projectroleid="1" var="roleactors" > <core:forEach var="actor" items="${roleactors.users}"> ${actor.name} </core:forEach> </jira:GetProjectRoleActors> </JiraJelly> jira:IsProjectRoleNameUniqueThis tag will return 'true' or 'false' to let you know if there is already a project role with the given name. Attributes
ExamplesDetermining if a project role is unique. <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:IsProjectRoleNameUnique name="unique name" var="isUnique" > ${isUnique} </jira:IsProjectRoleNameUnique> </JiraJelly> jira:RemoveActorsFromProjectRoleThis tag will remove a list of role actors from a given project role for a given project. Attributes
ExamplesRemoving a list of groups from a project role <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:RemoveActorsFromProjectRole projectroleid="1" actors="jira-administrators, jira-users" projectkey="MKY" actortype="atlassian-group-role-actor" /> </JiraJelly> jira:RemoveActorsFromDefaultProjectRoleThis tag will remove a list of role actors (i.e. users and/or groups) from the default membership of a given project role. Attributes
ExamplesRemoving a list of groups from a default project role <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:RemoveActorsFromDefaultProjectRole projectroleid="1" actors="jira-administrators, jira-users" actortype="atlassian-group-role-actor" /> </JiraJelly> jira:UpdateProjectRoleThis tag will update the name and description for a given project role id. Attributes
ExamplesUpdating a project role <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:UpdateProjectRole projectroleid="123" name="unique name" description="my project role is nice" /> </JiraJelly> Beta TagsThere are also a number of BETA tags that have not been fully tested or documented. The following list contains the tags and the attributes that can be passed to them:
If you would like more information on how to use the Beta tags, please read the source and/or post to the JIRA Development Forum. Sample scriptsCreating a new ProjectTo properly partition projects, one needs a permission scheme per project, and project-specific groups to allocate permissions to. Setting up a new project can be a time-intensive process. The following sample Jelly scripts automate this: <?xml version="1.0"?> <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib" xmlns:j="jelly:core"> <j:set var="name" value="Test Project"/> <j:set var="key" value="TEST"/> <j:set var="lowerkey" value="test"/> <j:set var="lead_username" value="joe"/> <j:set var="lead_password" value="joe"/> <j:set var="lead_fullname" value="Joe Bloggs"/> <j:set var="lead_email" value="joe@example.com"/> <j:set var="url" value="http://example.com/TestProj"/> <jira:CreateUser username="${lead}" password="${lead}" confirm="${lead}" fullname="${lead_fullname}" email="${lead_email}"/> <jira:CreateGroup group-name="${lowerkey}-developers"> <jira:AddUserToGroup username="${lead}"/> </jira:CreateGroup> <jira:CreateProject key="${key}" name="${name}" url="${url}" lead="${lead}"> <jira:CreatePermissionScheme name="${name} permissions"> <jira:AddPermission type="reporter" permissions="Close"/> <jira:AddPermission group="jira-administrators" permissions="Close,Delete" type="group"/> <jira:AddPermission group="jira-users" permissions="Create,Edit,Comment,Link,Attach" type="group"/> <jira:AddPermission group="${lowerkey}-developers" permissions="Project,ScheduleIssue,Move,Assign,Assignable,Resolve,Close,Work" type="group"/> <jira:AddPermission group="Anyone" permissions="Browse,ViewVersionControl"/> <jira:SelectProjectScheme/> </jira:CreatePermissionScheme> </jira:CreateProject> </JiraJelly> This script is more complicated, with multiple groups per project: <?xml version="1.0"?> <!-- This script handles some of the administrative chores required when adding a new project to JIRA. It creates the project, groups, permission scheme, and gives groups the relevant permissions in the permission scheme. --> <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib" xmlns:j="jelly:core"> <!-- Name of the project to create --> <j:set var="name" value="Jelly Test Project"/> <!-- Key for the new project --> <j:set var="key" value="TEST"/> <!-- Existing user who will become the project lead (default assignee) --> <j:set var="admin" value="admin"/> <jira:CreateGroup group-name="${key}-users"/> <jira:CreateGroup group-name="${key}-developers"/> <jira:CreateGroup group-name="${key}-managers"/> <jira:CreateGroup group-name="${key}-bizusers"/> <jira:CreateGroup group-name="${key}-qa"/> <jira:CreateProject key="${key}" name="${name}" lead="${admin}"> <jira:CreatePermissionScheme name="${key} Permission Scheme"> <jira:AddPermission type="reporter" permissions="Edit"/> <jira:AddPermission type="assignee" permissions="Resolve"/> <jira:AddPermission group="jira-administrators" permissions="Project,Delete" type="group"/> <jira:AddPermission group="${key}-users" permissions="Browse,Create,Comment,Attach" type="group"/> <jira:AddPermission group="${key}-developers" permissions="Move,Assignable,Link,ViewVersionControl" type="group"/> <jira:AddPermission group="${key}-managers" permissions="Edit,Assign,Assignable,Resolve,Close,Delete" type="group"/> <jira:AddPermission group="${key}-bizusers" permissions="Assignable" type="group"/> <jira:AddPermission group="${key}-qa" permissions="Assignable" type="group"/> <jira:AddPermission group="opsmgrs" permissions="Browse,Edit,Assignable,Comment" type="group"/> <jira:AddPermission group="dba-user-group" permissions="Browse,Assign,Assignable,Comment" type="group"/> <jira:AddPermission group="help-desk-group" permissions="Browse,Assign,Assignable,Comment" type="group"/> <jira:AddPermission group="webadmin-group" permissions="Browse,Assign,Assignable,Comment" type="group"/> <jira:AddPermission group="unix-admin-group" permissions="Browse,Assign,Assignable,Comment" type="group"/> <jira:SelectProjectScheme/> </jira:CreatePermissionScheme> </jira:CreateProject> </JiraJelly> For a list of projects, perform a project-specific operation.This script iterates through a (comma-separated) list of projects, creates a project-specific group, and adds a user to that group. <?xml version="1.0"?> <!-- Jelly script to create 'support' group per project --> <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib" xmlns:util="jelly:util" xmlns:j="jelly:core"> <util:tokenize var="projects" delim=",">ARM,QWI,DWI,DBOR,DBSQ,LYX,MMM,MOI,TPAI,SEP,AMR,SLA,TP,TRBC,YRD</util:tokenize> <j:forEach var="proj" items="${projects}"> <jira:CreateGroup group-name="${proj}-support"/> <jira:AddUserToGroup username="jeff" group-name="${proj}-support"/> </j:forEach> </JiraJelly> Create a user, issue, and assign the issue to the userThe following script creates a user (called new-user), creates a new issue, adds the user to the jira-developers group and assigns the issue to the user. It illustrates the use of context variables. <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateUser username="new-user" password="password" confirm="password" fullname="Full name" email="test@test.com"/> Username is ${jelly.new.username} <jira:CreateIssue project-key="TP" summary="New issue summary" issueKeyVar="ik"/> <jira:AddUserToGroup username="new-user" group-name="jira-developers"/> <jira:AssignIssue key="${ik}" assignee="${jelly.new.username}"/> </JiraJelly> Assigning and Starting ProgressHere we create an issue, assign it to 'bob' (who must be in jira-developers), and start progress: <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib"> <jira:CreateIssue project-key="TP" summary="New issue" issueKeyVar="ik"/> <jira:AssignIssue key="${ik}" assignee="bob"/> <jira:TransitionWorkflow key="${ik}" user="bob" workflowAction="Start Progress" /> </JiraJelly> Moving unreplied-to issues into an 'Inactive' stateWhen JIRA is used for interacting with customers, this script is useful for finding issues which are awaiting customer response, and haven't been responded to in a while. It moves such issues into an 'Inactive' state. You would typically invoke this script periodically with the Jelly Service. <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.enterprise.JiraTagLib" xmlns:core="jelly:core" xmlns:log="jelly:log" > <jira:Login username="customersupport" password="XXXXXX"> <log:warn>Running Inactivate issues service</log:warn> <core:set var="comment">This issue has not been updated for 5 business days. If you have an update, please use "Add Comments For Vendor" action to let us know. If you need more time to gather information please let us know and we will 'freeze' this issue. If you have no other questions, please Close this issue. If no update is received in the next 5 business days, this issue will be automatically closed. Thank you, The Support Team</core:set> <core:set var="workflowStep" value="Mark Inactive" /> <core:set var="workflowUser" value="customersupport" /> <!-- Run the SearchRequestFilter --> <jira:RunSearchRequest filterid="11505" var="issues" /> <core:forEach var="issue" items="${issues}"> <log:warn>Inactivating issue ${issue.key}</log:warn> <jira:TransitionWorkflow key="${issue.key}" user="${workflowUser}" workflowAction="${workflowStep}" comment="${comment}"/> </core:forEach> </jira:Login> </JiraJelly> Where:
The JIRA Toolkit is useful in conjuction with this script, to find issues awaiting customer response. |
![]() |
Document generated by Confluence on Oct 06, 2009 00:26 |