-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Jira templates more configurable and safer
Enables configuring Jira fields and labels using a config file. Path to the config file is set by `RETASC_CONFIG` environment variable. This uses mapping for field names in template files to Jira issue properties, because the property naming in Jira are often inconsistent (as in camelCase, snake_case). This also ensures that the template files only use known Jira properties, labels contain internal ID labels and field for release name cannot be overridden. Uses only labels to identify issues for given release. URLs and paths for rules and template are also taken from the config files. CLI command `generate-schema` generates schema for the config file. JIRA: RHELWF-10977
- Loading branch information
Showing
34 changed files
with
463 additions
and
151 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
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,15 @@ | ||
rules_path: examples/rules | ||
jira_template_path: examples/jira | ||
product_pages_url: https://pp.example.com | ||
jira_url: https://jira.example.com | ||
|
||
jira_fields: | ||
description: description | ||
labels: labels | ||
project: project | ||
summary: summary | ||
|
||
jira_label_templates: | ||
- retasc-managed | ||
- "retasc-release-{{ release }}" | ||
jira_label_prefix: retasc-id- |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{% include 'common.yaml.j2' %} | ||
summary: Add Beta Repos |
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 @@ | ||
project: {key: TEST} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{% include 'common.yaml.j2' %} | ||
summary: Main Issue |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{% include 'common.yaml.j2' %} | ||
# override project from 'common.yaml.j2' | ||
project: {key: TEAM} | ||
summary: Notify Team |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{% include 'common.yaml.j2' %} | ||
summary: Secondary Issue |
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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
from pathlib import Path | ||
|
||
import yaml | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class Config(BaseModel): | ||
rules_path: str = Field(description="Path to rules (processed recursively)") | ||
jira_template_path: Path = Field( | ||
description="Path to a root directory with Jira templates" | ||
) | ||
product_pages_url: str = Field(description="Product Pages URL") | ||
jira_url: str = Field(description="Jira URL") | ||
|
||
jira_label_templates: list[str] = Field( | ||
description=( | ||
"Label templates for the managed issues in Jira." | ||
' Example: ["retasc-managed", "retasc-managed-{{ release }}"]' | ||
) | ||
) | ||
jira_label_prefix: str = Field( | ||
description="Prefix for labels identifying specific issue in Jira" | ||
) | ||
jira_fields: dict[str, str] = Field( | ||
description="Mapping from a property in Jira issue template file to a supported Jira field" | ||
) | ||
|
||
|
||
def parse_config(config_path: str) -> Config: | ||
with open(config_path) as f: | ||
config_data = yaml.safe_load(f) | ||
|
||
return Config(**config_data) |
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
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
Oops, something went wrong.