Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-render using conda-build 24.5 #352

Closed

Conversation

jakirkham
Copy link
Member

@jakirkham jakirkham commented Sep 26, 2024

We have had some issues with re-rendering recently ( #349 (comment) ). These appear to be due to the unresolvable FEEDSTOCK_ROOT value in this line at re-render time

- cp {{ os.environ["FEEDSTOCK_ROOT"] }}/LICENSE.txt ${RECIPE_DIR}/LICENSE.txt # [linux]

Here is the longer error message as seen from a re-rendering GHA job:

Traceback (most recent call last):
  File "/opt/conda/envs/cf-feedstock-ops/lib/python3.11/site-packages/conda_build/metadata.py", line 2003, in _get_contents
    rendered = template.render(environment=env)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/envs/cf-feedstock-ops/lib/python3.11/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/opt/conda/envs/cf-feedstock-ops/lib/python3.11/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/tmp/tmpzes4vsc5/conda-forge-ci-setup-feedstock/recipe/meta.yaml", line 24, in top-level template code
    - cp {{ os.environ["FEEDSTOCK_ROOT"] }}/LICENSE.txt ${RECIPE_DIR}/LICENSE.txt            # [linux]
^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.UndefinedError: 'os._Environ object' has no attribute 'FEEDSTOCK_ROOT'

We had tried re-rendering with conda-build versions 24.9 and 24.7 and still saw the issue. On a hunch tried 24.5 as that worked in other cases that saw similar errors ( conda-forge/conda-smithy#2011 )

This appears to work! 🎉

Which means this is likely coming from PR ( conda/conda-build#5371 ). So likely the answer is we need to update this recipe to handle the undefined variable better

In the interim this does re-render the feedstock and helps us better understand where the error first occurred

cc @beckermr


Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

@jakirkham jakirkham requested a review from a team as a code owner September 26, 2024 00:37
Copy link
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe/meta.yaml) and found it was in an excellent condition.

@beckermr
Copy link
Member

Thanks @jakirkham. I have looked at that PR over and over again and I cannot figure why the smithy rerendering behavior changed with it.

@jakirkham
Copy link
Member Author

Starting in conda-build 24.7.0 undefined Jinja values raise errors (when they wouldn't have before). This happens during conda-smithy re-rendering, but also during conda-build parsing. This is what we are seeing as the environment variable is undefined when re-rendering

@beckermr
Copy link
Member

Yes but the PR on conda-build you linked has undefined variables calling sys.exit which should have killed rerendering in 24.5. I think it must be something more subtle.

@jakirkham
Copy link
Member Author

🤷‍♂️ That was the cause when isolating a related issue: conda/conda-build#5458

@jakirkham
Copy link
Member Author

Closing in favor of PR: #350

@jakirkham jakirkham closed this Sep 26, 2024
@jakirkham jakirkham deleted the re-render_cb_24.5 branch September 26, 2024 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants