diff --git a/.drone.yml b/.drone.yml index a8fa7eba3687b..b74fed8372522 100644 --- a/.drone.yml +++ b/.drone.yml @@ -9,9 +9,10 @@ platform: trigger: event: - - push - - tag - pull_request + paths: + exclude: + - docs/** volumes: - name: deps @@ -25,10 +26,11 @@ steps: - make deps-frontend - name: deps-backend - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 pull: always commands: - make deps-backend + - make deps-tools volumes: - name: deps path: /go @@ -40,7 +42,7 @@ steps: depends_on: [deps-frontend] - name: lint-backend - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env pull: always commands: - make lint-backend @@ -54,7 +56,7 @@ steps: path: /go - name: lint-backend-windows - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env commands: - make golangci-lint-windows vet environment: @@ -69,7 +71,7 @@ steps: path: /go - name: lint-backend-gogit - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env commands: - make lint-backend environment: @@ -88,7 +90,7 @@ steps: depends_on: [deps-frontend] - name: checks-backend - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 commands: - make --always-make checks-backend # ensure the 'go-licenses' make target runs depends_on: [deps-backend] @@ -109,10 +111,9 @@ steps: depends_on: [deps-frontend] - name: build-backend-no-gcc - image: golang:1.18 # this step is kept as the lowest version of golang that we support + image: gitea/test_env:linux-1.19-amd64 # this step is kept as the lowest version of golang that we support pull: always environment: - GO111MODULE: on GOPROXY: https://goproxy.io commands: - go build -o gitea_no_gcc # test if build succeeds without the sqlite tag @@ -122,9 +123,8 @@ steps: path: /go - name: build-backend-arm64 - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 environment: - GO111MODULE: on GOPROXY: https://goproxy.io GOOS: linux GOARCH: arm64 @@ -138,9 +138,8 @@ steps: path: /go - name: build-backend-windows - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 environment: - GO111MODULE: on GOPROXY: https://goproxy.io GOOS: windows GOARCH: amd64 @@ -153,9 +152,8 @@ steps: path: /go - name: build-backend-386 - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 environment: - GO111MODULE: on GOPROXY: https://goproxy.io GOOS: linux GOARCH: 386 @@ -169,7 +167,7 @@ steps: --- kind: pipeline type: docker -name: testing-amd64 +name: testing-pgsql platform: os: linux @@ -180,40 +178,124 @@ depends_on: trigger: event: - - push - - tag - pull_request + paths: + exclude: + - docs/** volumes: - name: deps temp: {} services: - - name: mysql - image: mysql:5.7 - pull: always + - name: pgsql + pull: default + image: postgres:15 environment: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_DATABASE: test + POSTGRES_DB: test + POSTGRES_PASSWORD: postgres - - name: mysql8 - image: mysql:8 + - name: ldap + image: gitea/test-openldap:latest + pull: always + + - name: minio + image: minio/minio:RELEASE.2021-03-12T00-00-47Z pull: always + commands: + - minio server /data environment: - MYSQL_ALLOW_EMPTY_PASSWORD: yes - MYSQL_DATABASE: testgitea + MINIO_ACCESS_KEY: 123456 + MINIO_SECRET_KEY: 12345678 - - name: mssql - image: mcr.microsoft.com/mssql/server:latest +steps: + - name: fetch-tags + image: docker:git + pull: always + commands: + - git fetch --tags --force + when: + event: + exclude: + - pull_request + + - name: deps-backend + image: gitea/test_env:linux-1.20-amd64 + pull: always + commands: + - make deps-backend + volumes: + - name: deps + path: /go + + - name: prepare-test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env pull: always + commands: + - ./build/test-env-prepare.sh + + - name: build + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env + user: gitea + commands: + - ./build/test-env-check.sh + - make backend environment: - ACCEPT_EULA: Y - MSSQL_PID: Standard - SA_PASSWORD: MwantsaSecurePassword1 + GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not + GOSUMDB: sum.golang.org + TAGS: bindata + depends_on: [deps-backend, prepare-test-env] + volumes: + - name: deps + path: /go - - name: ldap - image: gitea/test-openldap:latest + - name: test-pgsql + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env + user: gitea + commands: + - timeout -s ABRT 50m make test-pgsql-migration test-pgsql + environment: + GOPROXY: https://goproxy.io + TAGS: bindata gogit + RACE_ENABLED: true + TEST_TAGS: gogit + TEST_LDAP: 1 + USE_REPO_TEST_DIR: 1 + depends_on: [build] + volumes: + - name: deps + path: /go + +--- +kind: pipeline +type: docker +name: testing-mysql + +platform: + os: linux + arch: amd64 + +depends_on: + - compliance + +trigger: + event: + - pull_request + paths: + exclude: + - docs/** + +volumes: + - name: deps + temp: {} + +services: + - name: mysql + image: mysql:5.7 pull: always + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: test - name: elasticsearch image: elasticsearch:7.5.0 @@ -221,15 +303,6 @@ services: environment: discovery.type: single-node - - name: minio - image: minio/minio:RELEASE.2021-03-12T00-00-47Z - pull: always - commands: - - minio server /data - environment: - MINIO_ACCESS_KEY: 123456 - MINIO_SECRET_KEY: 12345678 - - name: smtpimap image: tabascoterrier/docker-imap-devel:latest pull: always @@ -239,7 +312,6 @@ steps: image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force when: event: @@ -247,7 +319,7 @@ steps: - pull_request - name: deps-backend - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 pull: always commands: - make deps-backend @@ -255,20 +327,14 @@ steps: - name: deps path: /go - - name: tag-pre-condition - image: drone/git - pull: always - commands: - - git update-ref refs/heads/tag_test ${DRONE_COMMIT_SHA} - - name: prepare-test-env - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env pull: always commands: - ./build/test-env-prepare.sh - name: build - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - ./build/test-env-check.sh @@ -276,20 +342,20 @@ steps: environment: GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not GOSUMDB: sum.golang.org - TAGS: bindata sqlite sqlite_unlock_notify + TAGS: bindata depends_on: [deps-backend, prepare-test-env] volumes: - name: deps path: /go - name: unit-test - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - make unit-test-coverage test-check environment: GOPROXY: https://goproxy.io - TAGS: bindata sqlite sqlite_unlock_notify + TAGS: bindata RACE_ENABLED: true GITHUB_READ_TOKEN: from_secret: github_read_token @@ -299,13 +365,13 @@ steps: path: /go - name: unit-test-gogit - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - make unit-test-coverage test-check environment: GOPROXY: https://goproxy.io - TAGS: bindata gogit sqlite sqlite_unlock_notify + TAGS: bindata gogit RACE_ENABLED: true GITHUB_READ_TOKEN: from_secret: github_read_token @@ -315,7 +381,7 @@ steps: path: /go - name: test-mysql - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - make test-mysql-migration integration-test-coverage @@ -323,7 +389,6 @@ steps: GOPROXY: https://goproxy.io TAGS: bindata RACE_ENABLED: true - TEST_LDAP: 1 USE_REPO_TEST_DIR: 1 TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200" depends_on: [build] @@ -331,40 +396,8 @@ steps: - name: deps path: /go - - name: test-mysql8 - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env - user: gitea - commands: - - timeout -s ABRT 50m make test-mysql8-migration test-mysql8 - environment: - GOPROXY: https://goproxy.io - TAGS: bindata - RACE_ENABLED: true - TEST_LDAP: 1 - USE_REPO_TEST_DIR: 1 - depends_on: [build] - volumes: - - name: deps - path: /go - - - name: test-mssql - image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env - user: gitea - commands: - - make test-mssql-migration test-mssql - environment: - GOPROXY: https://goproxy.io - TAGS: bindata - RACE_ENABLED: true - TEST_LDAP: 1 - USE_REPO_TEST_DIR: 1 - depends_on: [build] - volumes: - - name: deps - path: /go - - name: generate-coverage - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 commands: - make coverage environment: @@ -396,43 +429,127 @@ steps: --- kind: pipeline -name: testing-arm64 +type: docker +name: testing-mysql8 platform: os: linux - arch: arm64 + arch: amd64 depends_on: - compliance trigger: event: - - push - - tag - pull_request + paths: + exclude: + - docs/** volumes: - name: deps temp: {} services: - - name: pgsql - pull: default - image: postgres:10 + - name: mysql8 + image: mysql:8 + pull: always environment: - POSTGRES_DB: test - POSTGRES_PASSWORD: postgres + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: testgitea - - name: ldap - pull: default - image: gitea/test-openldap:latest +steps: + - name: fetch-tags + image: docker:git + pull: always + commands: + - git fetch --tags --force + when: + event: + exclude: + - pull_request + + - name: deps-backend + image: gitea/test_env:linux-1.20-amd64 + pull: always + commands: + - make deps-backend + volumes: + - name: deps + path: /go + + - name: prepare-test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env + pull: always + commands: + - ./build/test-env-prepare.sh + + - name: build + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env + user: gitea + commands: + - ./build/test-env-check.sh + - make backend + environment: + GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not + GOSUMDB: sum.golang.org + TAGS: bindata + depends_on: [deps-backend, prepare-test-env] + volumes: + - name: deps + path: /go + + - name: test-mysql8 + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env + user: gitea + commands: + - timeout -s ABRT 50m make test-mysql8-migration test-mysql8 + environment: + GOPROXY: https://goproxy.io + TAGS: bindata + USE_REPO_TEST_DIR: 1 + depends_on: [build] + volumes: + - name: deps + path: /go + +--- +kind: pipeline +type: docker +name: testing-mssql + +platform: + os: linux + arch: amd64 + +depends_on: + - compliance + +trigger: + event: + - pull_request + paths: + exclude: + - docs/** + +volumes: + - name: deps + temp: {} + +services: + - name: mssql + image: mcr.microsoft.com/mssql/server:latest + pull: always + environment: + ACCEPT_EULA: Y + MSSQL_PID: Standard + SA_PASSWORD: MwantsaSecurePassword1 steps: - name: fetch-tags image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force when: event: @@ -440,7 +557,7 @@ steps: - pull_request - name: deps-backend - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 pull: always commands: - make deps-backend @@ -449,13 +566,13 @@ steps: path: /go - name: prepare-test-env - image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env pull: always commands: - ./build/test-env-prepare.sh - name: build - image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - ./build/test-env-check.sh @@ -463,39 +580,99 @@ steps: environment: GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not GOSUMDB: sum.golang.org - TAGS: bindata gogit sqlite sqlite_unlock_notify + TAGS: bindata depends_on: [deps-backend, prepare-test-env] volumes: - name: deps path: /go - - name: test-sqlite - image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env + - name: test-mssql + image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env user: gitea commands: - - timeout -s ABRT 50m make test-sqlite-migration test-sqlite + - make test-mssql-migration test-mssql environment: GOPROXY: https://goproxy.io - TAGS: bindata gogit sqlite sqlite_unlock_notify - RACE_ENABLED: true - TEST_TAGS: gogit sqlite sqlite_unlock_notify + TAGS: bindata USE_REPO_TEST_DIR: 1 depends_on: [build] volumes: - name: deps path: /go - - name: test-pgsql - image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env +--- +kind: pipeline +name: testing-sqlite + +platform: + os: linux + arch: arm64 + +depends_on: + - compliance + +trigger: + event: + - pull_request + paths: + exclude: + - docs/** + +volumes: + - name: deps + temp: {} + +steps: + - name: fetch-tags + image: docker:git + pull: always + commands: + - git fetch --tags --force + when: + event: + exclude: + - pull_request + + - name: deps-backend + image: gitea/test_env:linux-1.20-arm64 + pull: always + commands: + - make deps-backend + volumes: + - name: deps + path: /go + + - name: prepare-test-env + image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env + pull: always + commands: + - ./build/test-env-prepare.sh + + - name: build + image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env user: gitea commands: - - timeout -s ABRT 50m make test-pgsql-migration test-pgsql + - ./build/test-env-check.sh + - make backend + environment: + GOPROXY: https://goproxy.io # proxy.golang.org is blocked in China, this proxy is not + GOSUMDB: sum.golang.org + TAGS: bindata gogit sqlite sqlite_unlock_notify + depends_on: [deps-backend, prepare-test-env] + volumes: + - name: deps + path: /go + + - name: test-sqlite + image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env + user: gitea + commands: + - timeout -s ABRT 50m make test-sqlite-migration test-sqlite environment: GOPROXY: https://goproxy.io - TAGS: bindata gogit + TAGS: bindata gogit sqlite sqlite_unlock_notify RACE_ENABLED: true - TEST_TAGS: gogit - TEST_LDAP: 1 + TEST_TAGS: gogit sqlite sqlite_unlock_notify USE_REPO_TEST_DIR: 1 depends_on: [build] volumes: @@ -517,20 +694,14 @@ depends_on: trigger: event: - pull_request + paths: + exclude: + - docs/** volumes: - name: deps temp: {} -services: - - name: pgsql - pull: default - image: postgres:10 - environment: - POSTGRES_DB: testgitea-e2e - POSTGRES_PASSWORD: postgres - POSTGRES_INITDB_ARGS: --encoding=UTF8 --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8' - steps: - name: deps-frontend image: node:18 @@ -545,7 +716,7 @@ steps: depends_on: [deps-frontend] - name: deps-backend - image: golang:1.18 + image: gitea/test_env:linux-1.20-amd64 pull: always commands: - make deps-backend @@ -555,19 +726,17 @@ steps: # TODO: We should probably build all dependencies into a test image - name: test-e2e - image: mcr.microsoft.com/playwright:v1.29.2-focal + image: mcr.microsoft.com/playwright:v1.31.2-focal commands: - - curl -sLO https://go.dev/dl/go1.19.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz + - curl -sLO https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz - groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea - apt-get -qq update && apt-get -qqy install build-essential - - export TEST_PGSQL_SCHEMA='' - ./build/test-env-prepare.sh - - su gitea bash -c "export PATH=$PATH:/usr/local/go/bin && timeout -s ABRT 40m make test-e2e-pgsql" + - su gitea bash -c "export PATH=$PATH:/usr/local/go/bin && timeout -s ABRT 40m make test-e2e-sqlite" environment: GOPROXY: https://goproxy.io GOSUMDB: sum.golang.org USE_REPO_TEST_DIR: 1 - TEST_PGSQL_DBNAME: 'testgitea-e2e' DEBIAN_FRONTEND: noninteractive depends_on: [build-frontend, deps-backend] volumes: @@ -656,7 +825,7 @@ trigger: steps: - name: download - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 pull: always commands: - timeout -s ABRT 40m make generate-license generate-gitignore @@ -696,10 +865,16 @@ trigger: - "release/*" event: - push + paths: + exclude: + - docs/** depends_on: - - testing-amd64 - - testing-arm64 + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite volumes: - name: deps @@ -710,7 +885,6 @@ steps: image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force - name: deps-frontend @@ -720,7 +894,7 @@ steps: - make deps-frontend - name: deps-backend - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 pull: always commands: - make deps-backend @@ -729,7 +903,7 @@ steps: path: /go - name: static - image: techknowlogick/xgo:go-1.19.x + image: techknowlogick/xgo:go-1.20.x pull: always commands: # Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved @@ -763,10 +937,16 @@ steps: image: woodpeckerci/plugin-s3:latest pull: always settings: - acl: public-read - bucket: gitea-artifacts - endpoint: https://ams3.digitaloceanspaces.com - path_style: true + acl: + from_secret: aws_s3_acl + region: + from_secret: aws_s3_region + bucket: + from_secret: aws_s3_bucket + endpoint: + from_secret: aws_s3_endpoint + path_style: + from_secret: aws_s3_path_style source: "dist/release/*" strip_prefix: dist/release/ target: "/gitea/${DRONE_BRANCH##release/v}" @@ -784,10 +964,16 @@ steps: - name: release-main image: woodpeckerci/plugin-s3:latest settings: - acl: public-read - bucket: gitea-artifacts - endpoint: https://ams3.digitaloceanspaces.com - path_style: true + acl: + from_secret: aws_s3_acl + region: + from_secret: aws_s3_region + bucket: + from_secret: aws_s3_bucket + endpoint: + from_secret: aws_s3_endpoint + path_style: + from_secret: aws_s3_path_style source: "dist/release/*" strip_prefix: dist/release/ target: /gitea/main @@ -819,8 +1005,11 @@ trigger: - tag depends_on: - - testing-arm64 - - testing-amd64 + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite volumes: - name: deps @@ -831,7 +1020,6 @@ steps: image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force - name: deps-frontend @@ -841,7 +1029,7 @@ steps: - make deps-frontend - name: deps-backend - image: golang:1.19 + image: gitea/test_env:linux-1.20-amd64 pull: always commands: - make deps-backend @@ -850,7 +1038,7 @@ steps: path: /go - name: static - image: techknowlogick/xgo:go-1.19.x + image: techknowlogick/xgo:go-1.20.x pull: always commands: # Upgrade to node 18 once https://github.com/techknowlogick/xgo/issues/163 is resolved @@ -886,10 +1074,16 @@ steps: image: woodpeckerci/plugin-s3:latest pull: always settings: - acl: public-read - bucket: gitea-artifacts - endpoint: https://ams3.digitaloceanspaces.com - path_style: true + acl: + from_secret: aws_s3_acl + region: + from_secret: aws_s3_region + bucket: + from_secret: aws_s3_bucket + endpoint: + from_secret: aws_s3_endpoint + path_style: + from_secret: aws_s3_path_style source: "dist/release/*" strip_prefix: dist/release/ target: "/gitea/${DRONE_TAG##v}" @@ -929,10 +1123,13 @@ trigger: - push - tag - pull_request + paths: + include: + - docs/** steps: - name: build-docs - image: golang:1.19 + image: gitea/test_env:linux-1.20-arm64 commands: - cd docs - make trans-copy clean build @@ -962,26 +1159,34 @@ platform: arch: amd64 depends_on: - - testing-amd64 - - testing-arm64 + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite trigger: ref: - - "refs/tags/**" + include: + - "refs/tags/**" + exclude: + - "refs/tags/**-rc*" event: exclude: - cron + paths: + exclude: + - docs/** steps: - name: fetch-tags image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: true @@ -993,13 +1198,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: true @@ -1011,6 +1220,85 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 + when: + event: + exclude: + - pull_request +--- + +kind: pipeline +type: docker +name: docker-linux-amd64-release-candidate-version + +platform: + os: linux + arch: amd64 + +depends_on: + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite + +trigger: + ref: + - "refs/tags/**-rc*" + event: + exclude: + - cron + paths: + exclude: + - docs/** + +steps: + - name: fetch-tags + image: docker:git + pull: always + commands: + - git fetch --tags --force + + - name: publish + image: plugins/docker:latest + pull: always + settings: + tags: ${DRONE_TAG##v}-linux-amd64 + repo: gitea/gitea + build_args: + - GOPROXY=https://goproxy.io + password: + from_secret: docker_password + username: + from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 + when: + event: + exclude: + - pull_request + + - name: publish-rootless + image: plugins/docker:latest + settings: + dockerfile: Dockerfile.rootless + tags: ${DRONE_TAG##v}-linux-amd64-rootless + repo: gitea/gitea + build_args: + - GOPROXY=https://goproxy.io + password: + from_secret: docker_password + username: + from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1026,8 +1314,11 @@ platform: arch: amd64 depends_on: - - testing-amd64 - - testing-arm64 + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite trigger: ref: @@ -1041,11 +1332,10 @@ steps: image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: false @@ -1057,13 +1347,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: false @@ -1075,6 +1369,10 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1089,8 +1387,11 @@ platform: arch: amd64 depends_on: - - testing-amd64 - - testing-arm64 + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite trigger: ref: @@ -1104,11 +1405,10 @@ steps: image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: false @@ -1120,13 +1420,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: false @@ -1138,6 +1442,10 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1156,12 +1464,15 @@ depends_on: - compliance trigger: - ref: - - "refs/pull/**" + event: + - pull_request + paths: + exclude: + - docs/** steps: - name: dryrun - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: dry_run: true @@ -1172,6 +1483,7 @@ steps: environment: PLUGIN_MIRROR: from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: - pull_request @@ -1186,26 +1498,34 @@ platform: arch: arm64 depends_on: - - testing-amd64 - - testing-arm64 + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite trigger: ref: - - "refs/tags/**" + include: + - "refs/tags/**" + exclude: + - "refs/tags/**-rc*" event: exclude: - cron + paths: + exclude: + - docs/** steps: - name: fetch-tags image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: true @@ -1217,13 +1537,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: true @@ -1235,6 +1559,85 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 + when: + event: + exclude: + - pull_request + +--- +kind: pipeline +type: docker +name: docker-linux-arm64-release-candidate-version + +platform: + os: linux + arch: arm64 + +depends_on: + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite + +trigger: + ref: + - "refs/tags/**-rc*" + event: + exclude: + - cron + paths: + exclude: + - docs/** + +steps: + - name: fetch-tags + image: docker:git + pull: always + commands: + - git fetch --tags --force + + - name: publish + image: plugins/docker:latest + pull: always + settings: + tags: ${DRONE_TAG##v}-linux-arm64 + repo: gitea/gitea + build_args: + - GOPROXY=https://goproxy.io + password: + from_secret: docker_password + username: + from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 + when: + event: + exclude: + - pull_request + + - name: publish-rootless + image: plugins/docker:latest + settings: + dockerfile: Dockerfile.rootless + tags: ${DRONE_TAG##v}-linux-arm64-rootless + repo: gitea/gitea + build_args: + - GOPROXY=https://goproxy.io + password: + from_secret: docker_password + username: + from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1250,8 +1653,11 @@ platform: arch: arm64 depends_on: - - testing-amd64 - - testing-arm64 + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite trigger: ref: @@ -1259,17 +1665,19 @@ trigger: event: exclude: - cron + paths: + exclude: + - docs/** steps: - name: fetch-tags image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: false @@ -1281,13 +1689,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: false @@ -1299,6 +1711,10 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1313,8 +1729,11 @@ platform: arch: arm64 depends_on: - - testing-amd64 - - testing-arm64 + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite trigger: ref: @@ -1328,11 +1747,10 @@ steps: image: docker:git pull: always commands: - - git config --global --add safe.directory /drone/src - git fetch --tags --force - name: publish - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest pull: always settings: auto_tag: false @@ -1344,13 +1762,17 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: - pull_request - name: publish-rootless - image: techknowlogick/drone-docker:latest + image: plugins/docker:latest settings: dockerfile: Dockerfile.rootless auto_tag: false @@ -1362,6 +1784,10 @@ steps: from_secret: docker_password username: from_secret: docker_username + environment: + PLUGIN_MIRROR: + from_secret: plugin_mirror + DOCKER_BUILDKIT: 1 when: event: exclude: @@ -1406,10 +1832,15 @@ trigger: event: exclude: - cron + paths: + exclude: + - docs/** depends_on: - docker-linux-amd64-release-version + - docker-linux-amd64-release-candidate-version - docker-linux-arm64-release-version + - docker-linux-arm64-release-candidate-version --- kind: pipeline @@ -1422,7 +1853,6 @@ platform: steps: - name: manifest-rootless - pull: always image: plugins/manifest pull: always settings: @@ -1452,6 +1882,9 @@ trigger: event: exclude: - cron + paths: + exclude: + - docs/** depends_on: - docker-linux-amd64-release @@ -1483,14 +1916,19 @@ trigger: - failure depends_on: - - testing-amd64 - - testing-arm64 + - testing-mysql + - testing-mysql8 + - testing-mssql + - testing-pgsql + - testing-sqlite - release-version - release-latest - docker-linux-amd64-release - docker-linux-arm64-release - docker-linux-amd64-release-version - docker-linux-arm64-release-version + - docker-linux-amd64-release-candidate-version + - docker-linux-arm64-release-candidate-version - docker-linux-amd64-release-branch - docker-linux-arm64-release-branch - docker-manifest diff --git a/.eslintrc.yaml b/.eslintrc.yaml index fdd86a4647e14..a73df2ee344ce 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -149,7 +149,7 @@ rules: jquery/no-global-eval: [2] jquery/no-grep: [2] jquery/no-has: [2] - jquery/no-hide: [0] + jquery/no-hide: [2] jquery/no-html: [0] jquery/no-in-array: [2] jquery/no-is-array: [2] @@ -166,13 +166,13 @@ rules: jquery/no-proxy: [2] jquery/no-ready: [0] jquery/no-serialize: [2] - jquery/no-show: [0] + jquery/no-show: [2] jquery/no-size: [2] jquery/no-sizzle: [0] jquery/no-slide: [0] jquery/no-submit: [0] jquery/no-text: [0] - jquery/no-toggle: [0] + jquery/no-toggle: [2] jquery/no-trigger: [0] jquery/no-trim: [2] jquery/no-val: [0] diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3a12bb8f721e6..b752abb794dec 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,9 +1,9 @@ - Please check the following: - -1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for bug fixes. -2. Read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md -3. Describe what your pull request does and which issue you're targeting (if any) - ---> +1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for backports. +2. Make sure you have read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md . +3. Describe what your pull request does and which issue you're targeting (if any). +4. It is recommended to enable "Allow edits by maintainers", so maintainers can help more easily. +5. Your input here will be included in the commit message when this PR has been merged. If you don't want some content to be included, please separate them with a line like `---`. +6. Delete all these tips before posting. + diff --git a/.gitpod.yml b/.gitpod.yml index a184e6376ebb3..506c620458354 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -10,9 +10,12 @@ tasks: - name: Run backend command: | gp sync-await setup - mkdir -p custom/conf/ - echo -e "[server]\nROOT_URL=$(gp url 3000)/" > custom/conf/app.ini - echo -e "\n[database]\nDB_TYPE = sqlite3\nPATH = $GITPOD_REPO_ROOT/data/gitea.db" >> custom/conf/app.ini + if [ ! -f custom/conf/app.ini ] + then + mkdir -p custom/conf/ + echo -e "[server]\nROOT_URL=$(gp url 3000)/" > custom/conf/app.ini + echo -e "\n[database]\nDB_TYPE = sqlite3\nPATH = $GITPOD_REPO_ROOT/data/gitea.db" >> custom/conf/app.ini + fi export TAGS="sqlite sqlite_unlock_notify" make watch-backend - name: Run frontend diff --git a/.golangci.yml b/.golangci.yml index 7635e83a37260..263149f773ecb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -28,7 +28,7 @@ linters: fast: false run: - go: 1.19 + go: "1.20" timeout: 10m skip-dirs: - node_modules @@ -74,7 +74,7 @@ linters-settings: - name: modifies-value-receiver gofumpt: extra-rules: true - lang-version: "1.19" + lang-version: "1.20" depguard: list-type: denylist # Check the list against standard lib. @@ -84,6 +84,7 @@ linters-settings: - github.com/unknwon/com: "use gitea's util and replacements" - io/ioutil: "use os or io instead" - golang.org/x/exp: "it's experimental and unreliable." + - code.gitea.io/gitea/modules/git/internal: "do not use the internal package, use AddXxx function instead" issues: max-issues-per-linter: 0 diff --git a/.npmrc b/.npmrc index 8dcb4185bd412..d9207e7f82099 100644 --- a/.npmrc +++ b/.npmrc @@ -3,3 +3,4 @@ fund=false update-notifier=false package-lock=true save-exact=true +lockfile-version=3 diff --git a/.stylelintrc.yaml b/.stylelintrc.yaml index d51a08bf8e596..62660fcf94409 100644 --- a/.stylelintrc.yaml +++ b/.stylelintrc.yaml @@ -1,44 +1,137 @@ -extends: stylelint-config-standard - plugins: - stylelint-declaration-strict-value +ignoreFiles: + - "**/*.go" + overrides: - - files: ["**/*.less"] - customSyntax: postcss-less - - files: ["**/*.less"] - rules: - scale-unlimited/declaration-strict-value: [color, { - ignoreValues: /^(inherit|transparent|unset|initial)$/ - }] - files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console/*"] rules: scale-unlimited/declaration-strict-value: null + - files: ["**/chroma/*", "**/codemirror/*"] + rules: + block-no-empty: null rules: alpha-value-notation: null + annotation-no-unknown: true + at-rule-allowed-list: null + at-rule-disallowed-list: null at-rule-empty-line-before: null - block-closing-brace-empty-line-before: null + at-rule-no-unknown: true + at-rule-no-vendor-prefix: true + at-rule-property-required-list: null + block-no-empty: true color-function-notation: null + color-hex-alpha: null color-hex-length: null + color-named: null + color-no-hex: null + color-no-invalid-hex: true comment-empty-line-before: null + comment-no-empty: true + comment-pattern: null + comment-whitespace-inside: null + comment-word-disallowed-list: null + custom-media-pattern: null + custom-property-empty-line-before: null + custom-property-no-missing-var-function: true + custom-property-pattern: null + declaration-block-no-duplicate-custom-properties: true + declaration-block-no-duplicate-properties: [true, {ignore: [consecutive-duplicates-with-different-values]}] declaration-block-no-redundant-longhand-properties: null + declaration-block-no-shorthand-property-overrides: null declaration-block-single-line-max-declarations: null declaration-empty-line-before: null + declaration-no-important: null + declaration-property-max-values: null + declaration-property-unit-allowed-list: null + declaration-property-unit-disallowed-list: null + declaration-property-value-allowed-list: null + declaration-property-value-disallowed-list: null + declaration-property-value-no-unknown: true + font-family-name-quotes: always-where-recommended + font-family-no-duplicate-names: true + font-family-no-missing-generic-family-keyword: true + font-weight-notation: null + function-allowed-list: null + function-calc-no-unspaced-operator: true + function-disallowed-list: null + function-linear-gradient-no-nonstandard-direction: true + function-name-case: lower function-no-unknown: null + function-url-no-scheme-relative: null + function-url-quotes: always + function-url-scheme-allowed-list: null + function-url-scheme-disallowed-list: null hue-degree-notation: null import-notation: string - indentation: 2 - max-line-length: null + keyframe-block-no-duplicate-selectors: true + keyframe-declaration-no-important: true + keyframe-selector-notation: null + keyframes-name-pattern: null + length-zero-no-unit: true + max-nesting-depth: null + media-feature-name-allowed-list: null + media-feature-name-disallowed-list: null + media-feature-name-no-unknown: true + media-feature-name-no-vendor-prefix: true + media-feature-name-unit-allowed-list: null + media-feature-name-value-allowed-list: null + media-feature-range-notation: null + named-grid-areas-no-invalid: true no-descending-specificity: null + no-duplicate-at-import-rules: true + no-duplicate-selectors: true + no-empty-source: true + no-invalid-double-slash-comments: true no-invalid-position-at-import-rule: null - number-leading-zero: never + no-irregular-whitespace: true + no-unknown-animations: null number-max-precision: null + property-allowed-list: null + property-disallowed-list: null + property-no-unknown: true property-no-vendor-prefix: null rule-empty-line-before: null + rule-selector-property-disallowed-list: null + scale-unlimited/declaration-strict-value: [color, {ignoreValues: /^(inherit|transparent|unset|initial|currentcolor)$/}] + selector-attribute-name-disallowed-list: null + selector-attribute-operator-allowed-list: null + selector-attribute-operator-disallowed-list: null + selector-attribute-quotes: always selector-class-pattern: null + selector-combinator-allowed-list: null + selector-combinator-disallowed-list: null + selector-disallowed-list: null selector-id-pattern: null + selector-max-attribute: null + selector-max-class: null + selector-max-combinators: null + selector-max-compound-selectors: null + selector-max-id: null + selector-max-pseudo-class: null + selector-max-specificity: null + selector-max-type: null + selector-max-universal: null + selector-nested-pattern: null + selector-no-qualifying-type: null + selector-no-vendor-prefix: true + selector-not-notation: null + selector-pseudo-class-allowed-list: null + selector-pseudo-class-disallowed-list: null + selector-pseudo-class-no-unknown: true + selector-pseudo-element-allowed-list: null selector-pseudo-element-colon-notation: double + selector-pseudo-element-disallowed-list: null + selector-pseudo-element-no-unknown: true + selector-type-case: lower + selector-type-no-unknown: [true, {ignore: [custom-elements]}] shorthand-property-no-redundant-values: true - string-quotes: null - value-no-vendor-prefix: null + string-no-newline: true + time-min-milliseconds: null + unit-allowed-list: null + unit-disallowed-list: null + unit-no-unknown: true + value-keyword-case: null + value-no-vendor-prefix: [true, {ignoreValues: [box, inline-box]}] diff --git a/CHANGELOG.md b/CHANGELOG.md index 18b52673a026a..324b0cdfd6023 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,406 @@ This changelog goes through all the changes that have been made in each release without substantial changes to our git log; to see the highlights of what has been added to each release, please refer to the [blog](https://blog.gitea.io). +## [1.19.0](https://github.com/go-gitea/gitea/releases/tag/1.19.0) - 2023-03-19 + +* BREAKING + * Add loading yaml label template files (#22976) (#23232) + * Make issue and code search support camel case for Bleve (#22829) + * Repositories: by default disable all units except code and pulls on forks (#22541) + * Support template for merge message description (#22248) + * Remove ONLY_SHOW_RELEVANT_REPOS setting (#21962) + * Implement actions (#21937) + * Remove deprecated DSA host key from Docker Container (#21522) + * Improve valid user name check (#20136) +* SECURITY + * Return 404 instead of 403 if user can not access the repo (#23155) (#23158) + * Support scoped access tokens (#20908) +* FEATURES + * Add support for commit cross references (#22645) + * Scoped labels (#22585) + * Add Chef package registry (#22554) + * Support asciicast files as new markup (#22448) + * cgo cross-compile for freebsd (#22397) + * Add cron method to gc LFS MetaObjects (#22385) + * Add new captcha: cloudflare turnstile (#22369) + * Enable `@`- completion popup on the release description textarea (#22359) + * make /{username}.png redirect to user/org avatar (#22356) + * Add Conda package registry (#22262) + * Support org/user level projects (#22235) + * Add Mermaid copy button (#22225) + * Add user secrets (#22191) + * Secrets storage with SecretKey encrypted (#22142) + * Preview images for Issue cards in Project Board view (#22112) + * Add support for incoming emails (#22056) + * Add Cargo package registry (#21888) + * Add option to prohibit fork if user reached maximum limit of repositories (#21848) + * Add attention blocks within quote blocks for `Note` and `Warning` (#21711) + * Add Feed for Releases and Tags (#21696) + * Add package registry cleanup rules (#21658) + * Add "Copy" button to file view of raw text (#21629) + * Allow disable sitemap (#21617) + * Add package registry quota limits (#21584) + * Map OIDC groups to Orgs/Teams (#21441) + * Keep languages defined in .gitattributes (#21403) + * Add Webhook authorization header (#20926) + * Supports wildcard protected branch (#20825) + * Copy citation file content, in APA and BibTex format, on repo home page (#19999) +* API + * Match api migration behavior to web behavior (#23552) (#23573) + * Purge API comment (#23451) (#23452) + * User creation API: allow custom "created" timestamps (#22549) + * Add `updated_at` field to PullReview API object (#21812) + * Add API management for issue/pull and comment attachments (#21783) + * Add API endpoint to get latest release (#21267) + * Support system hook API (#14537) +* ENHANCEMENTS + * Add `.patch` to `attachment.ALLOWED_TYPES` (#23580) (#23582) + * Fix sticky header in diff view (#23554) (#23568) + * Refactor merge/update git command calls (#23366) (#23544) + * Fix review comment context menu clipped bug (#23523) (#23543) + * Imrove scroll behavior to hash issuecomment(scroll position, auto expand if file is folded, and on refreshing) (#23513) (#23540) + * Increase horizontal page padding (#23507) (#23537) + * Use octicon-verified for gpg signatures (#23529) (#23536) + * Make time tooltips interactive (#23526) (#23527) + * Replace Less with CSS (#23508) + * Fix 'View File' button in code search (#23478) (#23483) + * Convert GitHub event on actions and fix some pull_request events. (#23037) (#23471) + * Support reflogs (#22451) (#23438) + * Fix actions frontend bugs (pagination, long name alignment) and small simplify (#23370) (#23436) + * Scoped label display and documentation tweaks (#23430) (#23433) + * Add missing tabs to org projects page (#22705) (#23412) + * Fix and move "Use this template" button (#23398) (#23408) + * Handle OpenID discovery URL errors a little nicer when creating/editing sources (#23397) (#23403) + * Rename `canWriteUnit` to `canWriteProjects` (#23386) (#23399) + * Refactor and tidy-up the merge/update branch code (#22568) (#23365) + * Refactor `setting.Database.UseXXX` to methods (#23354) (#23356) + * Fix incorrect project links and use symlink icon for org-wide projects (#23325) (#23336) + * Fix PR view misalignment caused by long name file (#23321) (#23335) + * Scoped labels: don't require holding alt key to remove (#23303) (#23331) + * Add context when rendering labels or emojis (#23281) (#23319) + * Change interactiveBorder to fix popup preview (#23169) (#23314) + * Scoped labels: set aria-disabled on muted Exclusive option for a11y (#23306) (#23311) + * update to mermaid v10 (#23178) (#23299) + * Fix code wrap for unbroken lines (#23268) (#23293) + * Use async await to fix empty quote reply at first time (#23168) (#23256) + * Fix switched citation format (#23250) (#23253) + * Allow `