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

Quadlet [build] generates invalid Pull command lines #24599

Open
nerdroychan opened this issue Nov 18, 2024 · 4 comments · May be fixed by #24643
Open

Quadlet [build] generates invalid Pull command lines #24599

nerdroychan opened this issue Nov 18, 2024 · 4 comments · May be fixed by #24643
Labels
5.3 kind/bug Categorizes issue or PR as related to a bug. quadlet regression

Comments

@nerdroychan
Copy link

Issue Description

When applying Pull=... option in [build] section via quadlet, the generated command line has the format --pull ... format instead of --pull=... format, which is supposedly not supported by buildah.

Currently, I have to use PodmanArgs=--pull=... to avoid this issue.

Steps to reproduce the issue

  1. Create a .build file with Pull=newer (newer is a valid pull policy), in rootless podman.
  2. Reload systemd user daemon and run systemctl --user show -pExecStart for the generated build unit.

Describe the results you received

The generated ExecStart command is --pull newer instead of --pull=newer, which causes ambiguity in parsing.

Describe the results you expected

The generated command should be --pull=newer.

Since podman build also supports --pull as a bare key, I am not sure how to support this in a quadlet file.

podman info output

host:
  arch: amd64
  buildahVersion: 1.38.0
  cgroupControllers:
  - cpu
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-1:2.1.12-1
    path: /usr/bin/conmon
    version: 'conmon version 2.1.12, commit: e8896631295ccb0bfdda4284f1751be19b483264'
  cpuUtilization:
    idlePercent: 99.82
    systemPercent: 0.06
    userPercent: 0.12
  cpus: 22
  databaseBackend: sqlite
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  freeLocks: 2038
  hostname: hq
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 10000
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 10000
      size: 1
    - container_id: 1
      host_id: 165536
      size: 65536
  kernel: 6.6.61-1-lts
  linkmode: dynamic
  logDriver: journald
  memFree: 124850552832
  memTotal: 134954811392
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.13.1-1
      path: /usr/lib/podman/aardvark-dns
      version: aardvark-dns 1.13.1
    package: netavark-1.13.0-1
    path: /usr/lib/podman/netavark
    version: netavark 1.13.0
  ociRuntime:
    name: crun
    package: crun-1.18.2-1
    path: /usr/bin/crun
    version: |-
      crun version 1.18.2
      commit: 00ab38af875ddd0d1a8226addda52e1de18339b5
      rundir: /run/user/10000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-2024_10_30.ee7d0b6-1
    version: |
      pasta 2024_10_30.ee7d0b6
      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: true
    path: /run/user/10000/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: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 17179865088
  swapTotal: 17179865088
  uptime: 23h 57m 55.00s (Approximately 0.96 days)
  variant: ""
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries: {}
store:
  configFile: ~/.config/containers/storage.conf
  containerStore:
    number: 9
    paused: 0
    running: 9
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: ~/.local/share/containers/storage
  graphRootAllocated: 3838601478144
  graphRootUsed: 321813139456
  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: 23
  runRoot: /run/user/10000/containers
  transientStore: false
  volumePath: ~/.local/share/containers/storage/volumes
version:
  APIVersion: 5.3.0
  Built: 1731771105
  BuiltTime: Sat Nov 16 09:31:45 2024
  GitCommit: 874bf2c301ecf0ba645f1bb45f81966cc755b7da
  GoVersion: go1.23.3
  Os: linux
  OsArch: linux/amd64
  Version: 5.3.0

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@nerdroychan nerdroychan added the kind/bug Categorizes issue or PR as related to a bug. label Nov 18, 2024
@Luap99 Luap99 added the quadlet label Nov 18, 2024
@ygalblum
Copy link
Contributor

Thanks for reporting this. You are correct. I'm looking into what is the correct way to address this in the code

@Luap99
Copy link
Member

Luap99 commented Nov 21, 2024

Looks like the underlying root cause is spf13/cobra#866
Any option using NoOptDefVal cannot be specified as --opt value, this regression seems to be caused by fc25a3a.

I think we need to handle the podman build --pull flag extra. In particular because podman create/run --pull works differently confusingly...

@ygalblum
Copy link
Contributor

Yes you are correct on both counts. I was trying to see if I can find a solution that does not need to single out this parameter from the rest. But, not sure that I can.

The root cause of the difference between create/run and build is that the formers define this flag on their own while the latter copies it from buildah. buildah defines the same default value twice, if --pull does not appear or appears without a value (the latter triggering the issue). I guess this is for backward compatibility, otherwise, I don't see why would anyone need to add --pull in order to set the value to its default value.

I was wondering whether the fix should be in podman build (that is remove the value in NoOptDefVal). But, I guess that, again for backward compatibility, we'll need to change Quadlet.

WDYT?

@Luap99
Copy link
Member

Luap99 commented Nov 21, 2024

I was wondering whether the fix should be in podman build (that is remove the value in NoOptDefVal). But, I guess that, again for backward compatibility, we'll need to change Quadlet.

Yes I think we must keep it for backwards compat for now so we must split this out and handle it extra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.3 kind/bug Categorizes issue or PR as related to a bug. quadlet regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants