Skip to content

Kayobe container image build may fail if collections or roles need updating #26

@markgoddard

Description

@markgoddard

Steps to reproduce

  • checkout kayobe-config repo
  • add some roles or collections to etc/kayobe/ansible/requirements.yml
  • run kayobe control host bootstrap
  • modify role or collection version requirements in requirements.yml
  • build kayobe container image

Expected

Image builds successfully

Actual

Image fails to build. The command that fails is kayobe control host bootstrap. It fails because the roles or collections in etc/kayobe/ansible/{roles,collections} are of an incompatible version.

Workaround

Remove the roles and collections before building the image.

I also used this change to the Dockerfile which worked, but would flatten any non-galaxy roles/collections:

diff --git a/docker/kayobe/Dockerfile b/docker/kayobe/Dockerfile
index 786a541..e0c83fc 100644
--- a/docker/kayobe/Dockerfile
+++ b/docker/kayobe/Dockerfile
@@ -73,6 +73,7 @@ RUN --mount=type=ssh,uid=1000 --mount=type=tmpfs,target=/tmp/src --mount=type=bi
   sudo chown -Rf stack:stack /tmp/src && \
   # Strip the secrets so that we don't need to pass in a vault-password
   grep -lR "\$ANSIBLE_VAULT" /tmp/src | xargs rm -f && \
+  (rm -rf /tmp/src/etc/kayobe/ansible/roles/* /tmp/src/etc/kayobe/ansible/collections/* || true) && \
   bash /tmp/src/.automation/utils/kayobe-automation-install && \
   (rm -f /stack/.ssh/{id_rsa,id_rsa.pub} || true) && \
   (mkdir /stack/.ansible || true) && \

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions