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

tests: run podman directly instead of using containers.podman #196

Merged

Conversation

ptoscano
Copy link
Collaborator

@ptoscano ptoscano commented Aug 6, 2024

Using the containers.podman collection to handle podman is a nice idea, however what that collection supports now is becoming more strict than what this role supports. Case in point: containers.podman now requires Python 3.6+ for the managed nodes, which breaks the testing of EL 7.

This means that sadly the setup of a self-deployed Candlepin needs to run podman commands manually; use the proper parameters for podman run depending on the OS.

The gymnastics of checking the return code & stderr of podman stop are needed because the --ignore option (which would be ideal) was introduced in podman 1.7.0, and EL 7 has podman 1.6.4.

There is no behaviour change.

@ptoscano ptoscano requested a review from richm as a code owner August 6, 2024 04:38
@ptoscano ptoscano force-pushed the tests-using-podman-directly branch from 6f61196 to 1464a36 Compare August 6, 2024 04:41
@ptoscano
Copy link
Collaborator Author

ptoscano commented Aug 6, 2024

[citest]

@ptoscano ptoscano force-pushed the tests-using-podman-directly branch from 1464a36 to 81d6117 Compare August 6, 2024 12:00
@ptoscano
Copy link
Collaborator Author

ptoscano commented Aug 6, 2024

[citest]

@ptoscano ptoscano force-pushed the tests-using-podman-directly branch from 81d6117 to 5851d27 Compare August 6, 2024 12:24
@ptoscano
Copy link
Collaborator Author

ptoscano commented Aug 6, 2024

[citest]

@ptoscano ptoscano force-pushed the tests-using-podman-directly branch from 5851d27 to 0ea8c9e Compare August 6, 2024 12:45
@ptoscano
Copy link
Collaborator Author

ptoscano commented Aug 6, 2024

[citest]

@richm
Copy link
Contributor

richm commented Aug 6, 2024

Another way to dynamically construct lists in an assignment statement where you want to omit some of the elements is like this:

    - name: Start Candlepin container
      command:
        argv:
          "{{ podman_run_cli }}"
      changed_when: false
      vars:
        podman_run_cli: [podman, run, --rm, --detach, --hostname, candlepin_host, --name, candlepin, --publish,
                                        8443:8443, --publish, 8080:8080] +
                                        {{ ['--privileged'] if (ansible_distribution in ['CentOS', 'RedHat']
                                            and ansible_distribution_major_version | int < 8)
                                            else [] }} + [ghcr.io/ptoscano/candlepin-unofficial]

Yes, it uses the "json" style of list definition, but I prefer readability to strict adherence of Ansible guidelines

hmm - the indentation is way off - maybe github is auto-indenting something?

Using the containers.podman collection to handle podman is a nice idea,
however what that collection supports now is becoming more strict than
what this role supports. Case in point: containers.podman now requires
Python 3.6+ for the managed nodes, which breaks the testing of EL 7.

This means that sadly the setup of a self-deployed Candlepin needs to
run podman commands manually; use the proper parameters for "podman run"
depending on the OS.

The gymnastics of checking the return code & stderr of "podman stop"
are needed because the "--ignore" option (which would be ideal) was
introduced in podman 1.7.0, and EL 7 has podman 1.6.4.

There is no behaviour change.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
@ptoscano ptoscano force-pushed the tests-using-podman-directly branch from 0ea8c9e to 9a509b5 Compare August 6, 2024 17:06
@ptoscano
Copy link
Collaborator Author

ptoscano commented Aug 6, 2024

[citest]

@ptoscano ptoscano merged commit 84bc6d1 into linux-system-roles:main Aug 7, 2024
23 of 25 checks passed
@ptoscano ptoscano deleted the tests-using-podman-directly branch August 7, 2024 02:43
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.

3 participants