Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base support for forgejo #891

Merged
merged 6 commits into from
Feb 27, 2025

Conversation

majamassarini
Copy link
Member

Fixes #875

Copy link

sentry-io bot commented Feb 12, 2025

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: ogr/abstract.py

Function Unhandled Issue
wrapper PagureAPIException: Page 'https://src.fedoraproject.org/api/0/rpms/dtk6widget/issues' not found when calling Pagure API. ...
Event Count: 12
wrapper OgrException: No installation ID provided for evverx/avahi: please make sure that you provided correct credenti... ...
Event Count: 6
wrapper GithubAPIException: Tag test was not found. task....
Event Count: 5
wrapper OgrException: No installation ID provided for rpm-software-management/libdnf: please make sure that you provide... ...
Event Count: 3

Did you find this useful? React with a 👍 or 👎

@majamassarini majamassarini force-pushed the fix/ogr/875 branch 2 times, most recently from 0ecd191 to e4efa68 Compare February 12, 2025 10:10
Comment on lines 11 to 27
@pytest.mark.parametrize(
"kwargs_",
[
pytest.param(
{"repo": "test", "namespace": "packit"},
id="create project with namespace",
),
pytest.param(
{"repo": "test", "namespace": None},
id="create project without namespace",
),
pytest.param(
{"repo": "test_1", "namespace": None, "description": "A repo description"},
id="create project with description",
),
],
)
@record(what="pyforgejo.core.http_client.HttpClient.request")
def test_project_create(service, kwargs_):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used pytest+params here instead of unittest+inheritance because I like the way pytest can save us code duplication. But I am fine to go back using unittest for maintaining code compatibility in tests with other modules.

Copy link
Contributor

Copy link
Contributor

@mfocko mfocko mentioned this pull request Feb 12, 2025
4 tasks
@majamassarini
Copy link
Member Author

tests in testing-farm are failing because python-pyforgejo in Fedora is still using pypi version 1. My code is based on pypi version 2.0.
In EPEL there is no pyforgejo rpm package.

Should I somehow force pyforgejo installation directly from pypi both for Fedora and EPEL images?

@lbarcziova
Copy link
Member

@majamassarini yes temporarily installing from PyPI makes sense. We could also try to ping the maintainers (also asking about epel), but since it's a major version update, it might not help with stable Fedoras.

softwarefactory-project-zuul bot added a commit to packit/requre that referenced this pull request Feb 13, 2025
Feat/httpx

TODO:

 Write new tests or update the old ones to cover new functionality.
 Update doc-strings where appropriate.
 Update or write new documentation in packit/packit.dev.
 ‹fill in›



Fixes
Related to packit/ogr#891
Merge before/after

RELEASE NOTES BEGIN
requre now supports recording of the requests done by httpx via record_httpx() and recording_httpx() decorators.
RELEASE NOTES END

Reviewed-by: Nikola Forró
Reviewed-by: František Lachman <[email protected]>
Reviewed-by: Matej Focko
@mfocko mfocko assigned majamassarini and mfocko and unassigned mfocko Feb 13, 2025
Copy link
Member

@mfocko mfocko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, if we want to go with the cached_property, though I don't expect any reasons why not (it could cause problems only during tests)

- requre.cassette
- pyforgejo.core.http_client
- request
output: !!binary |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be in binary 👀

though should be fixed after re-recording with my commit for requre support

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

pip:
name:
- flexmock
- pyforgejo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically speaking it's not a test dependency, shouldn't the one line in zuul-install-requirements-pip.yaml be enough?

Copy link
Contributor

Copy link
Contributor

Co-authored-by: Matej Focko <[email protected]>
Signed-off-by: Matej Focko <[email protected]>
Copy link
Contributor

@majamassarini
Copy link
Member Author

/packit retest-failed

Skimming through the Testing Farm logs, it appears that even if the
‹pyforgejo› is installed via ‹pip› during the ‹prepare› phase, it still
installs the ‹1.0.2› version instead of the latest ‹2.0.0› that is
required from within the ‹ogr›'s implementation.

