Skip to content

Commit ebf4f67

Browse files
committed
Migrate from pdm to Poetry
A Poetry is a package manager with more user friendly interface and it is supported by dependabot. JIRA: ISV-6653 Signed-off-by: Ales Raszka <araszka@redhat.com>
1 parent b301954 commit ebf4f67

226 files changed

Lines changed: 4269 additions & 3329 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coveragerc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[run]
2-
source = operator-pipeline-images/operatorcert
2+
source = operatorcert
33
omit =
4-
operator-pipeline-images/operatorcert/webhook/*
5-
operator-pipeline-images/operatorcert/integration/testcases/*
4+
operatorcert/webhook/*
5+
operatorcert/integration/testcases/*
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
Dockerfile
2+
13
# Ignoring git and cache folders
24
.git
35
.github
46
.cache
57

68
# Ignoring all the markdown and class files
7-
*.md
89
docs
910

1011
#Ignoring tekton pipeine and ansible tasks
1112
templates
12-
ansible
13+
ansible

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,13 @@ updates:
88
schedule:
99
# Check for updates to GitHub Actions every week
1010
interval: "weekly"
11+
- package-ecosystem: "pip"
12+
directory: "/"
13+
schedule:
14+
# Check for updates to Python dependencies every week
15+
interval: "weekly"
16+
- package-ecosystem: "docker"
17+
directory: "/"
18+
schedule:
19+
# Check for updates to Docker images every week
20+
interval: "weekly"

Dockerfile

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
FROM quay.io/fedora/fedora:42
2+
3+
LABEL description="Cli tools for operator certification pipeline"
4+
LABEL summary="This image contains tools required for operator bundle certification pipeline."
5+
6+
LABEL org.opencontainers.image.authors="The Collective <exd-guild-isv@redhat.com>" \
7+
org.opencontainers.image.url="quay.io/redhat-isv/operator-pipelines-images" \
8+
org.opencontainers.image.source="https://github.com/redhat-openshift-ecosystem/operator-pipelines" \
9+
org.opencontainers.image.vendor="Red Hat." \
10+
org.opencontainers.image.title="Operator certification tools" \
11+
org.opencontainers.image.description="Cli tools for operator certification pipeline." \
12+
org.opencontainers.image.base.name="quay.io/fedora/fedora:42"
13+
14+
ARG USER_UID=1000
15+
ARG PODMAN_USER_UID=1001
16+
ARG ARCH=amd64
17+
18+
USER root
19+
20+
# setup certificates
21+
COPY certs/* /etc/pki/ca-trust/source/anchors/
22+
RUN /usr/bin/update-ca-trust
23+
# This is just a temporary workaround until we figure out how to
24+
# override CA bundle in OCP
25+
RUN cp /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/custom-ca-bundle.crt
26+
27+
ENV REQUESTS_CA_BUNDLE="/etc/pki/tls/certs/custom-ca-bundle.crt"
28+
29+
# Install all system dependencies including Python and development tools
30+
RUN dnf update -y && \
31+
dnf install -y \
32+
buildah \
33+
cargo \
34+
findutils \
35+
gcc \
36+
gh \
37+
git \
38+
gnupg2 \
39+
jq \
40+
krb5-devel \
41+
krb5-workstation \
42+
libffi-devel \
43+
openssl-devel \
44+
pinentry \
45+
podman \
46+
python3 \
47+
python3-devel \
48+
python3-pip \
49+
redhat-rpm-config \
50+
skopeo \
51+
yamllint && \
52+
dnf clean all
53+
54+
COPY config/krb5.conf /etc/krb5.conf
55+
COPY hacks/retry-command.sh /usr/local/bin/retry
56+
57+
# Install oc, opm and operator-sdk CLI
58+
RUN curl -LO https://github.com/operator-framework/operator-registry/releases/download/v1.46.0/linux-${ARCH}-opm && \
59+
chmod +x linux-${ARCH}-opm && \
60+
mv linux-${ARCH}-opm /usr/local/bin/opm && \
61+
curl -LO https://mirror.openshift.com/pub/openshift-v4/${ARCH}/clients/ocp/stable-4.20/openshift-client-linux.tar.gz && \
62+
tar xzvf openshift-client-linux.tar.gz -C /usr/local/bin oc && \
63+
curl -LO https://github.com/operator-framework/operator-sdk/releases/download/v1.36.1/operator-sdk_linux_${ARCH} && \
64+
chmod +x operator-sdk_linux_${ARCH} && \
65+
mv operator-sdk_linux_${ARCH} /usr/local/bin/operator-sdk
66+
67+
# Create users
68+
RUN useradd -lms /bin/bash -u "${USER_UID}" user && \
69+
useradd -lu "${PODMAN_USER_UID}" podman; \
70+
echo podman:10000:5000 >> /etc/subuid; \
71+
echo podman:10000:5000 >> /etc/subgid;
72+
73+
WORKDIR /home/user
74+
75+
# Set directory ownership
76+
RUN chgrp -R 0 /home/user /etc/passwd && \
77+
chmod -R g=u /home/user /etc/passwd
78+
79+
# Install Poetry
80+
RUN pip3 install --no-cache-dir --upgrade poetry==2.3.1
81+
82+
# Copy only dependency files first (better caching)
83+
COPY pyproject.toml poetry.lock /home/user/
84+
85+
# Configure Poetry for container optimization
86+
ENV POETRY_VIRTUALENVS_IN_PROJECT=true \
87+
POETRY_CACHE_DIR=/tmp/poetry_cache
88+
89+
# Install dependencies in separate layer (cached until deps change)
90+
RUN poetry install --without dev --no-root && \
91+
rm -rf /tmp/poetry_cache
92+
93+
# Copy code AFTER deps (doesn't bust dependency cache)
94+
COPY operatorcert ./operatorcert
95+
COPY README.md ./
96+
97+
# Install the package itself (quick since deps already installed)
98+
RUN poetry install --only-root
99+
100+
# Set up PATH to use the virtual environment
101+
ENV PATH=/home/user/.venv/bin:$PATH
102+
103+
USER "${USER_UID}"
104+
105+
ENTRYPOINT [ "/usr/bin/sh" ]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ build-and-test-isv-fbc-catalog:
8181
.PHONY: build
8282
build:
8383
@echo "Building..."
84-
podman build -t pipelines . -f operator-pipeline-images/Dockerfile
84+
podman build -t pipelines . -f Dockerfile
8585
@echo "Tagging..."
8686
podman tag pipelines $(PIPELINE_IMAGE_REPO):$(TAG)
8787
podman push $(PIPELINE_IMAGE_REPO):$(TAG)

operator-pipeline-images/certs/2022-IT-Root-CA.pem renamed to certs/2022-IT-Root-CA.pem

File renamed without changes.

operator-pipeline-images/certs/RH-IT-Root-CA.crt renamed to certs/RH-IT-Root-CA.crt

File renamed without changes.

operator-pipeline-images/config/dispatcher_config.yaml renamed to config/dispatcher_config.yaml

File renamed without changes.

docs/developer-guide.md

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,31 @@
1313

1414
## Setup
1515

16-
1. [Git leaks detection](#git-leaks-detection)
17-
1. [Prepare a development environment](#prepare-a-development-environment)
18-
1. [Prepare a certification project](#prepare-a-certification-project)
19-
1. [Prepare an Operator bundle](#prepare-an-operator-bundle)
20-
1. [Prepare your `ci.yaml`](#prepare-your-ciyaml)
21-
1. [Create a bundle pull request](#create-a-bundle-pull-request) (optional)
22-
- Required for testing hosted or release pipelines
23-
1. [Create an API key](#create-an-api-key) (optional)
24-
- Required for testing submission with the CI pipeline
25-
1. [Prepare the CI to run from your fork](ci-cd.md) (optional)
26-
- Required to run integration testing on forks of this repo.
16+
- [Developer Guide](#developer-guide)
17+
- [Workflow](#workflow)
18+
- [Setup](#setup)
19+
- [Git leaks detection](#git-leaks-detection)
20+
- [Prepare a Development Environment](#prepare-a-development-environment)
21+
- [Integration tests](#integration-tests)
22+
- [Install tkn](#install-tkn)
23+
- [Using CodeReady Containers](#using-codeready-containers)
24+
- [Running a Pipeline with CRC](#running-a-pipeline-with-crc)
25+
- [Prepare a Certification Project](#prepare-a-certification-project)
26+
- [Prepare an Operator Bundle](#prepare-an-operator-bundle)
27+
- [Prepare Your ci.yaml](#prepare-your-ciyaml)
28+
- [Create a Bundle Pull Request](#create-a-bundle-pull-request)
29+
- [Create an API Key](#create-an-api-key)
30+
- [Making Changes to the Pipelines](#making-changes-to-the-pipelines)
31+
- [Guiding Principles](#guiding-principles)
32+
- [Applying Pipeline Changes](#applying-pipeline-changes)
33+
- [Making Changes to the Pipeline Image](#making-changes-to-the-pipeline-image)
34+
- [Dependency](#dependency)
35+
- [Run Unit Tests, Code Style Checkers, etc.](#run-unit-tests-code-style-checkers-etc)
36+
- [Preparation on RPM-based Linux](#preparation-on-rpm-based-linux)
37+
- [Preparation on other Linux systems](#preparation-on-other-linux-systems)
38+
- [Run the local tests](#run-the-local-tests)
39+
- [Local development](#local-development)
40+
- [Build \& Push](#build--push)
2741

2842
### Git leaks detection
2943

@@ -280,30 +294,23 @@ oc apply -R -f ansible/roles/operator-pipeline/templates/openshift
280294
### Dependency
281295

282296
Operator pipelines project is configured to automatically manage Python
283-
dependencies using [PDM][1] tool. The pdm automates definition, installation,
297+
dependencies using [Poetry][1] tool. The poetry automates definition, installation,
284298
upgrades and the whole lifecycle of dependency in a project. All dependencies
285-
are stored in `pyproject.toml` file in a groups that corresponds to individual
286-
applications within the Operator pipelines project.
299+
are stored in `pyproject.toml` file.
287300

288301
Adding, removing and updating of dependency needs to be always done
289-
using `pdm` cli.
302+
using `poetry` cli.
290303

291304
```bash
292-
pdm add -G operator-pipelines gunicorn==20.1.0
305+
poetry add gunicorn==20.1.0
293306
```
294307

295-
After a dependency is installed it is added to pdm.lock file. The lock file
308+
After a dependency is installed it is added to poetry.lock file. The lock file
296309
is always part of git repository.
297310

298-
If you want to install specific group set of dependencies use following command:
299-
300-
```bash
301-
pdm install -G operator-pipelines
302-
```
303-
304311
Dependencies are stored into virtual environment (.venv) which is automatically
305-
created after `pdm install`. If .venv wasn't created, configure pdm to
306-
automatically create it during installation with `pdm config python.use_venv true`.
312+
created after `poetry install`. If .venv wasn't created, configure poetry to
313+
automatically create it during installation with `POETRY_VIRTUALENVS_IN_PROJECT=true`.
307314

308315
### Run Unit Tests, Code Style Checkers, etc.
309316

@@ -314,9 +321,9 @@ Choose the preparation process according to your Linux version.
314321

315322
```bash
316323
sudo dnf -y install hadolint
317-
python3 -m pip install pdm
318-
pdm venv create 3.13
319-
pdm install
324+
python3 -m pip install poetry
325+
poetry env use python3.13
326+
poetry install
320327
source .venv/bin/activate
321328
python3 -m pip install ansible-lint
322329
```
@@ -327,9 +334,9 @@ Before starting, make sure you have installed the [Brew][2] package manager.
327334

328335
```bash
329336
brew install hadolint
330-
python3 -m pip install pdm
331-
pdm venv create 3.13
332-
pdm install
337+
python3 -m pip install poetry
338+
poetry env use python3.13
339+
poetry install
333340
source .venv/bin/activate
334341
python3 -m pip install ansible-lint
335342
```
@@ -344,11 +351,11 @@ tox
344351

345352
### Local development
346353

347-
Setup python virtual environment using pdm.
354+
Setup python virtual environment using poetry.
348355

349356
```shell
350-
pdm venv create 3.13
351-
pdm install
357+
poetry env use python3.13
358+
poetry install
352359
source .venv/bin/activate
353360
```
354361

@@ -375,5 +382,5 @@ source .venv/bin/activate
375382
buildah login quay.io
376383
```
377384

378-
[1]: https://pdm.fming.dev/latest/
385+
[1]: https://python-poetry.org
379386
[2]: https://brew.sh/

0 commit comments

Comments
 (0)