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

maintenance: update & fix CI, bump python >=3.8, bump postgresql >= 12 #71

Merged
merged 6 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions .zuul.d/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
- github.com/ansible-community/ara
- github.com/ansible-community/ara-collection
- name: github.com/ansible/ansible
override-checkout: stable-2.13
override-checkout: stable-2.16
pre-run: tests/zuul_pre_multinode_networking.yaml

- job:
name: ara-role-api-postgresql
parent: ara-role-database-backends
nodeset: ara-database-server-multinode
description: |
Deploys the ARA API server on Fedora 36 as well as CentOS Stream 8/9
Deploys the ARA API server on Fedora 39 as well as CentOS Stream 8/9
and tests it against a central PostgreSQL server installed on CentOS Stream 9.
The job exercises the ara_api Ansible role, the ARA Ansible plugins, the
ARA API clients as well as the API itself.
Expand All @@ -56,7 +56,7 @@
parent: ara-role-database-backends
nodeset: ara-database-server-multinode
description: |
Deploys the ARA API server on Fedora 36 as well as CentOS Stream 8/9
Deploys the ARA API server on Fedora 39 as well as CentOS Stream 8/9
and tests it against a central MySQL server installed on CentOS Stream 9.
The job exercises the ara_api Ansible role, the ARA Ansible plugins, the
ARA API clients as well as the API itself.
Expand All @@ -68,7 +68,7 @@
parent: ara-role-database-backends
nodeset: ara-multinode
description: |
Deploys the ARA API server on Fedora 36 as well as CentOS Stream 8/9
Deploys the ARA API server on Fedora 39 as well as CentOS Stream 8/9
and tests it using the distributed sqlite database backend.
run: tests/with_distributed_sqlite.yaml

Expand All @@ -77,7 +77,7 @@
parent: ara-role-integration-base
nodeset: ara-multinode
description: |
Deploys the ARA API server on Fedora 36 as well as CentOS Stream 8/9
Deploys the ARA API server on Fedora 39 as well as CentOS Stream 8/9
and tests it running gunicorn with nginx in front managing external
authentication.
The job exercises the ara_api and ara_frontend_nginx Ansible roles, the
Expand All @@ -90,7 +90,7 @@
parent: ara-role-integration-base
nodeset: ara-multinode
description: |
Deploys the ARA API server on Fedora 36 as well as CentOS Stream 8/9
Deploys the ARA API server on Fedora 39 as well as CentOS Stream 8/9
and tests it running gunicorn with nginx in front managing external
authentication with client certificates.
The job exercises the ara_api and ara_frontend_nginx Ansible roles, the
Expand All @@ -103,7 +103,7 @@
- job:
name: ara-role-api-fedora-packages
parent: ara-role-integration-base
nodeset: ara-fedora-36
nodeset: ara-fedora-39
description: |
Deploys the ARA API server on Fedora 36 using distribution packages for
ARA and Ansible.
Expand Down
31 changes: 11 additions & 20 deletions .zuul.d/nodesets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
name: ara-database-server-multinode
nodes:
- name: database-server
label: ansible-cloud-centos-9-stream-tiny
- name: fedora-36
label: ansible-cloud-fedora-36-tiny
label: cloud-centos-9-stream
- name: fedora-39
label: cloud-fedora-39
- name: centos-stream-9
label: ansible-cloud-centos-9-stream-tiny
label: cloud-centos-9-stream
- name: centos-stream-8
label: ansible-cloud-centos-8-stream-tiny
label: cloud-centos-8-stream
# TODO: lacking ubuntu/debian testing coverage because there is no ubuntu image in CI
#- name: ubuntu-bionic
# label: ubuntu-bionic-1vcpu
Expand All @@ -20,7 +20,7 @@
- database-server
- name: ara-api-server
nodes:
- fedora-36
- fedora-39
- centos-stream-9
- centos-stream-8
# - ubuntu-bionic
Expand All @@ -30,29 +30,20 @@
- nodeset:
name: ara-multinode
nodes:
- name: fedora-36
label: ansible-cloud-fedora-36-tiny
- name: fedora-39
label: cloud-fedora-39
- name: centos-stream-9
label: ansible-cloud-centos-9-stream-tiny
label: cloud-centos-9-stream
- name: centos-stream-8
label: ansible-cloud-centos-8-stream-tiny
label: cloud-centos-8-stream
# TODO: lacking ubuntu/debian testing coverage because there is no ubuntu image in CI
#- name: ubuntu-bionic
# label: ubuntu-bionic-1vcpu
groups:
- name: ara-api-server
nodes:
- fedora-36
- fedora-39
- centos-stream-9
- centos-stream-8
# - ubuntu-bionic

