diff --git a/scripts/cli.py b/scripts/cli.py index 2f3122a..918e351 100644 --- a/scripts/cli.py +++ b/scripts/cli.py @@ -48,17 +48,26 @@ def get_commits_from_changes( @click.option("--tc-url", required=False, help="TeamCity URL") @click.option("--tc-user", required=False, help="TeamCity User") @click.option("--tc-password", required=False, help="TeamCity Password") -@click.option("--qualix-host", required=True, help="Tested Qualix host") +@click.option("--qualix-host", required=False, default=None, help="Tested Qualix host") +@click.option( + "--qualix-version", required=False, default=None, help="Tested Qualix version" +) +@click.option("--image-tag", required=False, default=None, help="Tested Qualix image") def trigger_qualix_auto_tests( tc_url: Optional[str], tc_user: Optional[str], tc_password: Optional[str], - qualix_host: str, + qualix_host: Optional[str], + qualix_version: Optional[str], + image_tag: Optional[str], ): tc = TC(tc_url, tc_user, tc_password) current_build = tc.get_current_build() tests_info = AutoTestsInfo.from_current_build(current_build) tests_info.qualix_host = qualix_host + tests_info.qualix_version = qualix_version + tests_info.image_tag = image_tag + trigger_tests(tests_info, tc) diff --git a/scripts/utils/models.py b/scripts/utils/models.py index f6518c6..e985d88 100644 --- a/scripts/utils/models.py +++ b/scripts/utils/models.py @@ -30,6 +30,8 @@ class AutoTestsInfo(BuildEnv): vcs_url: str path: PosixPath qualix_host: Optional[str] = None + qualix_version: Optional[str] = None + image_tag: Optional[str] = None @classmethod def from_current_build(cls, build: "Build") -> "AutoTestsInfo": diff --git a/scripts/utils/trigger_helpers.py b/scripts/utils/trigger_helpers.py index 84b6425..2711e86 100644 --- a/scripts/utils/trigger_helpers.py +++ b/scripts/utils/trigger_helpers.py @@ -13,6 +13,8 @@ PARAM_TRIGGERED_BY_URL = "conf.triggered_by_project.url" PARAM_TRIGGERED_BY_COMMIT = "conf.triggered_by_project.commit_id" PARAM_QUALIX_HOST = "conf.triggered_by_project.qualix_ip" +PARAM_QUALIX_VERSION = "conf.triggered_by_project.qualix_version" +PARAM_QUALIX_IMAG_TAG = "conf.triggered_by_project.image_tag" def trigger_tests(tests_info: "AutoTestsInfo", tc: "TC"): @@ -113,6 +115,12 @@ def _trigger_auto_tests_build( if tests_info.qualix_host is not None: prop[PARAM_QUALIX_HOST] = tests_info.qualix_host + if tests_info.qualix_version is not None: + prop[PARAM_QUALIX_VERSION] = tests_info.qualix_version + + if tests_info.image_tag is not None: + prop[PARAM_QUALIX_IMAG_TAG] = tests_info.image_tag + build = tc.trigger_build( bt.id, prop,