Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ ARG YQ_VERSION="4.40.7"
ARG TEA_VERSION="0.9.2"

# As of 9/5/2024: awxkit is not compatible with python 3.12 due to setuptools
# Ansible-core 2.16 is needed for losing track of async jobs (as noted in AGOF for infra.controller_configuration)
# Ansible-core 2.19 is needed for losing track of async jobs (as noted in AGOF for infra.controller_configuration)
# 'pip' will be influenced by where /usr/bin/python3 points, which we take care of with the altnernatives
# command
ARG PYTHON_VERSION="3.11"
ARG PYTHON_PKGS="python${PYTHON_VERSION} python${PYTHON_VERSION}-pip python3-pip"
ARG ANSIBLE_CORE_SPEC="ansible-core==2.16.*"

# amd64 - arm64
ARG TARGETARCH
Expand Down Expand Up @@ -118,9 +117,14 @@ ENV PIP_BREAK_SYSTEM_PACKAGES=1
# Add requirements.yml file for ansible collections
COPY requirements.yml /tmp/requirements.yml
COPY requirements.txt /tmp/requirements.txt
COPY ansible-playbook-wrapper.sh /tmp/ansible-playbook-wrapper.sh

RUN pip install --no-cache-dir -r /tmp/requirements.txt && \
ansible-galaxy collection install --collections-path /usr/share/ansible/collections -r /tmp/requirements.yml && \
# Create ansible-playbook wrapper that sets ANSIBLE_STDOUT_CALLBACK to rhvp.cluster_utils.readable when it's "null" \
mv /usr/local/bin/ansible-playbook /usr/local/bin/ansible-playbook.orig && \
cp /tmp/ansible-playbook-wrapper.sh /usr/local/bin/ansible-playbook && \
chmod +x /usr/local/bin/ansible-playbook && \
rm -rf /usr/local/lib/python${PYTHON_VERSION}/site-packages/ansible_collections/$COLLECTIONS_TO_REMOVE && \
curl -L -O https://raw.githubusercontent.com/clumio-code/azure-sdk-trim/main/azure_sdk_trim/azure_sdk_trim.py && \
python3 azure_sdk_trim.py && rm azure_sdk_trim.py && pip uninstall -y humanize && \
Expand Down
7 changes: 7 additions & 0 deletions ansible-playbook-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# Wrapper script for ansible-playbook that sets ANSIBLE_STDOUT_CALLBACK when needed
if [ "${ANSIBLE_STDOUT_CALLBACK}" = "null" ]; then
export ANSIBLE_STDOUT_CALLBACK="rhvp.cluster_utils.readable"
fi
export ANSIBLE_INVENTORY_UNPARSED_WARNING=False
exec /usr/local/bin/ansible-playbook.orig "$@"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ansible-core==2.16.*
ansible-core==2.19.*
ansible-runner
awxkit
kubernetes
Expand Down