-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rpmbuild: specify snippets to mock config via copr-rpmbuild config file
This allows us to specify tpm fs size to rpmbuild in order to be able to automatically generate its size for performance builders. See #3268
- Loading branch information
Showing
10 changed files
with
114 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
# Configure special mock configuration snippets per given set of tags. | ||
# job_tag_to_mock_snippets: | ||
# on_demand_powerful: config_opts['plugin_conf']['tmpfs_opts']['max_fs_size'] = '280g' |
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,37 @@ | ||
""" | ||
Configuration class for copr-rpmbuild | ||
""" | ||
|
||
|
||
import os | ||
import yaml | ||
|
||
|
||
CONFIG_PATH = "/etc/copr-rpmbuild/copr-rpmbuild" | ||
ALLOWED_FILE_TYPES = ["yaml", "yml"] | ||
|
||
|
||
class Config: | ||
""" | ||
Configuration class for copr-rpmbuild | ||
""" | ||
def __init__(self): | ||
self.job_tag_to_mock_snippets = {} | ||
|
||
def load_config(self): | ||
""" | ||
Load configuration from the config file | ||
""" | ||
config_path = None | ||
for file_type in ALLOWED_FILE_TYPES: | ||
if os.path.exists(f"{CONFIG_PATH}.{file_type}"): | ||
config_path = f"{CONFIG_PATH}.{file_type}" | ||
break | ||
|
||
if config_path is None: | ||
return | ||
|
||
with open(CONFIG_PATH, "r", encoding="utf-8") as file: | ||
config_data = yaml.safe_load(file) or {} | ||
|
||
self.job_tag_to_mock_snippets = config_data.get('job_tag_to_mock_snippets', {}) |
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
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