From 617b49fb6f5809d7f88e61070ac0f93ce3c3bb64 Mon Sep 17 00:00:00 2001 From: Haibo Lin Date: Oct 20 2020 06:16:01 +0000 Subject: Add no_reuse flag to disable reuse JIRA: RHELCMP-2463 Signed-off-by: Haibo Lin --- diff --git a/README.md b/README.md index 60b5aae..48eeece 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,7 @@ If the `packages` is not set, all packages in Koji tag or all packages in a `bui - `no_deps` - For `tag` `source_type`, do not resolve dependencies between packages and include only packages listed in the `packages` in the compose. For `module` `source_type`, do not resolve dependencies between modules and include only the requested module in the compose. - `include_unpublished_pulp_repos` - For `pulp` `source_type`, include also unpublished repositories for input content-sets. - `check_deps` - When set, abort the compose when some package has broken dependencies. + - `no_reuse` - When set, do not try to reuse old compose. - `sigkeys` - List of signature keys IDs. Only packages signed by one of these keys will be included in a compose. If there is no signed version of a package, compose will fail. It is also possible to pass an empty-string in a list meaning unsigned packages are allowed. For example if you want to prefer packages signed by key with ID `123` and also allow unsigned packages to appear in a compose, you can do it by setting sigkeys to `["123", ""]`. - `results` - List of additional results which will be generated as part of a compose. Valid keys are: - `iso` - Generates non-installable ISO files with RPMs from a compose. diff --git a/common/odcs/common/types.py b/common/odcs/common/types.py index cc98d66..efff2e3 100644 --- a/common/odcs/common/types.py +++ b/common/odcs/common/types.py @@ -105,6 +105,8 @@ COMPOSE_FLAGS = { # For "pulp" source_type, ignore any repos do not exist in the remote Pulp # instance. "ignore_absent_pulp_repos": 32, + # Do not reuse old composes. + "no_reuse": 64, } INVERSE_COMPOSE_FLAGS = {v: k for k, v in COMPOSE_FLAGS.items()} diff --git a/docs/api.rst b/docs/api.rst index 1c79769..9c4a549 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -73,6 +73,7 @@ The fields used in the ODCS compose JSON have following meaning: - *ignore_absent_pulp_repos* - Ignore non-existing content sets in the source of Pulp compose. The source field on the compose will be updated to match what was actually used in the compose. - *check_deps* - Compose will fail if the RPM-level dependencies between packages in the compose are not satisfied. - *include_done_modules* - Compose can include also modules which are in the ``done`` state. By default, only modules in ``ready`` state are allowed to be included in a composes. + - *no_reuse* - Compose will be generated directly instead of trying to reuse old one. .. _koji_event: diff --git a/server/conf/pungi.conf b/server/conf/pungi.conf index 798ccdc..9ee3d67 100644 --- a/server/conf/pungi.conf +++ b/server/conf/pungi.conf @@ -86,6 +86,7 @@ pkgset_koji_scratch_tasks = [ ] {%- endif %} +pkgset_allow_reuse = config.pkgset_allow_reuse {%- if config.source_type_str in ["tag", "build"] and not config.packages %} # In case no package is requested, include all of them. diff --git a/server/odcs/server/backend.py b/server/odcs/server/backend.py index 97faac4..2a5e10e 100644 --- a/server/odcs/server/backend.py +++ b/server/odcs/server/backend.py @@ -472,6 +472,9 @@ def get_reusable_compose(compose): :param models.Compose compose: Instance of models.Compose. """ + if compose.flags & COMPOSE_FLAGS["no_reuse"]: + return None + # RAW_CONFIG composes cannot reuse other composes, we cannot track input # for them. if compose.source_type == PungiSourceType.RAW_CONFIG: @@ -972,13 +975,15 @@ def generate_pungi_compose(compose): pungi_cfg.gather_method = "nodeps" if compose.flags & COMPOSE_FLAGS["no_inheritance"]: pungi_cfg.pkgset_koji_inherit = False + if compose.flags & COMPOSE_FLAGS["no_reuse"]: + pungi_cfg.pkgset_allow_reuse = False koji_event = None if compose.source_type == PungiSourceType.KOJI_TAG: koji_event = compose.koji_event old_compose = None - if koji_tag_cache.is_cached(compose): + if pungi_cfg.pkgset_allow_reuse and koji_tag_cache.is_cached(compose): koji_tag_cache.reuse_cached(compose) old_compose = koji_tag_cache.cache_dir diff --git a/server/odcs/server/pungi.py b/server/odcs/server/pungi.py index 9217137..5fedc4e 100644 --- a/server/odcs/server/pungi.py +++ b/server/odcs/server/pungi.py @@ -251,6 +251,7 @@ class PungiConfig(BasePungiConfig): self.scratch_build_tasks = ( scratch_build_tasks.split(" ") if scratch_build_tasks else [] ) + self.pkgset_allow_reuse = True # Store results as list of strings, so it can be used by jinja2 # templates.