-
Notifications
You must be signed in to change notification settings - Fork 0
How to reproduce 30392
This page describes how to reproduce https://github.com/go-gitea/gitea/pull/30392 for future use.
Use docker image with following docker-compose.yml.
networks:
gitbucket:
external: false
services:
server:
image: gitbucket/gitbucket:4.38.4
container_name: gitbucket
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
networks:
- gitbucket
volumes:
- ./data:/gitbucket
ports:
- "8080:8080"
$ ls
$ mkdir gitbucket
$ cd gitbucket
$ vi docker-compose.yml
$ docker-compose up -d
[+] Running 1/1
✔ server Pulled 2.0s
[+] Running 2/2
✔ Network gitbucket_gitbucket Created 0.0s
✔ Container gitbucket Started 0.1s
Create test repository from web browser through http://localhost:8080/. The default account and password without data base is root and root, respectively.
Once you create a repository, it is possible to get information of that through curl.
$ curl -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "http://localhost:8080/api/v3/repos/root/test"
{"name":"test","full_name":"root/test","description":"","watchers":0,"forks":0,"private":false,"default_branch":"master","owner":{"login":"root","email":"root@localhost","type":"User","site_admin":true,"created_at":"2024-04-14T06:41:54Z","id":0,"url":"http://localhost:8080/api/v3/users/root","html_url":"http://localhost:8080/root","avatar_url":"http://localhost:8080/root/_avatar"},"has_issues":true,"id":0,"forks_count":0,"watchers_count":0,"url":"http://localhost:8080/api/v3/repos/root/test","clone_url":"http://localhost:8080/git/root/test.git","html_url":"http://localhost:8080/root/test"}
$ mkdir test
$ cd test
$ touch README.md
$ git init
$ git add README.md
$ git commit -m "first commit"
$ git remote add origin http://localhost:8080/git/root/test.git
$ git push -u origin master
Username for 'http://localhost:8080': root
Password for 'http://root@localhost:8080':
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 219 bytes | 219.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Updating references: 100% (1/1)
To http://localhost:8080/git/root/test.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
Create 60 issues.
$ for i in `seq 1 60`; do curl -X POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -d '{ "title": "issue'$i'" }' http://localhost:8080/api/v3/repos/root/test/issues -u root:root; done
Check it. We have last 25 items (36-60) in 1st page.
$ curl -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" http://localhost:8080/api/v3/repos/root/test/issues -u root:root | jq '.[].number'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 14026 100 14026 0 0 86580 0 --:--:-- --:--:-- --:--:-- 86580
41
40
49
60
54
59
37
46
45
50
53
51
39
44
58
38
56
36
52
43
48
57
47
55
42
Create 60 PRs.
$ for i in `seq 1 60`; do curl -X POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -d '{ "title": "PR'$i'", "head": "master", "base", "master" }' http://localhost:8080/api/v3/repos/root/test/issues -u root:root; done
Check it. We have last 25 items (96-120) in 1st page.
$ curl -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" http://localhost:8080/api/v3/repos/root/test/pulls -u root:root | jq '.[].number' | sort -n
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 73327 0 73327 0 0 397k 0 --:--:-- --:--:-- --:--:-- 397k
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
Use docker image with following docker-compose.yml.
networks:
gitea:
external: false
services:
server:
image: gitea/gitea:1.21.10
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__migrations__ALLOW_LOCALNETWORKS=true
restart: always
networks:
- gitea
volumes:
- ./data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "3000:3000"
$ ls
gitbucket
$ mkdir gitea
$ cd gitea
$ vi docker-compose.yml
$ docker-compose up -d
[+] Running 8/8
✔ server Pulled 6.3s
✔ 619be1103602 Already exists 0.0s
✔ 29b211844169 Pull complete 2.0s
✔ 5f20a1c0654c Pull complete 0.8s
✔ 4e2291e65115 Pull complete 0.6s
✔ 78e19500b2dd Pull complete 2.6s
✔ db253fbe17a2 Pull complete 1.6s
✔ bbabe7fe1121 Pull complete 2.2s
[+] Running 2/2
✔ Network gitea_gitea Created 0.1s
✔ Container gitea Started 0.3s
Set up the gitea through http://localhost:3000/.
Migrate test repo from http://host.docker.internal:8080/root/test to gitea. Need to use a host name in extra hosts. This only copies 25 issues and pull requests because of a bug I mentioned.
Use docker image with following docker-compose.yml. Please use your own test docker image if you want to test yours.
networks:
gitea2:
external: false
services:
server:
image: jam7/gitea:1.21.10-10
container_name: gitea2
environment:
- USER_UID=1000
- USER_GID=1000
- GITEA__migrations__ALLOW_LOCALNETWORKS=true
restart: always
networks:
- gitea2
volumes:
- ./data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "3010:3000"
$ ls
gitbucket gitea
$ mkdir gitea2
$ cd gitea2
$ vi docker-compose.yml
$ docker-compose up -d
[+] Running 2/2
✔ Network gitea-10_gitea2 Created 0.0s
✔ Container gitea2 Started 0.0s
Set up the gitea through http://localhost:3010/.
Migrate test repo from http://host.docker.internal:8080/root/test to gitea. Need to use a host name in extra hosts. This copies all issues and pull requests.