conda-smithy icon indicating copy to clipboard operation
conda-smithy copied to clipboard

CI configuration is created for the full matrix with complex skip: True

Open saraedum opened this issue 5 years ago • 1 comments

In some cases, a conditional skip: True leads to CI configuration to be generated even though conda-build will then immediately skip the build on that CI run. It would be nice if conda-smithy would omit these configurations in the first place.

Here is an example to reproduce; somewhat typical for the setup for which I am (abusing) conda-smithy:

$ cat conda-forge.yml # necessary due to https://github.com/conda-forge/conda-smithy/pull/1222
nothing: here
$ cat recipe/conda_build_config.yaml
name:
  - a
  - b
$ cat recipe/meta.yaml
{% set name = name or "noname" %}

package:
  name: {{ name }}
  version: 0

build:
  number: 0
  skip: True  # [name == 'a' and py != 37]
{%- if py != 37 %}
  skip: True  # [name == 'a']
{%- endif %}
{%- if name == 'a' %}
  skip: True  # [py != 37]
{%- endif %}
{%- if name == 'a' and py != 37 %}
  skip: True
{%- endif %}


requirements:
  host:
    - python
  run:
    - python

However, conda smithy rerender still creates .ci_support/linux_nameapython3.6.yaml.

saraedum avatar Jan 27 '20 12:01 saraedum

Just for the record, something like this fixes this:

@@ -428,6 +365,21 @@ def dump_subspace_config_files(
             filename_arch,
             package_key(config, top_level_loop_vars, metas[0].config.subdir),
         )
+
+        if not conda_build.api.render(
+            os.path.join(root_path, forge_config["recipe_dir"]),
+            platform=platform,
+            arch=arch,
+            ignore_system_variants=True,
+            variants=config,
+            permit_undefined_jinja=False,
+            finalize=True,
+            bypass_env_check=True,
+            channel_urls=forge_config.get("channels", {}).get("sources", []),
+            dirty=True,
+            ):
+            continue
+
         out_folder = os.path.join(root_path, ".ci_support")
         out_path = os.path.join(out_folder, config_name) + ".yaml"
         if not os.path.isdir(out_folder):

saraedum avatar Jun 27 '20 15:06 saraedum