From 466cd3902c109262e54c0c0434c5d9ea440b17fc Mon Sep 17 00:00:00 2001 From: Jay Faulkner Date: Tue, 1 Oct 2024 11:33:02 -0700 Subject: [PATCH] Remove postgresql testing and documentation Ironic has maintained a CI job for years after postresql support was deprecated in order to prevent unintentional breakage of that support. Now, we have confirmed evidence that other openstack components, such as keystone, required for testing this postgresql support no longer function in this job. As a result, ironic can no longer test postgresql support. Operators utilizing postgresql who have not yet migrated must migrate now. Change-Id: If6e4432b000996789346a1f7449410cfc8497fe1 --- bindep.txt | 6 --- devstack/files/bindep.txt | 4 -- doc/source/contributor/dev-quickstart.rst | 6 +-- doc/source/contributor/jobs-description.rst | 6 --- .../unit/db/sqlalchemy/test_migrations.py | 26 ++-------- .../postgres-removal-88f8b02dbfc3303c.yaml | 13 +++++ test-requirements.txt | 1 - tools/test-setup.sh | 50 ------------------- zuul.d/ironic-jobs.yaml | 13 ----- zuul.d/project.yaml | 2 - 10 files changed, 21 insertions(+), 106 deletions(-) create mode 100644 releasenotes/notes/postgres-removal-88f8b02dbfc3303c.yaml diff --git a/bindep.txt b/bindep.txt index 4da9b28a3a..a6c65af259 100644 --- a/bindep.txt +++ b/bindep.txt @@ -53,12 +53,6 @@ libssl-dev [platform:dpkg test] libffi-dev [platform:dpkg test] libffi-devel [platform:rpm test] # these are needed by infra for python-* jobs -libpq-dev [platform:dpkg test] -libpq-devel [platform:rpm test] -postgresql -postgresql-client [platform:dpkg] -# postgresql-devel [platform:rpm] -postgresql-server [platform:rpm] mariadb [platform:rpm] mariadb-server [platform:rpm platform:debian-bookworm] # mariadb-devel [platform:rpm] diff --git a/devstack/files/bindep.txt b/devstack/files/bindep.txt index e78ae98959..45b0737c77 100644 --- a/devstack/files/bindep.txt +++ b/devstack/files/bindep.txt @@ -55,10 +55,6 @@ libffi-devel [platform:rpm test] # these are needed by infra for python-* jobs libpq-dev [platform:dpkg test] libpq-devel [platform:rpm test] -postgresql -postgresql-client [platform:dpkg] -# postgresql-devel [platform:rpm] -postgresql-server [platform:rpm] mariadb [platform:rpm] mariadb-server [platform:rpm] # mariadb-devel [platform:rpm] diff --git a/doc/source/contributor/dev-quickstart.rst b/doc/source/contributor/dev-quickstart.rst index 824807a68a..e61042dde6 100644 --- a/doc/source/contributor/dev-quickstart.rst +++ b/doc/source/contributor/dev-quickstart.rst @@ -95,15 +95,15 @@ environment on most current distributions. - Ubuntu/Debian:: - sudo apt-get install build-essential python3-dev libssl-dev python3-pip libmysqlclient-dev libxml2-dev libxslt-dev libpq-dev git git-review libffi-dev gettext ipmitool psmisc graphviz libjpeg-dev qemu-utils + sudo apt-get install build-essential python3-dev libssl-dev python3-pip libmysqlclient-dev libxml2-dev libxslt-dev git git-review libffi-dev gettext ipmitool psmisc graphviz libjpeg-dev qemu-utils - RHEL/CentOS/Fedora:: - sudo dnf install python3-devel openssl-devel python3-pip mysql-devel libxml2-devel libxslt-devel postgresql-devel git git-review libffi-devel gettext ipmitool psmisc graphviz gcc libjpeg-turbo-devel qemu-img + sudo dnf install python3-devel openssl-devel python3-pip mysql-devel libxml2-devel libxslt-devel git git-review libffi-devel gettext ipmitool psmisc graphviz gcc libjpeg-turbo-devel qemu-img - openSUSE/SLE:: - sudo zypper install git git-review libffi-devel libmysqlclient-devel libopenssl-devel libxml2-devel libxslt-devel postgresql-devel python3-devel python-nose python3-pip gettext-runtime psmisc qemu-img + sudo zypper install git git-review libffi-devel libmysqlclient-devel libopenssl-devel libxml2-devel libxslt-devel python3-devel python-nose python3-pip gettext-runtime psmisc qemu-img To run the tests locally, it is a requirement that your terminal emulator supports unicode with the ``en_US.UTF8`` locale. If you use locale-gen to diff --git a/doc/source/contributor/jobs-description.rst b/doc/source/contributor/jobs-description.rst index 11ae873f9b..565993c532 100644 --- a/doc/source/contributor/jobs-description.rst +++ b/doc/source/contributor/jobs-description.rst @@ -111,9 +111,3 @@ The description of each jobs that runs in the CI when you submit a patch for * - bifrost-integration-redfish-vmedia-uefi-centos-9 - Tests the integration between Ironic and Bifrost using redfish vmedia and a dib image based on centos stream 9. - * - ironic-tempest-pxe_ipmitool-postgres - - Deploys Ironic in DevStack, configured to use tinyipa ramdisk partition - image with ``pxe`` boot and ``ipmi`` driver and postgres instead of mysql. - Runs tempest tests that match the regex - ``ironic_tempest_plugin.tests.scenario``, also deploys 1 virtual - baremetal. diff --git a/ironic/tests/unit/db/sqlalchemy/test_migrations.py b/ironic/tests/unit/db/sqlalchemy/test_migrations.py index 7b6b55aa4c..a97ae9f170 100644 --- a/ironic/tests/unit/db/sqlalchemy/test_migrations.py +++ b/ironic/tests/unit/db/sqlalchemy/test_migrations.py @@ -15,23 +15,14 @@ # under the License. """ -Tests for database migrations. There are "opportunistic" tests for both mysql -and postgresql in here, which allows testing against these databases in a -properly configured unit test environment. +Tests for database migrations. There are "opportunistic" tests for mysql in +here, which allow testing against a database in a properly configured unit +test environment. For the opportunistic testing you need to set up a db named 'openstack_citest' with user 'openstack_citest' and password 'openstack_citest' on localhost. -The test will then use that db and u/p combo to run the tests. - -For postgres on Ubuntu this can be done with the following commands: - -:: - - sudo -u postgres psql - postgres=# create user openstack_citest with createdb login password - 'openstack_citest'; - postgres=# create database openstack_citest with owner openstack_citest; - +The test will then use that db and u/p combo to run the tests. See +tools/test-setup.sh in the root of the repo for a full setup example. """ import collections @@ -1631,10 +1622,3 @@ class ModelsMigrationsSyncMysql(ModelsMigrationSyncMixin, test_fixtures.OpportunisticDBTestMixin, test_base.BaseTestCase): FIXTURE = test_fixtures.MySQLOpportunisticFixture - - -class ModelsMigrationsSyncPostgres(ModelsMigrationSyncMixin, - test_migrations.ModelsMigrationsSync, - test_fixtures.OpportunisticDBTestMixin, - test_base.BaseTestCase): - FIXTURE = test_fixtures.PostgresqlOpportunisticFixture diff --git a/releasenotes/notes/postgres-removal-88f8b02dbfc3303c.yaml b/releasenotes/notes/postgres-removal-88f8b02dbfc3303c.yaml new file mode 100644 index 0000000000..8a8f9c9d5f --- /dev/null +++ b/releasenotes/notes/postgres-removal-88f8b02dbfc3303c.yaml @@ -0,0 +1,13 @@ +--- +upgrade: + - | + Deployers using PostgreSQL must migrate to a supported mysql-compatible + database, such as MySQL or MariaDB. +deprecations: + - | + Use of postgresql has been deprecated for all OpenStack projects, + including ironic, for several years. However, in an effort to avoid + breaking existing installs, we had tested database migrations and + performed a basic functionality test against PostgreSQL. This test has + now been removed, and operators deployed on PostgreSQL must migrate to + a MySQL-compatible database, such as MySQL or MariaDB, before upgrade. diff --git a/test-requirements.txt b/test-requirements.txt index 772496f8fe..52e337a594 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,7 +6,6 @@ iso8601>=0.1.11 # MIT oslo.reports>=1.18.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 -psycopg2>=2.8.5 # LGPL/ZPL testtools>=2.5.0 # MIT WebTest>=2.0.27 # MIT pysnmp-lextudio>=5.0.0 # BSD diff --git a/tools/test-setup.sh b/tools/test-setup.sh index 9862ae4e0c..3f4c44edce 100755 --- a/tools/test-setup.sh +++ b/tools/test-setup.sh @@ -6,9 +6,6 @@ # Try starting mariadb sudo systemctl start mariadb || true -# Try starting postgresql -sudo postgresql-setup --initdb || true -sudo systemctl start postgresql || true # This setup needs to be run as a user that can run sudo. @@ -38,50 +35,3 @@ mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e " DROP DATABASE IF EXISTS openstack_citest; CREATE DATABASE openstack_citest CHARACTER SET utf8;" -# Same for PostgreSQL -# The root password for the PostgreSQL database; pass it in via -# POSTGRES_ROOT_PW. -DB_ROOT_PW=${POSTGRES_ROOT_PW:-insecure_slave} - -# Change working directory to a folder all users can access -# as psql on centos8 needs to be able to open the working directory -# which it can't when executed as the postgres user, which is required -# as same user as process for initial administrative authentication to -# the postgres database -cd /tmp - -# Identify and update the postgres hba file which can be in -# a version specific path. -PG_HBA=$(sudo -H -u postgres psql -t -c "show hba_file") -PG_CONF=$(sudo -H -u postgres psql -t -c "show config_file") - -# setup postgres encryption algorithm and authentication -sudo sed -i 's/ident$/scram-sha-256/g' $PG_HBA -sudo sed -i 's/md5$/scram-sha-256/g' $PG_HBA -sudo sed -i 's/^.*password_encryption =.*/password_encryption = scram-sha-256/' $PG_CONF - -sudo cat $PG_HBA -sudo cat $PG_CONF - -# restart postgres with new HBA file is loaded -sudo systemctl stop postgresql || true -sudo systemctl start postgresql || true - -# Setup user -root_roles=$(sudo -H -u postgres psql -t -c " - SELECT 'HERE' from pg_roles where rolname='$DB_USER'") -if [[ ${root_roles} == *HERE ]];then - sudo -H -u postgres psql -c "ALTER ROLE $DB_USER WITH SUPERUSER LOGIN PASSWORD '$DB_PW'" -else - sudo -H -u postgres psql -c "CREATE ROLE $DB_USER WITH SUPERUSER LOGIN PASSWORD '$DB_PW'" -fi - -# Store password for tests -cat << EOF > $HOME/.pgpass -*:*:*:$DB_USER:$DB_PW -EOF -chmod 0600 $HOME/.pgpass - -# Now create our database -psql -h 127.0.0.1 -U $DB_USER -d postgres -c "DROP DATABASE IF EXISTS openstack_citest" -createdb -h 127.0.0.1 -U $DB_USER -l C -T template0 -E utf8 openstack_citest diff --git a/zuul.d/ironic-jobs.yaml b/zuul.d/ironic-jobs.yaml index 26c76918b3..dc3a1b0a88 100644 --- a/zuul.d/ironic-jobs.yaml +++ b/zuul.d/ironic-jobs.yaml @@ -421,19 +421,6 @@ ironic-inspector: True ironic-inspector-dhcp: True -- job: - name: ironic-tempest-pxe_ipmitool-postgres - description: ironic-tempest-pxe_ipmitool-postgres - parent: ironic-base - vars: - devstack_localrc: - IRONIC_ENABLED_BOOT_INTERFACES: "fake,pxe" - IRONIC_IPXE_ENABLED: False - IRONIC_AUTOMATED_CLEAN_ENABLED: False - devstack_services: - mysql: False - postgresql: True - # NOTE(rpittau): converted job but not running for now as there # could be an issue with the lookup in ironic-python-agent - job: diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 78d0444678..4ce1fa1f79 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -64,8 +64,6 @@ voting: false - bifrost-integration-redfish-vmedia-uefi-centos-9: voting: false - - ironic-tempest-pxe_ipmitool-postgres: - voting: false gate: jobs: - ironic-tox-unit-mysql-migrations