Skip to content

Commit

Permalink
Add backlog-set-due-date script
Browse files Browse the repository at this point in the history
Problem: We need a script that setup the due date based in the SLO
of the tickets in progress
  • Loading branch information
ilausuch committed Nov 20, 2020
1 parent 9ee43ba commit 4963b4b
Show file tree
Hide file tree
Showing 2 changed files with 1,226 additions and 0 deletions.
27 changes: 27 additions & 0 deletions backlog-set-due-date
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh -e

redmine_api_key="${redmine_api_key:?"Need redmine API key"}"
project_id="${project_id:-18}"
ticket_limit="${ticket_limit:-200}"
host="${host:-"https://progress.opensuse.org"}"
issues=$(mktemp)
issue=$(mktemp)

curl -s -H "X-Redmine-API-Key: $redmine_api_key" "$host/issues.json?project_id=$project_id&limit=$ticket_limit" | jq -r '.issues | .[] | select(.priority.name!="Low") | select(.due_date==null)' >"$issues"

for id in $(jq .id "$issues"); do
jq "select(.id==$id)" "$issues" >"$issue"
case $(jq ".priority.name" "$issue"| tr -d '"') in
Normal) days=356;;
High) days=30;;
Urgent) days=7;;
Inmediate) days=1;;
*) days=0;;
esac

start_date=$(jq ".created_on" "$issue" | tr -d '"')
due_date=$(date -d"$start_date + $days days" +%Y-%m-%dT%TZ)
echo "$due_date"
#TODO Setup the due date using the Progress API
done

Loading

0 comments on commit 4963b4b

Please sign in to comment.