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

Unable to deploy with latest version of Jinja2 #842

Open
5 tasks
dacook opened this issue Nov 8, 2022 · 2 comments
Open
5 tasks

Unable to deploy with latest version of Jinja2 #842

dacook opened this issue Nov 8, 2022 · 2 comments

Comments

@dacook
Copy link
Member

dacook commented Nov 8, 2022

Description

We have an old version of Ansible which is no longer supported (v2.9 was EOL in May 2022). I think it is incompatible with the latest version of Jinja2, which cause issues for me when trying to deploy (see below).

Expected Behavior

The playbook works without errors or warnings

Actual Behaviour

[WARNING]: Skipping plugin (/Users/xxx/.pyenv/versions/3.8.2/envs/xxx/lib/python3.8/site-
packages/ansible/plugins/filter/core.py) as it seems to be invalid: cannot import name 'environmentfilter' from
'jinja2.filters' (/Users/xxx/.pyenv/versions/3.8.2/envs/xxx/lib/python3.8/site-packages/jinja2/filters.py)

And also an error, causing the deployment to fail: `template error while templating string: No filter named 'b64decode'

The place it fails is here: https://github.com/openfoodfoundation/ofn-install/blob/master/roles/deploy/tasks/deploy.yml#L44

Similar to: https://gitlab.com/dreamer-labs/libraries/jinja2-ansible-filters/-/merge_requests/15

Steps to Reproduce

pip install -r requirements.txt # Currently Ansible 2.9
pip install --upgrade jinja2 # Currently 3.1.2
ansible-playbook --limit au-staging --extra-vars "git_version=v4.2.19" playbooks/deploy.yml

Workaround

For now, you can simply use an older version of Jinja2:

 pip install 'jinja2<3.1' --force-reinstall

Severity

bug-s5: we can live with it, only a few users impacted

Your Environment

In addition to above:

  • macOS 10.15
pyenv versions
  system
  3.8.2
  3.8.2/envs/ofn-install
* ofn-install (set by /Users/dcook/projects/ofn-install/.python-version)

Possible Fix

I think we should upgrade to a later version of Ansible. Strangely it has incremented 4 major versions in the last two years, so it might be worth trying step by step:

  • v2.10
  • v3
  • v4
  • v5
  • v6
@dacook
Copy link
Member Author

dacook commented Nov 8, 2022

The place that it's failing is here, which could probably be re-written much simpler to let rbenv read the .ruby-version file directly.
https://github.com/openfoodfoundation/ofn-install/blob/master/roles/deploy/tasks/deploy.yml#L44

But we use b64decode in another place, and there'd probably be errors elsewhere too.

@sigmundpetersen
Copy link
Contributor

Also looks similar to readthedocs/readthedocs.org#9038

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: All the things 💤
Development

No branches or pull requests

2 participants