Open treyd opened 6 years ago
Thanks for the report @treyd, quick fix is to allow this option for push
. I'll open a PR momentarily.
makes sense, thanks @marcusianlevine . Any idea why push
needs access to the roles? Or is that just the default conductor container behavior?
I believe push
needs access to the roles in order to ensure that there are fully baked images available to be pushed, and deploy
also needs to transpile container.yml
(including meta/container.yml
for roles) into docker-compose.yml
for injection into the generated playbook.
ISSUE TYPE
container.yml
OS / ENVIRONMENT
SUMMARY
When trying to build and push my container project to my registry, and using a dockerized CI/CI container that runs ansible-container (Gitlab CI), I am using named volumes to mount the ansible-container config (container.yml and the roles directory). My build system will launch a container with a named volume (
ansible-container-build-source
) attached and mounted to a directory (and will havedocker.sock
bind mounted from the host as well), check out the source code, copy the code to that directory, install ansible-container and then run the commandansible-container build --src-mount-path ansible-container-build-source
. This seems to work as--src-mount-path
will interpret this properly as a named container and mount theansible-container-build-source
volume to/src
inside the conductor, which will let it find the roles and continue the build. Without mounting this volume, ansible will not be able to find the roles dir as it attempts to bind-mount the working directory, which, in the docker-in-docker case, will try to bind mount a directory on the host instead of a directory in the container.However, in the next build step, when I try to perform an
ansible-container push --push-to myregistry
it will fail with an error saying it cannot find the roles. If I try to include the--src-mount-path
directory, it will error as that is not a valid option forpush
.I've tried to use the
--with volume
option but this apparently cannot mount named volumes (it treats the first string in thesrc:dest:mode
format as a path always, which it can also refer to a named volume). This might be another bug.STEPS TO REPRODUCE
EXPECTED RESULTS
Either
ansible-container push
to work on its own (not sure why a push command needs to re-read the roles when they were used only in build) or for it to also respect the--src-mount-path
flag if it does need access to the src and roles dir.ACTUAL RESULTS
See above repro steps for unexpected results