-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #59 from mfleader/jira
Jira Service Connection
- Loading branch information
Showing
8 changed files
with
238 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,18 @@ password= | |
[ocp-server] | ||
port=8000 | ||
|
||
[jira] | ||
url= | ||
personal_access_token= | ||
|
||
[airflow] | ||
url= | ||
username= | ||
password= | ||
``` | ||
|
||
[TOML](https://toml.io/en/) is used above, but it also accepts YAML. | ||
|
||
The elasticsearch configuration should be set up by product, that way each product can configure their own ES server. | ||
|
||
As an example for `OCP` the configuration looks like this: | ||
|
@@ -38,7 +44,14 @@ password= | |
|
||
Internally the API when serving the `/ocp` enpoints will use this connection. | ||
|
||
[TOML](https://toml.io/en/) is used above, but it also accepts YAML. | ||
The `jira` table requires a `url` key and a `personal_access_token` key. The `url` is a string value that points to the URL address of your Jira resource. The [Personal Access Token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html) is a string value that is the credential issued to authenticate and authorize this application with your Jira resource. | ||
|
||
```toml | ||
[jira] | ||
url="" | ||
personal_access_token="" | ||
``` | ||
|
||
|
||
## Development on System | ||
|
||
|
@@ -215,5 +228,5 @@ For the purpose of adding new configuration and authentication credentials to th | |
password=password123 | ||
``` | ||
|
||
* Assing the ticket to `[email protected]` | ||
* Assign the ticket to `[email protected]` | ||
* Add as watcher `[email protected]` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from fastapi import APIRouter, Query | ||
from app.services.jira_svc import JiraService | ||
|
||
router = APIRouter() | ||
|
||
@router.get( | ||
'/api/v1/jira', | ||
summary="Query Jira Issues", | ||
) | ||
async def query( | ||
q: str = Query(None, description="Jira query language string") | ||
): | ||
jira = JiraService() | ||
return jira.jql(q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from atlassian import Jira | ||
|
||
from app import config | ||
|
||
|
||
class JiraService: | ||
|
||
def __init__(self, configpath="jira"): | ||
self.cfg = config.get_config() | ||
self.url = self.cfg.get(configpath+'.url') | ||
self.pat = self.cfg.get(configpath+'.personal_access_token') | ||
self.svc = Jira( | ||
url=self.url, | ||
token=self.pat | ||
) | ||
|
||
def jql(self, query: str, fields="*all", expand=None, validate_query=None): | ||
return self.svc.jql( | ||
jql=query, | ||
fields=fields, | ||
expand=expand, | ||
validate_query=validate_query | ||
) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/usr/bin/bash | ||
|
||
uvicorn --reload --host="0.0.0.0" --port=8000 --forwarded-allow-ips='*' --proxy-headers app.main:app app.main:app | ||
uvicorn --reload --host="0.0.0.0" --port=8000 --forwarded-allow-ips='*' --proxy-headers app.main:app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,6 @@ password= | |
[ocp-server] | ||
port=8000 | ||
|
||
[jira] | ||
url= | ||
personal_access_token= |