-
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
118 additions
and
3 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,6 @@ | ||
--- | ||
# 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' | ||
# # specify more tags as 'and' condition with '+' sign | ||
# x86_64+on_demand_powerful: some_other_tag_for_x86_64_and_on_demand_powerful_tags |
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