loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Prepare and check test env during CI (#17725)

This PR should resolve the permission problems during CI, if the uid doesn't match, a more clear message is shown.

* CI fails with unknown permission problems #17710

The new drone step dependencies:

(root)prepare-test-env -> (gitea)build -> (gitea)test

authored by

wxiaoguang and committed by
GitHub
e4b95de3 9361b65f

+69 -14
+34 -14
.drone.yml
··· 1 1 --- 2 2 kind: pipeline 3 + type: docker 3 4 name: compliance 4 5 5 6 platform: ··· 130 131 131 132 --- 132 133 kind: pipeline 134 + type: docker 133 135 name: testing-amd64 134 136 135 137 platform: ··· 191 193 exclude: 192 194 - pull_request 193 195 194 - - name: build 195 - pull: always 196 - image: golang:1.17 197 - commands: 198 - - make backend 199 - environment: 200 - GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not 201 - GOSUMDB: sum.golang.org 202 - TAGS: bindata sqlite sqlite_unlock_notify 203 - 204 196 - name: tag-pre-condition 205 197 pull: always 206 198 image: drone/git 207 199 commands: 208 200 - git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA} 209 201 210 - - name: fix-permissions 202 + - name: prepare-test-env 211 203 image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env 212 204 commands: 213 - - chown -R gitea:gitea . 205 + - ./build/test-env-prepare.sh 206 + 207 + - name: build 208 + pull: always 209 + image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env 210 + user: gitea 211 + commands: 212 + - ./build/test-env-check.sh 213 + - make backend 214 + environment: 215 + GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not 216 + GOSUMDB: sum.golang.org 217 + TAGS: bindata sqlite sqlite_unlock_notify 218 + depends_on: 219 + - prepare-test-env 214 220 215 221 - name: unit-test 216 222 image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env ··· 353 359 exclude: 354 360 - pull_request 355 361 356 - - name: fix-permissions 362 + - name: prepare-test-env 357 363 image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env 358 364 commands: 359 - - chown -R gitea:gitea . 365 + - ./build/test-env-prepare.sh 360 366 361 367 - name: build 362 368 pull: always 363 369 image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env 364 370 user: gitea 365 371 commands: 372 + - ./build/test-env-check.sh 366 373 - make backend 367 374 environment: 368 375 GOPROXY: https://goproxy.cn # proxy.golang.org is blocked in China, this proxy is not 369 376 GOSUMDB: sum.golang.org 370 377 TAGS: bindata gogit sqlite sqlite_unlock_notify 378 + depends_on: 379 + - prepare-test-env 371 380 372 381 - name: test-sqlite 373 382 image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env ··· 461 470 462 471 --- 463 472 kind: pipeline 473 + type: docker 464 474 name: update_gitignore_and_licenses 465 475 466 476 platform: ··· 497 507 498 508 --- 499 509 kind: pipeline 510 + type: docker 500 511 name: release-latest 501 512 502 513 platform: ··· 675 686 676 687 --- 677 688 kind: pipeline 689 + type: docker 678 690 name: docs 679 691 680 692 platform: ··· 716 728 717 729 --- 718 730 kind: pipeline 731 + type: docker 719 732 name: docker-linux-amd64-release-version 720 733 721 734 platform: ··· 780 793 781 794 --- 782 795 kind: pipeline 796 + type: docker 783 797 name: docker-linux-amd64-release 784 798 785 799 platform: ··· 844 858 845 859 --- 846 860 kind: pipeline 861 + type: docker 847 862 name: docker-linux-arm64-dry-run 848 863 849 864 platform: ··· 876 891 877 892 --- 878 893 kind: pipeline 894 + type: docker 879 895 name: docker-linux-arm64-release-version 880 896 881 897 platform: ··· 943 959 944 960 --- 945 961 kind: pipeline 962 + type: docker 946 963 name: docker-linux-arm64-release 947 964 948 965 platform: ··· 1009 1026 - pull_request 1010 1027 --- 1011 1028 kind: pipeline 1029 + type: docker 1012 1030 name: docker-manifest-version 1013 1031 1014 1032 platform: ··· 1052 1070 1053 1071 --- 1054 1072 kind: pipeline 1073 + type: docker 1055 1074 name: docker-manifest 1056 1075 1057 1076 platform: ··· 1095 1114 1096 1115 --- 1097 1116 kind: pipeline 1117 + type: docker 1098 1118 name: notifications 1099 1119 1100 1120 platform:
+24
build/test-env-check.sh
··· 1 + #!/bin/sh 2 + 3 + set -e 4 + 5 + if [ ! -f ./build/test-env-check.sh ]; then 6 + echo "${0} can only be executed in gitea source root directory" 7 + exit 1 8 + fi 9 + 10 + 11 + echo "check uid ..." 12 + 13 + # the uid of gitea defined in "https://gitea.com/gitea/test-env" is 1000 14 + gitea_uid=$(id -u gitea) 15 + if [ "$gitea_uid" != "1000" ]; then 16 + echo "The uid of linux user 'gitea' is expected to be 1000, but it is $gitea_uid" 17 + exit 1 18 + fi 19 + 20 + cur_uid=$(id -u) 21 + if [ "$cur_uid" != "0" -a "$cur_uid" != "$gitea_uid" ]; then 22 + echo "The uid of current linux user is expected to be 0 or $gitea_uid, but it is $cur_uid" 23 + exit 1 24 + fi
+11
build/test-env-prepare.sh
··· 1 + #!/bin/sh 2 + 3 + set -e 4 + 5 + if [ ! -f ./build/test-env-prepare.sh ]; then 6 + echo "${0} can only be executed in gitea source root directory" 7 + exit 1 8 + fi 9 + 10 + echo "change the owner of files to gitea ..." 11 + chown -R gitea:gitea .