Sidehistorik
Indholdsfortegnelse |
---|
Prerequsites
...
Upon the Transition of Initiate, the Post Function, creates a copy of the Issue as a subtask and sets the the issue back to Status "Frozen":
Make a custom Field
The Issuetype has a custom field called "Cron Scheduling", as this will hold the schedules for the Issue:
...
The scripts makes and enables a crontab for the "jira" user. It search for issues that satisfies:
Tip |
---|
Issuetype=Repeatable Task Status=Frozen Cron Scheduling has a value |
Kodeblok | ||||
---|---|---|---|---|
| ||||
#!/bin/bash IFS=$(echo -en "\n\b") TransitionScript="/opt/jira-cron/jiraTransitionIssue.sh" JIRAFilter="issuetype = \"Repeatable Task\" AND status in (Frozen) and \"Cron Scheduling\" IS NOT NULL" FIELD="12821" CHAR="'" CRONTABUSER="jira" rm /tmp/crontab 2> /dev/null rm /tmp/value 2> /dev/null echo " --------- " >>/opt/jira-cron/jiraMakeCrontab.log issueList=`/opt/atlassian-cli/jira.sh --action getIssueList --search "$JIRAFilter" --outputFormat 200 | grep -v "issues" | grep -v "Created"` for issue in $issueList do issueKey=`echo $issue | awk '{print $1}' | sed 's/,//g'` CustomFieldValue=`/pack/atlassian-cli/jira.sh --action GetFieldValue --issue "$issueKey" --field "customfield_$FIELD" --file /tmp/value` if [ -f /tmp/value ] then crontabEntry=`cat /tmp/value | sed 's/'"$CHAR"'//g'` echo "#Crontabs for $issueKey" >> /tmp/crontab for cronEntry in $crontabEntry do echo "$cronEntry $TransitionScript $issueKey >> /opt/jira-cron/jiraTransitionIssue.log 2>&1" >> /tmp/crontab echo "Added: $cronEntry $TransitionScript $issueKey to /tmp/crontab" >> /opt/jira-cron/jiraMakeCrontab.log done echo "" >> /tmp/crontab fi rm /tmp/value 2> /dev/null done rm /tmp/value 2> /dev/null #Replace JIRA Users crontab su - jira -c "crontab /tmp/crontab" |
...