Logs from the Testing Farm:

    14:15:02         prepare wrapper: /var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-prepare-wrapper.sh-default-3-default-0
    14:15:02         script: pip3 install pyforgejo
    14:15:02         Workdir '/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/prepare/default-3' created.
    14:15:02         Write file '/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-prepare-wrapper.sh-default-3-default-0'.
    14:15:02         Copy '/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-prepare-wrapper.sh-default-3-default-0' to '/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-prepare-wrapper.sh-default-3-default-0' on the guest.
    14:15:02         Run command: rsync -s -p --chmod=755 -e 'ssh -oForwardX11=no -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oConnectionAttempts=5 -oConnectTimeout=60 -oServerAliveInterval=5 -oServerAliveCountMax=60 -oIdentitiesOnly=yes -p22 -i /etc/citool.d/id_rsa_artemis -oPasswordAuthentication=no -S/var/ARTIFACTS/work-fullm6vdjuvi/ssh-sockets/18.117.139.241-22-root.socket' /var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-prepare-wrapper.sh-default-3-default-0 [email protected]:/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-prepare-wrapper.sh-default-3-default-0
    14:15:02         environment
    14:15:02         Command returned '0' (success).
    14:15:02         Execute command 'export TMT_TOPOLOGY_YAML=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-test-topology-default-3-default-0.yaml; export TMT_TOPOLOGY_BASH=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-test-topology-default-3-default-0.sh; export PACKIT_BUILD_LOG_URL=https://download.copr.fedorainfracloud.org/results/packit/packit-ogr-891/fedora-41-x86_64/08655130-python-ogr/builder-live.log; export PACKIT_COMMIT_SHA=70bc48d8faf182674bde3ef9133e1c65a898536a; export PACKIT_COPR_PROJECT=packit/packit-ogr-891; export PACKIT_COPR_RPMS=python3-ogr-0.50.4.post1.dev5+g70bc48d-1.20250214140910645338.pr891.5.g70bc48d.fc41.noarch; export PACKIT_DOWNSTREAM_NAME=python-ogr; export PACKIT_DOWNSTREAM_URL=https://src.fedoraproject.org/rpms/python-ogr.git; export PACKIT_FULL_REPO_NAME=packit/ogr; export PACKIT_PACKAGE_NAME=python-ogr; export PACKIT_PACKAGE_NVR=python-ogr-0.50.4.post1.dev5+g70bc48d-1.20250214140910645338.pr891.5.g70bc48d.fc41; export PACKIT_PR_ID=891; export PACKIT_SOURCE_BRANCH=fix/ogr/875; export PACKIT_SOURCE_SHA=70bc48d8faf182674bde3ef9133e1c65a898536a; export PACKIT_SOURCE_URL=https://github.com/majamassarini/ogr; export PACKIT_SRPM_URL=https://download.copr.fedorainfracloud.org/results/packit/packit-ogr-891/srpm-builds/08655130/python-ogr-0.50.4.post1.dev5+g70bc48d-1.20250214140910645338.pr891.5.g70bc48d.src.rpm; export PACKIT_TARGET_BRANCH=main; export PACKIT_TARGET_SHA=4a3d53fb4582a52462af1158690df513720df793; export PACKIT_TARGET_URL=https://github.com/packit/ogr; export PACKIT_UPSTREAM_NAME=ogr; export PACKIT_UPSTREAM_URL=https://github.com/packit/ogr; export TESTING_FARM_REQUEST_ID=cbc23977-9dd8-48fd-aef9-68e59bf55dbe; export TESTING_FARM_TEST_TYPE=fmf; export TESTING_FARM_GIT_URL=https://github.com/majamassarini/ogr; export TESTING_FARM_GIT_REF=70bc48d8faf182674bde3ef9133e1c65a898536a; export TMT_PLAN_DATA=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/data; export TMT_PLAN_ENVIRONMENT_FILE=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/data/variables.env; export TMT_TREE=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree; export TMT_VERSION=1.42.1; cd /var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree; /var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-prepare-wrapper.sh-default-3-default-0' on guest '18.117.139.241'.
    14:15:02         Run command: ssh -oForwardX11=no -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oConnectionAttempts=5 -oConnectTimeout=60 -oServerAliveInterval=5 -oServerAliveCountMax=60 -oIdentitiesOnly=yes -p22 -i /etc/citool.d/id_rsa_artemis -oPasswordAuthentication=no -S/var/ARTIFACTS/work-fullm6vdjuvi/ssh-sockets/18.117.139.241-22-root.socket [email protected] 'export TMT_TOPOLOGY_YAML=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-test-topology-default-3-default-0.yaml; export TMT_TOPOLOGY_BASH=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-test-topology-default-3-default-0.sh; export PACKIT_BUILD_LOG_URL=https://download.copr.fedorainfracloud.org/results/packit/packit-ogr-891/fedora-41-x86_64/08655130-python-ogr/builder-live.log; export PACKIT_COMMIT_SHA=70bc48d8faf182674bde3ef9133e1c65a898536a; export PACKIT_COPR_PROJECT=packit/packit-ogr-891; export PACKIT_COPR_RPMS=python3-ogr-0.50.4.post1.dev5+g70bc48d-1.20250214140910645338.pr891.5.g70bc48d.fc41.noarch; export PACKIT_DOWNSTREAM_NAME=python-ogr; export PACKIT_DOWNSTREAM_URL=https://src.fedoraproject.org/rpms/python-ogr.git; export PACKIT_FULL_REPO_NAME=packit/ogr; export PACKIT_PACKAGE_NAME=python-ogr; export PACKIT_PACKAGE_NVR=python-ogr-0.50.4.post1.dev5+g70bc48d-1.20250214140910645338.pr891.5.g70bc48d.fc41; export PACKIT_PR_ID=891; export PACKIT_SOURCE_BRANCH=fix/ogr/875; export PACKIT_SOURCE_SHA=70bc48d8faf182674bde3ef9133e1c65a898536a; export PACKIT_SOURCE_URL=https://github.com/majamassarini/ogr; export PACKIT_SRPM_URL=https://download.copr.fedorainfracloud.org/results/packit/packit-ogr-891/srpm-builds/08655130/python-ogr-0.50.4.post1.dev5+g70bc48d-1.20250214140910645338.pr891.5.g70bc48d.src.rpm; export PACKIT_TARGET_BRANCH=main; export PACKIT_TARGET_SHA=4a3d53fb4582a52462af1158690df513720df793; export PACKIT_TARGET_URL=https://github.com/packit/ogr; export PACKIT_UPSTREAM_NAME=ogr; export PACKIT_UPSTREAM_URL=https://github.com/packit/ogr; export TESTING_FARM_REQUEST_ID=cbc23977-9dd8-48fd-aef9-68e59bf55dbe; export TESTING_FARM_TEST_TYPE=fmf; export TESTING_FARM_GIT_URL=https://github.com/majamassarini/ogr; export TESTING_FARM_GIT_REF=70bc48d8faf182674bde3ef9133e1c65a898536a; export TMT_PLAN_DATA=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/data; export TMT_PLAN_ENVIRONMENT_FILE=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/data/variables.env; export TMT_TREE=/var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree; export TMT_VERSION=1.42.1; cd /var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree; /var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-prepare-wrapper.sh-default-3-default-0'
    14:15:02             cmd: /var/ARTIFACTS/work-fullm6vdjuvi/plans/full/tree/tmt-prepare-wrapper.sh-default-3-default-0
    14:15:02         environment
    14:15:03             out: Requirement already satisfied: pyforgejo in /usr/lib/python3.13/site-packages (1.0.2)
    14:15:03             out: Requirement already satisfied: attrs>=21.3.0 in /usr/lib/python3.13/site-packages (from pyforgejo) (24.2.0)
    14:15:03             out: Requirement already satisfied: httpx>=0.20.0 in /usr/lib/python3.13/site-packages (from pyforgejo) (0.27.0)
    14:15:03             out: Requirement already satisfied: python-dateutil<3.0.0,>=2.8.0 in /usr/lib/python3.13/site-packages (from pyforgejo) (2.8.2)
    14:15:03             out: Requirement already satisfied: anyio in /usr/lib/python3.13/site-packages (from httpx>=0.20.0->pyforgejo) (3.7.1)
    14:15:03             out: Requirement already satisfied: certifi in /usr/lib/python3.13/site-packages (from httpx>=0.20.0->pyforgejo) (2023.5.7)
    14:15:03             out: Requirement already satisfied: httpcore==1.* in /usr/lib/python3.13/site-packages (from httpx>=0.20.0->pyforgejo) (1.0.5)
    14:15:03             out: Requirement already satisfied: idna in /usr/lib/python3.13/site-packages (from httpx>=0.20.0->pyforgejo) (3.7)
    14:15:03             out: Requirement already satisfied: sniffio in /usr/lib/python3.13/site-packages (from httpx>=0.20.0->pyforgejo) (1.3.1)
    14:15:03             out: Requirement already satisfied: h11<0.15,>=0.13 in /usr/lib/python3.13/site-packages (from httpcore==1.*->httpx>=0.20.0->pyforgejo) (0.14.0)
    14:15:03             out: Requirement already satisfied: six>=1.5 in /usr/lib/python3.13/site-packages (from python-dateutil<3.0.0,>=2.8.0->pyforgejo) (1.16.0)
    14:15:03             err: WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
    14:15:03         Command returned '0' (success).

Signed-off-by: Matej Focko <[email protected]>
Since there is no official release of pyforgejo into the Fedora and it's
also a breaking release, so there is a rather small chance of merging
breaking changes into already released Fedoras, we can still build our
own pyforgejo with the latest version that we aim to support.

Signed-off-by: Matej Focko <[email protected]>
When running the tests we also need the Copr repo with pyforgejo…

Signed-off-by: Matej Focko <[email protected]>
Copy link
Contributor

Copy link
Member

@lbarcziova lbarcziova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@majamassarini majamassarini added the mergeit When set, zuul wil gate and merge the PR. label Feb 27, 2025
Copy link
Contributor

Build succeeded (gate pipeline).
https://softwarefactory-project.io/zuul/t/packit-service/buildset/004f9d6a26e74b46a229a84148a972b2

✔️ pre-commit SUCCESS in 2m 48s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit b92e58e into packit:main Feb 27, 2025
26 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit When set, zuul wil gate and merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement base for Forgejo support
3 participants