Feature #51222
openceph-backport.sh: minimal automated test
0%
Description
- run Gitea (OK)
- create a ceph/ceph project in Gitea (OK)
- run Redmine (OK)
- create a ceph project in redmine (OK)
- create a ceph issue in redmine (OK)
- run ceph-backport.sh against the local Gitea + redmine to create the pull request (OK)
- verify the pull request exists (OK)
Note: this takes advantage of the fact that the Gitea API is mostly the same as the GitHub API. At first glance it looks like the ceph-backport.sh script does not use API endpoints / arguments that are incompatible.
Files
Updated by Loïc Dachary almost 3 years ago
- Blocks Bug #51224: ceph-backport.sh: a PR for N needs a staged PR for N+1 added
Updated by Loïc Dachary almost 3 years ago
The test environment created here https://lab.fedeproxy.eu/ceph/ceph-backport
Once it works, it should probably become a standalone QA job that can be run manually. I'm not sure the CI has the ability to run docker containers. And in any case it would be overkill to run that every time although it is only needed when the script is modified.
Updated by Loïc Dachary almost 3 years ago
- File 0001-scripts-ceph-backport.sh-do-not-hardcode-api.github..patch 0001-scripts-ceph-backport.sh-do-not-hardcode-api.github..patch added
- File 0002-scripts-ceph-backport.sh-preserve-verbosity.patch 0002-scripts-ceph-backport.sh-preserve-verbosity.patch added
- File 0003-scripts-ceph-backport.sh-do-not-hardcode-tracker.cep.patch 0003-scripts-ceph-backport.sh-do-not-hardcode-tracker.cep.patch added
ceph-backports.sh is happy about the setup (according to vet_setup), with the following minor changes. Although they could be submitted as a pull request, they are trivial and there is no urgency.
For the record the CI output is green at this point https://lab.fedeproxy.eu/ceph/ceph-backport/-/jobs/142
Updated by Loïc Dachary over 2 years ago
- File 0004-scripts-ceph-backport.sh-allow-override-PR-target-he.patch 0004-scripts-ceph-backport.sh-allow-override-PR-target-he.patch added
- File 0005-scripts-ceph-backport.sh-allow-override-of-the-pull-.patch 0005-scripts-ceph-backport.sh-allow-override-of-the-pull-.patch added
ceph-backport.sh in the test environment is at the cherry-picking phase and needs two more minor patches to get there.
For the record the CI is green at this point: https://lab.fedeproxy.eu/ceph/ceph-backport/-/jobs/186
Updated by Loïc Dachary over 2 years ago
- File 0006-scripts-ceph-backport.sh-display_url-when-firefox-is.patch 0006-scripts-ceph-backport.sh-display_url-when-firefox-is.patch added
- File 0007-scripts-ceph-backport.sh-allow-override-PR-path.patch 0007-scripts-ceph-backport.sh-allow-override-PR-path.patch added
- File 0008-scripts-ceph-backport.sh-explicitly-set-Content-Type.patch 0008-scripts-ceph-backport.sh-explicitly-set-Content-Type.patch added
- File 0009-scripts-ceph-backport.sh-move-number-of-commits-code.patch 0009-scripts-ceph-backport.sh-move-number-of-commits-code.patch added
- File 0010-scripts-ceph-backport.sh-implement-pr_commits_count.patch 0010-scripts-ceph-backport.sh-implement-pr_commits_count.patch added
With these minimal modifications a backport pull request is created by the tests and the corresponding issue is updated as expected. The most significant change is using `git log` instead of the the `.commits` element in the JSON describing the pull request.
For the record the CI is green at this point: https://lab.fedeproxy.eu/ceph/ceph-backport/-/jobs/223
Updated by Loïc Dachary over 2 years ago
@Nathan Weinberg, would you be so kind as to apply these patches to master and create a pull request with the following title and body?
scripts: ceph-backport.sh: minor changes to enable testing
It was tested to successfully open a backport pull request and update the corresponding issue in redmine using a local redmine instance and a local Gitea instance (it implements the same API as GitHub).
Updated by Loïc Dachary over 2 years ago
The tests are implemented in a separate repository
Another issue will be opened to figure out where they should be hosted to ensure they are not lost.
Updated by Loïc Dachary over 2 years ago
- Description updated (diff)
- Status changed from In Progress to Fix Under Review
Updated by Loïc Dachary over 2 years ago
- Related to Tasks #52122: ceph-backport.sh: running the tests added
Updated by Loïc Dachary over 2 years ago
- Blocks Feature #52387: backport-create-issue: set the priority of the backport issue added
Updated by Nathan Cutler over 2 years ago
- Pull request ID set to 43207
@Loïc Dachary here you go: https://github.com/ceph/ceph/pull/43027
Sorry for the latency.
Do you have any suggestion regarding reviewers?
Updated by Loïc Dachary over 2 years ago
Thanks! I have no idea regarding reviewers right now but I'll think about it. I should have provided a title/description for the PR, sorry about that. Here they are:
Title: scripts: ceph-backport.sh: enable automated test
Description: No functional modifications. The changes are mostly about allowing an external test script (not included in this PR) to override variables and verify the script works as expected using a redmine and GitHub like (Gitea) self hosted instance.
Updated by Loïc Dachary over 2 years ago
- Pull request ID changed from 43207 to 43027
Updated by Patrick Donnelly over 2 years ago
- Related to Feature #52387: backport-create-issue: set the priority of the backport issue added
Updated by Patrick Donnelly over 2 years ago
- Blocks deleted (Feature #52387: backport-create-issue: set the priority of the backport issue)
Updated by Deepika Upadhyay over 2 years ago
hey Loic: egarding https://tracker.ceph.com/issues/51222 does the test environment run on any new PR related to ceph-backports? can we get it to post status to the PR or do we need to setup something, what would be your suggestion?
Updated by Loïc Dachary over 2 years ago
Deepika,
The tests were designed in an environment where I could experiment run against GitLab, not GitHub. In addition they depend on third party repositories which makes them too fragile. This was a useful first step to go from not having any kind of test environment to something that work.
The second step is to make the test self contained so they can be included in the Ceph main tree. This is what I did here: https://lab.fedeproxy.eu/ceph/ceph/-/merge_requests/1
You will see in the associated commit that the setup of the test environment, although self contained is not trivial. It indeed has a long history and should be cleaned up. But maybe this can be left for later since the main focus is to have tests running in the CI.
The tests will be triggered from:
https://lab.fedeproxy.eu/ceph/ceph/-/blob/wip-backports/src/test/CMakeLists.txt#L611
and should run in GitHub as well. You can try them by making a pull request from the content of this branch:
Updated by Deepika Upadhyay over 2 years ago
hey Loic,
I tried to test the script that ceph test would be triggering locally, but could not run it successfully... can you let me know if I am missing something,
+ for i in redmine postgresql-redmine + docker stop redmine Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Error: no container with name or ID "redmine" found: no such container + true + docker rm redmine Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Error: no container with name or ID "redmine" found: no such container + true + for i in redmine postgresql-redmine + docker stop postgresql-redmine Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Error: no container with name or ID "postgresql-redmine" found: no such container + true + docker rm postgresql-redmine Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Error: no container with name or ID "postgresql-redmine" found: no such container + true + docker volume rm --force redmine-volume Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg. Error: no volume with name "redmine-volume" found: no such volume
ran: ./src/test/run-ceph-backport-tests.sh
Updated by Loïc Dachary over 2 years ago
Could you please attach the full output ? These are the last lines only and suggests the redmine container was not successfully ran for some reason.
Updated by Deepika Upadhyay over 2 years ago
sure
2021/09/27 09:35:56 main.go:117:main() [F] Failed to run app with [gitea admin user create --access-token --admin --username root --password Wrobyak4 --email admin@example.com]: CreateUser: database is locked Error: exec session exited with non-zero exit code 1: OCI runtime error + success=true + break + true ++ id -u + test 1212 '!=' 0 + SUDO=sudo + : 127.0.0.1 + for f in ${@:-teardown setup} + teardown + for i in redmine postgresql-redmine + podman stop redmine Error: no container with name or ID redmine found: no such container + true + podman rm redmine Error: no container with name or ID redmine found: no such container + true + for i in redmine postgresql-redmine + podman stop postgresql-redmine Error: no container with name or ID postgresql-redmine found: no such container + true + podman rm postgresql-redmine Error: no container with name or ID postgresql-redmine found: no such container + true + podman volume rm --force redmine-volume Error: no volume with name "redmine-volume" found: no such volume + for f in prepare_environment ${@:-teardown setup} + prepare_environment + : 0.0.0.0 + for f in prepare_environment ${@:-teardown setup} + teardown + podman stop gitea 8542a355aa3d170aefed3545328ba9bd23f5e2a0c19065fca1271fdf8f44c09c + podman rm -f gitea 8542a355aa3d170aefed3545328ba9bd23f5e2a0c19065fca1271fdf8f44c09c ++ id -u + test 1212 '!=' 0 + SUDO=sudo + : 127.0.0.1 + for f in ${@:-teardown setup} + teardown + for i in redmine postgresql-redmine + podman stop redmine Error: no container with name or ID redmine found: no such container + true + podman rm redmine Error: no container with name or ID redmine found: no such container + true + for i in redmine postgresql-redmine + podman stop postgresql-redmine Error: no container with name or ID postgresql-redmine found: no such container + true + podman rm postgresql-redmine Error: no container with name or ID postgresql-redmine found: no such container + true + podman volume rm --force redmine-volume Error: no volume with name "redmine-volume" found: no such volume
I am not sure why gitea is not being pulled, i used podman instead, since I was having issues with docker
Updated by Loïc Dachary over 2 years ago
A failure to pull gitea is the blocker for sure. What kind of error message do you get when trying to pull the gitea image?
Updated by Loïc Dachary over 2 years ago
Just checking that I did not miss a question from you Deepika :-)
Updated by Loïc Dachary over 2 years ago
For the record (so I do not forget), pinged via IRC
Updated by Deepika Upadhyay over 2 years ago
@loicd full log: https://gist.github.com/ideepika/51526acbcff739de1ec6a031287e3b80
if I comment that out and use, I get:
ideepika@senta04:~/ceph/src/test$ /home/ideepika/ceph/src/script/backports/tests/gitea-helper.py setup File "/home/ideepika/ceph/src/script/backports/tests/gitea-helper.py", line 17 d = p.dvcs(f"{self.tmp}/repository")
Updated by Loïc Dachary over 2 years ago
The problem is that:
+ podman volume rm --force redmine-volume
Error: no volume with name "redmine-volume" found: no such volume
Returns on error when the volume does not exist. The same command with docker instead of podman returns success.
$ docker volume rm --force nonexistent && echo SUCCESS
nonexistent
SUCCESS
Would you be so kind as to get the lastest version of this patch from https://lab.fedeproxy.eu/ceph/ceph/-/tree/wip-backports ?
You can see the output of a successful run for reference at https://lab.fedeproxy.eu/ceph/ceph/-/jobs/449
Updated by Deepika Upadhyay over 2 years ago
thanks Loic, I will try them out today
Updated by Deepika Upadhyay over 2 years ago
Hey Loic!
I tried using the script in centos 8 and I am not able to move past installing dependencies(since poetry req python3.8)
I don't have a Ubuntu 20.04 setup.
Since we are using docker, there we had faced the rate-limiting issue in the past: https://www.docker.com/increase-rate-limits
Can we move to use quay https://quay.io/?