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

Fix upgrade and migration tests #588

Merged
merged 4 commits into from
Sep 4, 2024
Merged

Conversation

hhorak
Copy link
Member

@hhorak hhorak commented Sep 3, 2024

Kept in a singe PR because all changes are related to the upgrade and migration tests (except the /var/run/ -> /run/ change that was necessary to make the image build at all):

  1. Remove scl check that makes upgrade not working

The SCL should be NOOP in RHEL8+, but due to wrong check of VERSION_ID -lt 8, which does not evaluate correctly when VERSION_ID is '9.4', the paths are incorrectly set to /opt... in some versions of RHEL, not in Fedora.

  1. Be more cautious about what images to pull

This is rather improvement to not try pulling images that do not exist. The set is different on different distro versions, so let's not let docker pull fail, instead be more cautious about what versions we actually expect to exist.

  1. Fix pagila RPM url

Previous epel7 mirror URL does not work after RHEL7 EOL, but the same RPM is still available in koji. A test for a correct download should hopefully make the download failure easier to debug in the future.

  1. Wait patiently for the server start

The check functions did not actually wait when the first podman exec failed, so in case the server was not up soon, the check failed too early. It is ok to wait for the server a bit, so let's repeat the podman exec with psql until it succeeds or 30s pass.

The SCL should be NOOP in RHEL8+, but due to wrong check of
VERSION_ID -lt 8, which does not evaluate correctly when
VERSION_ID is '9.4', the paths are incorrectly set to /opt...
in some versions of RHEL, not in Fedora.
@hhorak
Copy link
Member Author

hhorak commented Sep 3, 2024

[test]

The set is different on different distro versions, so let's not let docker pull
fail, instead be more cautious about what versions we actually expect to exist.
@hhorak
Copy link
Member Author

hhorak commented Sep 3, 2024

[test]

@hhorak
Copy link
Member Author

hhorak commented Sep 4, 2024

[test]

Previous epel7 mirror URL does not work after RHEL7 EOL, but the same
RPM is still available in koji. A test for a correct download should
hopefully make the download failure easier to debug in the future.

The check functions did not actually wait when the first podman exec
failed, so in case the server was not up soon, the check failed too
early. It is ok to wait for the server a bit, so let's repeat the
podman exec with psql until it succeeds or 30s pass.
@hhorak
Copy link
Member Author

hhorak commented Sep 4, 2024

[test]

@hhorak hhorak changed the title Remove scl check Fix upgrade and migration tests Sep 4, 2024
@hhorak
Copy link
Member Author

hhorak commented Sep 4, 2024

A comment about pagila - we should rather download directly from github (issue to be created).

Copy link
Member

@phracek phracek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome fix. Please create an issue for closing pagila instead of downloading RPM.

LGTM. Rewards will be sent soon.

@hhorak
Copy link
Member Author

hhorak commented Sep 4, 2024

A comment about pagila - we should rather download directly from github (issue to be created).

Reported as #589

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I don't think this is a good idea long term (and why the separate issue was created) is that since we are linking to a specific version on the repository that is not supported anymore, the link can stop working anytime.

Silently missing, this is resolved with the check that the download succeeded, which is a great addition!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have mentioned this change in the Google doc to keep it updated.

Copy link
Contributor

@SlouchyButton SlouchyButton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work

@phracek phracek merged commit b7f073f into sclorg:master Sep 4, 2024
16 checks passed
bdunne added a commit to bdunne/container-postgresql that referenced this pull request Oct 28, 2024
sclorg/postgresql-container#588
https://gitlab.com/redhat/centos-stream/rpms/postgresql/-/commit/ced30efb935315a3ac323a526671010d6a50f1d7
ERROR:
  pkgconf-pkg-config-1.7.3-10.el9.x86_64
  postgresql-13.16-1.el9.x86_64
  postgresql-contrib-13.16-1.el9.x86_64
  postgresql-private-libs-13.16-1.el9_4.x86_64
  postgresql-server-13.16-1.el9.x86_64
  protobuf-c-1.3.3-13.el9.x86_64
  setup-2.13.7-10.el9.noarch
  shadow-utils-2:4.9-9.el9.x86_64
  uuid-1.6.2-55.el9.x86_64

Complete!
Found VERSION 13
Last metadata expiration check: 0:00:12 ago on Mon Oct 28 15:14:16 2024.
Dependencies resolved.
================================================================================
 Package       Architecture  Version             Repository                Size
================================================================================
Reinstalling:
 tzdata        noarch        2024a-1.el9         ubi-9-baseos-rpms        842 k

Transaction Summary
================================================================================

Total download size: 842 k
Installed size: 1.6 M
Downloading Packages:
tzdata-2024a-1.el9.noarch.rpm                   5.1 MB/s | 842 kB     00:00
--------------------------------------------------------------------------------
Total                                           5.0 MB/s | 842 kB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Reinstalling     : tzdata-2024a-1.el9.noarch                              1/2
  Cleanup          : tzdata-2024a-1.el9.noarch                              2/2
  Verifying        : tzdata-2024a-1.el9.noarch                              1/2
  Verifying        : tzdata-2024a-1.el9.noarch                              2/2

Reinstalled:
  tzdata-2024a-1.el9.noarch

Complete!
47 files removed
fixing permissions on '/var/lib/pgsql' directory
/usr/libexec/fix-permissions: Error: no such directory '/var/run/postgresql'

Usage: /usr/libexec/fix-permissions [--read-only] DIR [DIR ..]

Recursively fix permissions on the given directories to allow GID=0
read/write regular files and read/write/execute directories.

To run this command, you have to be in the group root=0!
Error: building at STEP "RUN dnf -y --disableplugin=subscription-manager --setopt=tsflags=nodocs update &&     (dnf info postgresql-server);     if [ $? == 1 ]; then       ARCH=$(uname -m) &&       dnf -y --setopt=protected_packages= remove redhat-release &&       dnf -y remove *subscription-manager* &&       dnf -y install         http://mirror.stream.centos.org/9-stream/BaseOS/${ARCH}/os/Packages/centos-stream-release-9.0-24.el9.noarch.rpm         http://mirror.stream.centos.org/9-stream/BaseOS/${ARCH}/os/Packages/centos-stream-repos-9.0-24.el9.noarch.rpm         http://mirror.stream.centos.org/9-stream/BaseOS/${ARCH}/os/Packages/centos-gpg-keys-9.0-24.el9.noarch.rpm &&       dnf clean all &&       rm -rf /var/cache/dnf;     fi &&     { yum -y module enable postgresql:13 || :; } &&     INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" &&     yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS &&     rpm -V $INSTALL_PKGS &&     postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" &&     (yum -y reinstall tzdata || yum -y update tzdata ) &&     yum -y clean all --enablerepo='*' &&     localedef -f UTF-8 -i en_US en_US.UTF-8 &&     chmod -R g+w /etc/pki/tls &&     test "$(id postgres)" = "uid=26(postgres) gid=26(postgres) groups=26(postgres)" &&     mkdir -p /var/lib/pgsql/data &&     /usr/libexec/fix-permissions /var/lib/pgsql /var/run/postgresql": while running runtime: exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants