Skip to content

Commit

Permalink
Use ubi9 image for aee
Browse files Browse the repository at this point in the history
The current adt image is with fedora base image that installs packages
using pip without constraints and prone to be broken with latest changes
in packages.

We also probably need a way to control what should be installed with pip and
dnf when using ubi9.

Signed-off-by: rabi <[email protected]>
  • Loading branch information
rabi committed Nov 13, 2024
1 parent 5389805 commit 8113c9c
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ execute_molecule: setup_test_environment ## Setup the test environment and execu

.PHONY: openstack_ansibleee_build
openstack_ansibleee_build: ## Build the openstack-ansibleee-runner image
podman build . -f openstack_ansibleee/Dockerfile -t ${IMG}
podman build --no-cache . -f openstack_ansibleee/Containerfile -t ${IMG}

.PHONY: openstack_ansibleee_push
openstack_ansibleee_push: ## Push the openstack-ansibleee-runner image
Expand Down
36 changes: 36 additions & 0 deletions openstack_ansibleee/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest as builder
ARG PYV=3.12
ARG REMOTE_SOURCE=.
ARG REMOTE_SOURCE_DIR=/var/tmp/edpm-ansible

COPY $REMOTE_SOURCE $REMOTE_SOURCE_DIR

RUN $REMOTE_SOURCE_DIR/openstack_ansibleee/setup.sh

RUN cd $REMOTE_SOURCE_DIR/openstack_ansibleee && \
ansible-galaxy collection install -U --timeout 120 -r ansibleee-requirements.yaml --collections-path "/usr/share/ansible/collections" && \
ansible-galaxy collection install -U --timeout 120 -r requirements.yaml --collections-path "/usr/share/ansible/collections" && \
ansible-galaxy collection install -U $REMOTE_SOURCE_DIR --collections-path "/usr/share/ansible/collections"


FROM registry.access.redhat.com/ubi9/ubi-minimal:latest as runner

ARG PYV=3.12
ARG REMOTE_SOURCE=.
ARG REMOTE_SOURCE_DIR=/var/tmp/edpm-ansible

COPY $REMOTE_SOURCE/openstack_ansibleee $REMOTE_SOURCE_DIR/openstack_ansibleee

RUN $REMOTE_SOURCE_DIR/openstack_ansibleee/setup.sh

COPY --from=builder /usr/share/ansible /usr/share/ansible
COPY $REMOTE_SOURCE/openstack_ansibleee/settings /runner/env/settings
COPY $REMOTE_SOURCE/openstack_ansibleee/edpm_entrypoint.sh /opt/builder/bin/edpm_entrypoint

RUN sed '1d' /usr/local/lib/python${PYV}/site-packages/ansible_builder/_target_scripts/entrypoint >> /opt/builder/bin/edpm_entrypoint
RUN mkdir /runner/project && chmod -R 775 /runner && chmod +x /opt/builder/bin/edpm_entrypoint && chmod ug+rw /etc/passwd

ENV EDPM_SYSTEMROLES='fedora.linux_system_roles'
WORKDIR /runner
LABEL ansible-execution-environment=true
ENTRYPOINT ["/opt/builder/bin/edpm_entrypoint", "dumb-init"]
23 changes: 0 additions & 23 deletions openstack_ansibleee/Dockerfile

This file was deleted.

3 changes: 3 additions & 0 deletions openstack_ansibleee/ansibleee-requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
collections:
- name: fedora.linux_system_roles
4 changes: 4 additions & 0 deletions openstack_ansibleee/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ansible-core>=2.16.1
ansible-runner>=2.4.0
ansible-builder>=3.1.0
dumb-init>=1.2.2
24 changes: 24 additions & 0 deletions openstack_ansibleee/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -e
set -eux pipefail

microdnf -y makecache
microdnf install -y \
gcc \
libssh-devel \
iputils \
bind-utils \
ncurses \
openssh-clients \
"python${PYV}" \
"python${PYV}-cffi" \
"python${PYV}-pip" \
"python${PYV}-pyyaml" \
"python${PYV}-wheel" \
util-linux-user \
which \
rsync \
zsh

microdnf -y clean all

"/usr/bin/python${PYV}" -m pip install --no-cache -r $REMOTE_SOURCE_DIR/openstack_ansibleee/requirements.txt

0 comments on commit 8113c9c

Please sign in to comment.