- nodeset:
name: ara-fedora-36
nodes:
- name: fedora-36
label: ansible-cloud-fedora-36-tiny
groups:
- name: ara-api-server
nodes:
- fedora-36
2 changes: 1 addition & 1 deletion roles/ara_api/tasks/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
- name: Generate a random secret key
environment:
PATH: "{{ path_with_virtualenv }}"
command: python3 -c "from django.utils.crypto import get_random_string; print(get_random_string(length=50))"
command: "{{ ara_api_python_command }} -c 'from django.utils.crypto import get_random_string; print(get_random_string(length=50))'"
no_log: "{{ ara_api_secure_logging }}"
register: generated_key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
name: mysqlclient
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"

- name: Run SQL migrations
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@
Install the following packages before running this role again
{{ _postgresql_missing_packages | join(' ') }}

# Django requires psycopg2 when using postgresql
# https://docs.djangoproject.com/en/2.2/ref/databases/#postgresql-notes
# Django requires psycopg2 (or psycopg3) when using postgresql
# https://docs.djangoproject.com/en/5.0/releases/4.2/#psycopg-3-support
# TODO: Consider psycopg3: https://github.com/ansible-community/ara-collection/issues/73
- name: Ensure psycopg2 is installed
pip:
# Pin psycopg2 until we upgrade to django 3.2 LTS
# https://github.com/ansible-community/ara/issues/320
name: psycopg2<2.9
name: psycopg2
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"

- name: Run SQL migrations
environment:
Expand Down
4 changes: 2 additions & 2 deletions roles/ara_api/tasks/install/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
state: "{{ (ara_api_version == 'latest') | ternary('latest', 'present') }}"
version: "{{ (ara_api_version != 'latest') | ternary(ara_api_version, omit) }}"
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"
notify: restart ara-api

- name: Install python-passlib for managing authentication credentials
pip:
name: passlib
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"
when: ara_api_external_auth

- name: Prefix the virtualenv bin directory to PATH
Expand Down
4 changes: 2 additions & 2 deletions roles/ara_api/tasks/install/source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
name: "{{ ara_api_source_checkout }}[server]"
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"

- name: Install python-passlib for managing authentication credentials
pip:
name: passlib
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"
when: ara_api_external_auth

- name: Prefix the virtualenv bin directory to PATH
Expand Down
2 changes: 1 addition & 1 deletion roles/ara_api/tasks/pre-requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# The ansible_python_version fact might end up retrieving the version of
# python2 so we need to explicitely get the version of python 3 available.
- name: Validate availability of Python 3.5
command: /usr/bin/python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'
command: "{{ ara_api_python_command }} -c 'import sys; print(\".\".join(map(str, sys.version_info[:2])))'"
changed_when: false
failed_when: false
register: python_version
Expand Down
2 changes: 1 addition & 1 deletion roles/ara_api/tasks/wsgi_server/gunicorn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
name: gunicorn
state: present
virtualenv: "{{ ara_api_venv | bool | ternary(ara_api_venv_path, omit) }}"
virtualenv_command: /usr/bin/python3 -m venv
virtualenv_command: "{{ ara_api_python_command }} -m venv"

- name: Get path to gunicorn
command: which gunicorn
Expand Down
8 changes: 5 additions & 3 deletions roles/ara_api/vars/CentOS_8.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ ara_distribution_packages: []
# but we want to use the non-system one. Install it if it's missing.
ara_api_required_packages:
- git
- python36
- python39
- policycoreutils-python-utils
# cronie provides crontab
- cronie

ara_api_postgresql_packages:
- postgresql
- postgresql-devel
- python36-devel
- python39-devel
- gcc

ara_api_mysql_packages:
- mariadb
- mariadb-connector-c-devel
- redhat-rpm-config
- python36-devel
- python39-devel
- gcc

ara_api_python_command: /usr/bin/python3.9
2 changes: 2 additions & 0 deletions roles/ara_api/vars/CentOS_9.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ ara_api_mysql_packages:
- redhat-rpm-config
- python3-devel
- gcc

ara_api_python_command: /usr/bin/python3
2 changes: 2 additions & 0 deletions roles/ara_api/vars/Fedora.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ ara_api_mysql_packages:
- redhat-rpm-config
- python3-devel
- gcc

ara_api_python_command: /usr/bin/python3
2 changes: 2 additions & 0 deletions roles/ara_api/vars/Ubuntu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ ara_api_mysql_packages:
- libmariadbclient-dev
- python3-dev
- gcc

ara_api_python_command: /usr/bin/python3
2 changes: 1 addition & 1 deletion tests/vars/postgresql_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ ara_api_configure_cron: true
# The host is defined dynamically based on the address of the database server
# ara_api_database_host: 127.0.0.1
_postgresql_container_name: ara-postgresql-tests
_postgresql_image_name: docker.io/postgres:10
_postgresql_image_name: docker.io/postgres:12