ci(images): add git to the molecule-controller image #502
No files matched your search
@@ -17,11 +17,11 @@ Ubuntu 26.04 with:
|
|||||||
- **The collections the scenarios call** in `/opt/collections` (`ANSIBLE_COLLECTIONS_PATH` is set to it): those of
|
- **The collections the scenarios call** in `/opt/collections` (`ANSIBLE_COLLECTIONS_PATH` is set to it): those of
|
||||||
`requirements.yml` (`community.general`, `ansible.posix`, `community.proxmox`), which the roles call, and of
|
`requirements.yml` (`community.general`, `ansible.posix`, `community.proxmox`), which the roles call, and of
|
||||||
`extensions/molecule/requirements.yml` (`community.docker`), which the Docker driver's own playbooks call.
|
`extensions/molecule/requirements.yml` (`community.docker`), which the Docker driver's own playbooks call.
|
||||||
- `python3`, `python3-venv` and `ca-certificates` from the distribution. The image runs as root and sets no
|
- `python3`, `python3-venv`, `ca-certificates` and `git` from the distribution. The image runs as root and sets no
|
||||||
working directory.
|
working directory.
|
||||||
- `/opt/molecule-pins.sha256`: the checksums of the four pin files this image was built from.
|
- `/opt/molecule-pins.sha256`: the checksums of the four pin files this image was built from.
|
||||||
|
|
||||||
It has no Docker CLI and no `git`: mount the host's Docker CLI and socket, and the checkout.
|
It has no Docker CLI: mount the host's Docker CLI and socket, and the checkout.
|
||||||
|
|
||||||
## How to use it
|
## How to use it
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,10 @@ FROM ubuntu:26.04@sha256:d66b366dac61b575bee2aef07e9c26e8070096fbe84a3d4d3eb0da0
|
|||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# python3 and python3-venv only bootstrap uv in the build stage; ca-certificates serve the
|
# python3 and python3-venv only bootstrap uv in the build stage; ca-certificates serve the
|
||||||
# install a job runs when a pull request changes a pin. apt lists are removed in the same layer.
|
# install a job runs when a pull request changes a pin; git lets the selector diff the checkout.
|
||||||
|
# apt lists are removed in the same layer.
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends ca-certificates python3 python3-venv \
|
&& apt-get install -y --no-install-recommends ca-certificates git python3 python3-venv \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ LABEL org.opencontainers.image.title="molecule-controller" \
|
|||||||
org.opencontainers.image.authors="Defame1297 and contributors" \
|
org.opencontainers.image.authors="Defame1297 and contributors" \
|
||||||
org.opencontainers.image.base.name="ubuntu:26.04" \
|
org.opencontainers.image.base.name="ubuntu:26.04" \
|
||||||
net.rkdr.mortis.purpose="Molecule controller image for the mortis.kamino Ansible Collection: the Molecule workflow runs molecule in it, so a tool only Lint uses does not change it." \
|
net.rkdr.mortis.purpose="Molecule controller image for the mortis.kamino Ansible Collection: the Molecule workflow runs molecule in it, so a tool only Lint uses does not change it." \
|
||||||
net.rkdr.mortis.contents="Ubuntu 26.04, /opt/venv (ansible-core, molecule, molecule-plugins[docker]), /opt/collections (community.general, ansible.posix, community.proxmox, community.docker), python<PYTHON_VERSION> (the one of /opt/venv), python3 (distribution), /opt/molecule-pins.sha256" \
|
net.rkdr.mortis.contents="Ubuntu 26.04, /opt/venv (ansible-core, molecule, molecule-plugins[docker]), /opt/collections (community.general, ansible.posix, community.proxmox, community.docker), python<PYTHON_VERSION> (the one of /opt/venv), python3 and git (distribution), /opt/molecule-pins.sha256" \
|
||||||
net.rkdr.mortis.usage="Molecule (host executor, kamino-molecule runner): docker run as the runner user, with the Docker socket, the host Docker CLI and the checkout mounted at the same path. Run sha256sum -c /opt/molecule-pins.sha256 in the checkout root and install the pinned tools and collections when a pull request changed them, else use /opt/venv/bin and ANSIBLE_COLLECTIONS_PATH=/opt/collections. See the documentation label."
|
net.rkdr.mortis.usage="Molecule (host executor, kamino-molecule runner): docker run as the runner user, with the Docker socket, the host Docker CLI and the checkout mounted at the same path. Run sha256sum -c /opt/molecule-pins.sha256 in the checkout root and install the pinned tools and collections when a pull request changed them, else use /opt/venv/bin and ANSIBLE_COLLECTIONS_PATH=/opt/collections. See the documentation label."
|
||||||
|
|
||||||
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
||||||
@@ -122,6 +123,7 @@ RUN set -eu; \
|
|||||||
molecule --version | grep -F "molecule ${mol}"; \
|
molecule --version | grep -F "molecule ${mol}"; \
|
||||||
molecule drivers | grep -qw docker; \
|
molecule drivers | grep -qw docker; \
|
||||||
python -c "import docker"; \
|
python -c "import docker"; \
|
||||||
|
git --version; \
|
||||||
collections="$(ansible-galaxy collection list --format json)"; \
|
collections="$(ansible-galaxy collection list --format json)"; \
|
||||||
for c in $(sed -n 's/^ *- name: *//p' requirements.yml extensions/molecule/requirements.yml); do \
|
for c in $(sed -n 's/^ *- name: *//p' requirements.yml extensions/molecule/requirements.yml); do \
|
||||||
printf '%s' "$collections" | python -c "import json, sys; d = json.load(sys.stdin); sys.exit(0 if any('$c' in v for v in d.values()) else 1)" \
|
printf '%s' "$collections" | python -c "import json, sys; d = json.load(sys.stdin); sys.exit(0 if any('$c' in v for v in d.values()) else 1)" \
|
||||||
|
|||||||
Reference in new issue
Block a user