Skip to content

Commit aa9bb44

Browse files
committed
use pipenv for python dependency management
retry of operator-framework#4538 and operator-framework#4494 Signed-off-by: reinvantveer <[email protected]>
1 parent 0d9f23c commit aa9bb44

File tree

4 files changed

+505
-9
lines changed

4 files changed

+505
-9
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
entries:
2+
- description: >
3+
For Ansible-based operators, Python package installation in the Docker
4+
image is delegated to a pipenv managed Pipfile and Pipfile.lock, pinning
5+
both the main installed packages and their subdependencies. This prevents
6+
installing conflicting (sub)dependencies
7+
8+
kind: change
9+
10+
breaking: false

images/ansible-operator/Dockerfile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@ ENV HOME=/opt/ansible \
1313
# Install python dependencies
1414
# Ensure fresh metadata rather than cached metadata in the base by running
1515
# yum clean all && rm -rf /var/yum/cache/* first
16+
# Copy python dependencies specs to be installed using Pipenv
17+
COPY Pipfile* ./
18+
# Instruct pip(env) not to keep a cache of installed packages,
19+
# to install into the global site-packages and
20+
# to clear the pipenv cache as well
21+
ENV PIP_NO_CACHE_DIR=1 \
22+
PIPENV_SYSTEM=1 \
23+
PIPENV_CLEAR=1
24+
# Ensure fresh metadata rather than cached metadata in the base by running
25+
# yum clean all && rm -rf /var/yum/cache/* first
1626
RUN yum clean all && rm -rf /var/cache/yum/* \
1727
&& yum -y update \
1828
&& yum install -y libffi-devel openssl-devel python38-devel gcc python38-pip python38-setuptools \
19-
&& pip3 install --no-cache-dir \
20-
cryptography==3.3.2 \
21-
ansible-runner==1.3.4 \
22-
ansible-runner-http==1.0.0 \
23-
ipaddress==1.0.23 \
24-
kubernetes==10.1.0 \
25-
openshift==0.10.3 \
26-
ansible==2.9.15 \
27-
jmespath==0.10.0 \
29+
&& pip3 install pipenv==2020.11.15 \
30+
&& pipenv install --deploy \
31+
&& pipenv check \
2832
&& yum remove -y gcc libffi-devel openssl-devel python38-devel \
2933
&& yum clean all \
3034
&& rm -rf /var/cache/yum

images/ansible-operator/Pipfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
ansible-runner = "==1.4.6"
8+
ansible-runner-http = "==1.0.0"
9+
ipaddress = "==1.0.23"
10+
openshift = "==0.11.2"
11+
ansible = "==2.9.15"
12+
jmespath = "==0.10.0"
13+
14+
[dev-packages]
15+
16+
[requires]
17+
python_version = "3.8"

0 commit comments

Comments
 (0)