Building podman image not correctly following symlinks?
rdbisme opened this issue · 3 comments
rdbisme commented
❯ molecule --version
molecule 24.9.0 using python 3.12
ansible:2.17.5
azure:23.5.3 from molecule_plugins
containers:23.5.3 from molecule_plugins requiring collections: ansible.posix>=1.3.0 community.docker>=1.9.1 containers.podman>=1.8.1
default:24.9.0 from molecule
docker:23.5.3 from molecule_plugins requiring collections: community.docker>=3.4.11 ansible.posix>=1.4.0
ec2:23.5.3 from molecule_plugins
gce:23.5.3 from molecule_plugins requiring collections: google.cloud>=1.0.2 community.crypto>=1.8.0
openstack:23.5.3 from molecule_plugins requiring collections: openstack.cloud>=2.1.0
podman:23.5.3 from molecule_plugins requiring collections: containers.podman>=1.7.0 ansible.posix>=1.3.0
vagrant:23.5.3 from molecule_plugins
When molecule tries to build the docker image with podman, and the molecule context contains symlinks, it fails with:
FAILED - RETRYING: [localhost]: Build an Ansible compatible image (1 retries left).Result was: {
"attempts": 3,
"changed": false,
"invocation": {
"module_args": {
"arch": null,
"auth_file": null,
"build": {
"annotation": null,
"cache": true,
"container_file": null,
"extra_args": " ",
"file": "/home/rdb/.cache/molecule/extensions/default/Dockerfile_archlinux_latest",
"force_rm": false,
"format": "oci",
"rm": true,
"target": null,
"volume": null
},
"ca_cert_dir": null,
"executable": "podman-remote",
"force": false,
"name": "molecule_local/archlinux:latest",
"password": null,
"path": "/home/rdb/git/dotfiles/roles/starship/extensions/molecule/default",
"pull": true,
"pull_extra_args": null,
"push": false,
"push_args": {
"compress": null,
"dest": null,
"extra_args": null,
"format": null,
"remove_signatures": null,
"sign_by": null,
"transport": null
},
"quadlet_dir": null,
"quadlet_filename": null,
"quadlet_options": null,
"state": "present",
"tag": "latest",
"username": null,
"validate_certs": null
}
},
"msg": "Failed to build image molecule_local/archlinux:latest: Error: invalid symlink \"/var/tmp/libpod_builder1834532180/build/molecule.yml\" -> \"../../../../../extensions/molecule/default/molecule.yml\"\n",
"retries": 4
}
This is the tree of my project:
❯ tree ../../../
../../../
├── ansible.cfg
├── extensions
│ └── molecule
│ └── default
│ ├── Dockerfile.j2
│ ├── molecule.yml
│ └── prepare.yml
├── hosts
├── poetry.lock
├── pyproject.toml
├── README.md
├── requirements.yml
└── roles
└── starship
├── defaults
│ └── main.yml
├── extensions
│ └── molecule
│ ├── default
│ │ ├── converge.yml
│ │ ├── Dockerfile.j2
│ │ ├── molecule.yml -> ../../../../../extensions/molecule/default/molecule.yml
│ │ ├── prepare.yml -> ../../../../../extensions/molecule/default/prepare.yml
│ │ └── verify.yml
│ └── rootless
│ ├── converge.yml
│ ├── Dockerfile.j2 -> ../../../../../extensions/molecule/default/Dockerfile.j2
│ ├── molecule.yml -> ../../../../../extensions/molecule/default/molecule.yml
│ ├── prepare.yml -> ../../../../../extensions/molecule/default/prepare.yml
│ └── verify.yml
├── handlers
│ └── main.yml
├── meta
│ └── main.yml
├── README.md
├── tasks
│ ├── main.yml
│ ├── rootless.yml
│ └── root.yml
├── tests
│ ├── inventory
│ └── test.yml
└── vars
└── main.yml
❯ cat molecule/default/molecule.yml
---
driver:
name: podman
platforms:
- name: instance
image: archlinux:latest
pre_build_image: false
dockerfile: Dockerfile.j2
provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ../../../..
inventory:
group_vars:
all:
ansible_user: rdb
lint: |
set -e
yamllint .
ansible-lint .
rdbisme commented
If I replace the symlinks with the actual files it works.
rdbisme commented
This seems a bug with https://github.com/containers/ansible-podman-collections
rdbisme commented
Ok, this is an expected behaviour of docker / podman build not following symlinks outside of context.
Sorry for the noise.