containers / ansible-podman-collections

Repository for Ansible content that can include playbooks, roles, modules, and plugins for use with the Podman tool
GNU General Public License v3.0
264 stars 142 forks source link

Unaddressed feedback in PR #811 (Trigger a new image build when we detect that the Containerfile has changed) #849

Closed SkrrtBacharach closed 6 days ago

SkrrtBacharach commented 6 days ago

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

I recently authored PR #811. I was trying to address all feedback items on the PR, but I had trouble with one specific feedback item: https://github.com/containers/ansible-podman-collections/pull/811#discussion_r1771980835ed . I couldn't figure out why this line causes a test failure, as it seems like it should work. Unfortunately, the PR was merged before this could be resolved, so I'm logging an issue for visibility.

Steps to reproduce the issue:

  1. See https://github.com/containers/ansible-podman-collections/pull/811#discussion_r1771980835 Describe the results you received:

  2. See https://github.com/containers/ansible-podman-collections/pull/811#discussion_r1771980835

Describe the results you expected:

  1. I expected the change not to cause any test failure.

Additional information you deem important (e.g. issue happens only occasionally):

Version of the containers.podman collection: Either git commit if installed from git: git show --summary Or version from ansible-galaxy if installed from galaxy: ansible-galaxy collection list | grep containers.podman

commit ec02a05e52ce73c30c485bd8b726d5aaab0cbe49 (HEAD -> idempotency-with-containerfile-hashing, origin/idempotency-with-containerfile-hashing)
Author: gw <gw@bob.lol>
Date:   Mon Sep 23 20:00:31 2024 +0100

    Fix return type issues from PR feedback

    Signed-off-by: gw <gw@bob.lol>

Output of ansible --version:

(molecule-plugins) gw@jorts podman:$ ansible --version
ansible [core 2.17.0]
  config file = None
  configured module search path = ['/home/gw/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/gw/venvs/molecule-plugins/lib64/python3.12/site-packages/ansible
  ansible collection location = /home/gw/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/gw/venvs/molecule-plugins/bin/ansible
  python version = 3.12.6 (main, Sep  9 2024, 00:00:00) [GCC 14.2.1 20240801 (Red Hat 14.2.1-1)] (/home/gw/venvs/molecule-plugins/bin/python3)
  jinja version = 3.1.4
  libyaml = True

Output of podman version:

(molecule-plugins) gw@jorts podman:$ podman version
Client:       Podman Engine
Version:      5.2.2
API Version:  5.2.2
Go Version:   go1.22.6
Built:        Wed Aug 21 01:00:00 2024
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.37.2
  cgroupControllers:
  - cpu
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.12-2.fc40.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: '
  cpuUtilization:
    idlePercent: 97.12
    systemPercent: 0.73
    userPercent: 2.15
  cpus: 12
  databaseBackend: sqlite
  distribution:
    distribution: fedora
    version: "40"
  eventLogger: journald
  freeLocks: 2048
  hostname: jorts
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 524288
      size: 65536
  kernel: 6.10.10-200.fc40.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 12715896832
  memTotal: 16454254592
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.12.2-2.fc40.x86_64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.12.2
    package: netavark-1.12.2-1.fc40.x86_64
    path: /usr/libexec/podman/netavark
    version: netavark 1.12.2
  ociRuntime:
    name: crun
    package: crun-1.17-1.fc40.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.17
      commit: 000fa0d4eeed8938301f3bcf8206405315bc1017
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20240906.g6b38f07-1.fc40.x86_64
    version: |
      pasta 0^20240906.g6b38f07-1.fc40.x86_64
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: false
    path: /run/user/1000/podman/podman.sock
  rootlessNetworkCmd: pasta
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.2-2.fc40.x86_64
    version: |-
      slirp4netns version 1.2.2
      commit: 0ee2d87523e906518d34a6b423271e4826f71faf
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.5
  swapFree: 8589930496
  swapTotal: 8589930496
  uptime: 1h 22m 51.00s (Approximately 0.04 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
store:
  configFile: /home/gw/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/gw/.local/share/containers/storage
  graphRootAllocated: 1022420320256
  graphRootUsed: 44183838720
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 20
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /home/gw/.local/share/containers/storage/volumes
version:
  APIVersion: 5.2.2
  Built: 1724198400
  BuiltTime: Wed Aug 21 01:00:00 2024
  GitCommit: ""
  GoVersion: go1.22.6
  Os: linux
  OsArch: linux/amd64
  Version: 5.2.2

Package info (e.g. output of rpm -q podman or apt list podman):

podman-5.2.2-1.fc40.x86_64

Playbok you run with ansible (e.g. content of playbook.yaml):

See https://github.com/containers/ansible-podman-collections/pull/811#discussion_r1771980835

Command line and output of ansible run with high verbosity

Please NOTE: if you submit a bug about idempotency, run the playbook with --diff option, like:

See https://github.com/containers/ansible-podman-collections/pull/811#discussion_r1771980835ed

sshnaidm commented 6 days ago

In this case you can ignore my comment, the Labels has default value None, and not {} (which I'd expect), that's why it returns None:

>>> print({"a": None}.get("a"))
None

So using .get() or {} here is the right choice. Thanks for bringing it up!