程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python] lazy man benefits. Operate JIRA through Pythons JIRA library, automatically submit and close bugs in batches, and improve efficiency

編輯:Python

brief introduction :

Jira It is based on Java Architecture management system (Atlassian The company supports ), There's open source code , Convenient for secondary development ( Extensibility ).Jira Is a very powerful management tool , Widely used for Defect tracking 、 Use case management 、 Demand collection 、 Task tracking 、 Time management 、 Project plan management, etc .

python Supported operations Jira Third party package for , It is convenient to customize some automatic operations .

Need to install jira library : 

pip install jira

Jira authentication

from jira import JIRA
options = {'server': 'https://jira.xxxx.com'}
jira = JIRA(basic_auth=("username", "password"),options=options)

This clear text account password is not secure , So you can use another one API token The way to authenticate .

To https://id.atlassian.com/manage/api-tokens Make your API token.

from jira import JIRA
options = {'server': 'https://jira.xxxx.com'}
jira = JIRA(basic_auth=("username", YOUR_API_TOKEN),options=options)

Officials have a safer way , so Basic auth for REST APIs

The following is an introduction of my experience in the project python Yes jira Control of

Overall project structure

1、 config.ini Configure authorized login information

[JIRA]
url = https://acsjira.XXX.com/
user = account
pass = password
[DEFECT]
project_key = jira project key
project_id = project id
project_name = project name
issue_type_name = Defect
[else]
label = CyberSecurity
planned_iteration = SAST
; standard version
;product/s = 74952
products = Cyber Security

2、db.py Operate local database , preservation jira Newly reported defect Status to local , And other reported , Not reported , Closed, etc defect Information

3、export.csv Export the newly reported defect To local csv file , And send an email to the relevant person to remind  

4、jira_operation.py Yes jira Basic operation , Including automatic escalation defect, Inquire about defect state ,reopen defects , Automatically resolve, Automatically close defects , Return the current defect status and record, etc

5、utils.py python operation csv file , Reading and writing , Save, etc

 6.main.py The main function , Receive from jenkins Post build steps ,post build task Script parameters of plug-in configuration  , Judge whether it has been reported defect, If you don't report it , Save as csv, Close defects, etc

7.pipfile Use python edition ,jira Version of the configuration


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved