|
32 | 32 | from obs_package_update.util import CommandError |
33 | 33 | from obs_package_update.util import CommandResult |
34 | 34 | from obs_package_update.util import retry_async_run_cmd |
| 35 | +from obs_package_update.util import run_cmd |
35 | 36 | from obs_package_update.util import RunCommand |
36 | 37 | from staging.build_result import Arch |
37 | 38 | from staging.build_result import PackageBuildResult |
@@ -1044,6 +1045,18 @@ async def fetch_build_results(self) -> list[RepositoryBuildResult]: |
1044 | 1045 | (await self._run_cmd(self._osc_fetch_results_cmd())).stdout |
1045 | 1046 | ) |
1046 | 1047 |
|
| 1048 | + @property |
| 1049 | + def staging_project_registry_base_url(self) -> str: |
| 1050 | + """Returns the base url to the containers in the staging project on |
| 1051 | + OBS. This url is missing the repository name and the actual container |
| 1052 | + tag, but it can be used to plug the staging project directly into |
| 1053 | + BCI-tests. |
| 1054 | +
|
| 1055 | + """ |
| 1056 | + return "registry.opensuse.org/" + self.staging_project_name.lower().replace( |
| 1057 | + ":", "/" |
| 1058 | + ) |
| 1059 | + |
1047 | 1060 | async def force_rebuild(self) -> str: |
1048 | 1061 | """Deletes all binaries of the project on OBS and force rebuilds everything.""" |
1049 | 1062 | await self._run_cmd( |
@@ -1448,6 +1461,7 @@ def main() -> None: |
1448 | 1461 | "changelog_check", |
1449 | 1462 | "setup_obs_package", |
1450 | 1463 | "find_missing_packages", |
| 1464 | + "run_bci_tests", |
1451 | 1465 | ] |
1452 | 1466 |
|
1453 | 1467 | parser = argparse.ArgumentParser() |
@@ -1628,6 +1642,8 @@ def add_commit_message_arg(p: argparse.ArgumentParser) -> None: |
1628 | 1642 | help="Find all packages that are in the deployment branch and are missing from `devel:BCI:*` on OBS", |
1629 | 1643 | ) |
1630 | 1644 |
|
| 1645 | + subparsers.add_parser("run_bci_tests", help="Run BCI-Tests on test build") |
| 1646 | + |
1631 | 1647 | loop = asyncio.get_event_loop() |
1632 | 1648 | args = parser.parse_args() |
1633 | 1649 |
|
@@ -1775,6 +1791,34 @@ async def _pkgs_as_str() -> str: |
1775 | 1791 |
|
1776 | 1792 | coro = _pkgs_as_str() |
1777 | 1793 |
|
| 1794 | + elif action == "run_bci_tests": |
| 1795 | + if bot.os_version == OsVersion.TUMBLEWEED: |
| 1796 | + raise ValueError("Running BCI-Tests is not supported on Tumbleweed.") |
| 1797 | + |
| 1798 | + async def _run_tests() -> str: |
| 1799 | + tox_env = os.getenv("TOX_ENV") |
| 1800 | + bci_tests_branch = os.getenv("BCI_TESTS_BRANCH") |
| 1801 | + await run_cmd( |
| 1802 | + f"git clone https://github.com/SUSE/BCI-tests", logger=LOGGER |
| 1803 | + ) |
| 1804 | + runner = RunCommand( |
| 1805 | + cwd=os.path.join(os.getcwd(), "BCI-tests"), logger=LOGGER |
| 1806 | + ) |
| 1807 | + if bci_tests_branch: |
| 1808 | + await runner(f"git checkout {bci_tests_branch}") |
| 1809 | + |
| 1810 | + test_res = await runner( |
| 1811 | + f"tox {'-e ' + tox_env if tox_env else ''} -- -n auto", |
| 1812 | + env={ |
| 1813 | + "OS_VERSION": f"15.{bot.os_version}", |
| 1814 | + "TARGET": "custom", |
| 1815 | + "BASEURL": bot.staging_project_registry_base_url, |
| 1816 | + }, |
| 1817 | + ) |
| 1818 | + return test_res.stdout |
| 1819 | + |
| 1820 | + coro = _run_tests() |
| 1821 | + |
1778 | 1822 | else: |
1779 | 1823 | assert False, f"invalid action: {action}" |
1780 | 1824 |
|
|
0 commit comments