Modifying workflow to add a status and split on ticket type - trac

I am hoping that someone can help me as I am completely lost. I need to modify the workflow for TRAC so that if the ticket type is SPR, it gets assigned to our QA, and they are the only ones allowed closing the ticket. Otherwise, it goes to the test team to be closed.
As well, I need the ticket status flow to be as follows:
New Ticket(bug) -> Assigned(Dev) -> Fixed(re-assigned to Test or SPR) -> Closed/Re-opened
Currently it appears the ticket is set to closed after dev fixes the issue.
I am not familliar with TRAC at all and have been hammering away at this for 2 days now and can't seem to get it to work. Any help would be incredibly appreciated!

Try AdvancedTicketWorkflowPlugin, because it is able to act differently based on ticket field values. Most relevant here: It does so with triage operation based on ticket type according to its wiki documentation:
accept = new -> *
accept.name = Accept ticket into workflow
accept.operations = triage
accept.triage_field = type
accept.triage_split = defect->new_defect,enhancement->new_enhancement
(see a more complete example on the wiki page linked above)

You can customize the status workflow of your tickets (this is the official documentation: http://trac.edgewall.org/wiki/TracWorkflow). However, different workflows based on ticket type are not yet supported.

Related

RavenDb: Document Refresh feature does not run at nor after the specified time by #refresh flag

I need to mark documets as expired after some time and therefore I am trying to use #refresh feature to re-run subscription and to compute my 'expired' flag. I know there is 'Document expiration' feature but this one removes data which I don't want.
I have turned Refresh feature in settings and added #refresh UTC datetime in metadata for required documents. For example I added manually this document:
{
"Name": "My data",
"#metadata": {
"#collection": "Testing",
"#refresh": "2021-04-30T07:41:35.4845961Z"
}
}
It looks like I am facing non deterministic behavior - sometimes refresh is processed sometimes not. I tried with different combinations of times and set through code or via Raven Studio.
Refresh interval is set to refresh but still says "in less than a minute"
I am using
Community license (Document refresh not mentioned here, but I don't see it mentioned for any other licenses as well)
community license extensions
tried more vresions of RavenDB with same result (5.1.7. was looking more promising as it worked for some time but after a while stopped):
4.2.111 server/studio version in Docker on Windows 10
5.1.7 server/studio version
C# RavenDB.Client 5.1.6
Did not find related issue in bug tracker
https://issues.hibernatingrhinos.com/issues/RavenDB?q=document%20refresh
Any ideas what to check or what might be the case?
EDIT: After turned logging into console I found some error log. It looks like
RavendbProject, Raven.Server.Documents.Expiration.ExpiredDocumentsCleaner, Failed to refresh documents on RavendbProject which are older than 05/17/2021 09:48:47, EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
RavendbProject | at Sparrow.Server.ByteStringContext`1.From(String value, ByteStringType type, ByteString& str) in C:\Builds\RavenDB-Stable-5.1\51024\src\Sparrow.Server\ByteString.cs:line 1297
RavendbProject | at Raven.Server.Documents.DocumentPutAction.PutDocument(DocumentsOperationContext context, String id, String expectedChangeVector, BlittableJsonReaderObject document, Nullable`1 lastModifiedTicks, String changeVector, DocumentFlags flags, NonPersistentDocumentFlags nonPersistentFlags) in C:\Builds\RavenDB-Stable-5.1\51024\src\Raven.Server\Documents\DocumentPutAction.cs:line 190
Also worth mentioning is that my document was stored in ClusterWide transaction and thus I can see in one of my documents corresponding flag:
"#flags": "FromClusterTransaction",
My current suspicion is that it may happen that one of these documents prevented other documents from being refreshed. After deleting cluster-transaction document, other documents in collection were refreshed
The bug related to document that was added via cluster transaction, the workaround for now would be to not use cluster transaction.
I have opened an issue on bug tracker,
https://issues.hibernatingrhinos.com/issue/RavenDB-16710

Issues pulling change log using python

I am trying to query and pull changelog details using python.
The below code returns the list of issues in the project.
issued = jira.search_issues('project= proj_a', maxResults=5)
for issue in issued:
print(issue)
I am trying to pass values obtained in the issue above
issues = jira.issue(issue,expand='changelog')
changelog = issues.changelog
projects = jira.project(project)
I get the below error on trying the above:
JIRAError: JiraError HTTP 404 url: https://abc.atlassian.net/rest/api/2/issue/issue?expand=changelog
text: Issue does not exist or you do not have permission to see it.
Could anyone advise as to where am I going wrong or what permissions do I need.
Please note, if I pass a specific issue_id in the above code it works just fine but I am trying to pass a list of issue_id
You can already receive all the changelog data in the search_issues() method so you don't have to get the changelog by iterating over each issue and making another API call for each issue. Check out the code below for examples on how to work with the changelog.
issues = jira.search_issues('project= proj_a', maxResults=5, expand='changelog')
for issue in issues:
print(f"Changes from issue: {issue.key} {issue.fields.summary}")
print(f"Number of Changelog entries found: {issue.changelog.total}") # number of changelog entries (careful, each entry can have multiple field changes)
for history in issue.changelog.histories:
print(f"Author: {history.author}") # person who did the change
print(f"Timestamp: {history.created}") # when did the change happen?
print("\nListing all items that changed:")
for item in history.items:
print(f"Field name: {item.field}") # field to which the change happened
print(f"Changed to: {item.toString}") # new value, item.to might be better in some cases depending on your needs.
print(f"Changed from: {item.fromString}") # old value, item.from might be better in some cases depending on your needs.
print()
print()
Just to explain what you did wrong before when iterating over each issue: you have to use the issue.key, not the issue-resource itself. When you simply pass the issue, it won't be handled correctly as a parameter in jira.issue(). Instead, pass issue.key:
for issue in issues:
print(issue.key)
myIssue = jira.issue(issue.key, expand='changelog')

DokuWiki LDAP can't see any groups

We have just changed our domain after protracted name change (the name actually happened two years ago!) and our DokuWiki installation has stopped being able to see any groups and memberships.
The config has been updated to reflect the new server and DCs and login is working correctly, it is only the groups that aren't working.
$conf['auth']['ldap']['server'] = 'ldap://MYDC.mydomain.co.uk:389';
$conf['auth']['ldap']['binddn'] = '%{user}#mydomain.co.uk';
$conf['auth']['ldap']['usertree'] = 'dc=mydomain,dc=co,dc=uk';
$conf['auth']['ldap']['userfilter'] = '(userPrincipalName=%{user}#mydomain.co.uk)';
$conf['auth']['ldap']['mapping']['name'] = 'displayname';
$conf['auth']['ldap']['mapping']['grps'] = 'array(\'memberof\' => \'/CN=(.+?),/i\')';
$conf['auth']['ldap']['grouptree'] = 'dc=mydomain,dc=co,dc=uk';
$conf['auth']['ldap']['groupfilter'] = '(&(cn=*)(Member=%{dn})(objectClass=group))';
$conf['auth']['ldap']['referrals'] = '0';
$conf['auth']['ldap']['version'] = '3';
$conf['auth']['ldap']['debug'] = 1;
Obviously I have edited the doain name there, but for the life of me I can't see what's wrong here, It all worked fine yesterday on the old domain.
I should also state that this is an old version of DokuWiki that for various reasons I can't actually update.
The debug line gives me a "ldap search: success" line, but if I add "?do=check" onto any url within the system I get "You are part of the groups"...... and nothing, it can't see any groups.
It's a massive pain as we have a pretty intricate ACL setup for the site, so it's not like I can just throw it open to all.
If anyone has any suggestions, no matter how obvious, please pass them on.
Solved it by changing the dokuwiki authentication plugin that was used, the 'authad' is more simple to use and just works with what I'm doing.
As a side bonus it also means that I have finally been able to get the install upgraded to the current version.

get issue close date

I want to know the date in which a given issue is closed.
haw can I get issue close date via Jira rest API?or from Jira rest java client?
I try to get the update date but it give the date of last update and not the close date.
Is there any way in Jira rest java client or in Jira rest API?
Thank you for answering me.
When searching for issues you need to add expand parameter into search_issues() See here.
Then all changes in issue should be in changelog field. You can list them in similar way:
from jira.client import JIRA
jira = JIRA(options={'server':'http://jira.server.address.com'},basic_auth=('user','password'))
issues = jira.search_issues('key=PR-1',expand='changelog')
for issue in issues:
print issue.key
for change in issue.changelog.histories:
print "== Change id ==", change.id
for change_item in change.items:
print " ",change.created, change_item.field, change_item.fromString, change_item.toString

How can I create trac tickets from an svn commit?

I'm looking for a way to create (not update) a trac ticket in response to a commit message like "Hack code to not kill your dog (TODO: fix this properly to avoid chasing kittens instead)".
I want the trac system to react on the "TODO" keyword and create a ticket with the content of the commit message, the owner set to the committer and the opening commit already referenced.
While searching on SO I found Open and close trac tickets with a single commit which basically says how I could roll my own solution. Which I'd do if there isn't a pre-made one available. So - is there?
I would suggest looking at the official Trac package for python: http://pypi.python.org/pypi/Trac/0.11.4 and docs http://www.edgewall.org/docs/tags-trac-0.11.7/epydoc/trac-module.html
This is what we use to create tickets in Trac from a python script and I think it's fairly simple to use. You could run this python script as a post commit hook for your VCS.
You can start up a trac environment using your project settings and then new up tickets and save them. There's probably a little more to it for you, but this should give you a good idea:
from trac.env import Environment
from trac.ticket import Ticket
env = Environment(projectSettings, create=0)
tkt = Ticket(env)
tkt['summary'] = 'first line of commit message'
tkt['description'] = 'full commit message'
tkt.save_changes(commitAuthor, '')
Needless to say, current Trac stable is 0.12.3, but of course development needs to go with your current version. (You didn't tell us in you question.)
On you question, there is a hint on how to implement different functionality on-top of the CommitTicketUpdater from Trac core. It has update and close as built-in actions, so you'll need to do some change like so (based on current Trac trunk):
create an additional option commands_create for commands, that create a new ticket with reference to the changeset, as a space-separated list
add a class-wide variable self.comment in both of changeset_added and changeset_modified right after comment assignment
add a module cmd_create like (untested)
def cmd_create(self, ticket, changeset, perm):
if not self.check_perms or 'TICKET_CREATE' in perm:
# Commit messages in general is used for a ticket comment.
# New tickets require summary and we'll want description too,
# because comment is ignored on ticket creation.
# So we need to do message processing here beforehand.
ticket['comment'] = None
ticket['description'] = self.comment
ticket['owner'] = changeset.author
ticket['status'] = 'new'
ticket['summary'] = ' '.join(['TODO from', str(changeset.rev)])
ticket.insert()
alter ticket_command so the regexp matches not only the default function-ticket(s) pairs but the unary 'TODO:' as well (sorry, can't make this working right-away now)
extend the private module _parse_message to include another case before if func:
if cmd.startswith('TODO'):
tickets.update({None : ['create']})
continue
change _update_tickets to make the comment saving conditional, because you won't need/want an additional comment on new tickets)
if ticket['comment']:
ticket.save_changes(changeset.author, comment, date, db)
Ok, ask back as required, if you like to try this approach.