diff --git a/.gitattributes b/.gitattributes index afd02555f59..3ddb8f641ba 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ /assets/*.json linguist-generated /public/assets/img/svg/*.svg linguist-generated /templates/swagger/v1_json.tmpl linguist-generated +/templates/swagger/v1_openapi3_json.tmpl linguist-generated /options/fileicon/** linguist-generated /vendor/** -text -eol linguist-vendored /web_src/js/vendor/** -text -eol linguist-vendored diff --git a/.gitea/issue_template.md b/.gitea/issue_template.md deleted file mode 100644 index cf173a67cae..00000000000 --- a/.gitea/issue_template.md +++ /dev/null @@ -1,42 +0,0 @@ - - - - -- Gitea version (or commit ref): -- Git version: -- Operating system: - - - -- Database (use `[x]`): - - [ ] PostgreSQL - - [ ] MySQL - - [ ] MSSQL - - [ ] SQLite -- Can you reproduce the bug at https://demo.gitea.com: - - [ ] Yes (provide example URL) - - [ ] No -- Log gist: - - - - -## Description - - -... - - -## Screenshots - - diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml index 4dbe1a4c56d..e793e068bb8 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yaml +++ b/.github/ISSUE_TEMPLATE/bug-report.yaml @@ -1,91 +1,28 @@ name: Bug Report -description: Found something you weren't expecting? Report it here! +description: Something isn't working as expected. labels: ["type/bug"] body: - type: markdown attributes: value: | - NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue. - - type: markdown - attributes: - value: | - 1. Please speak English, this is the language all maintainers can speak and write. - 2. Please ask questions or configuration/deploy problems on our Discord - server (https://discord.gg/gitea) or forum (https://forum.gitea.com). - 3. Make sure you are using the latest release and - take a moment to check that your issue hasn't been reported before. - 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq) - 5. It's really important to provide pertinent details and logs (https://docs.gitea.com/help/support), - incomplete details will be handled as an invalid report. - - type: textarea - id: description - attributes: - label: Description - description: | - Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below) - If you are using a proxy or a CDN (e.g. Cloudflare) in front of Gitea, please disable the proxy/CDN fully and access Gitea directly to confirm the issue still persists without those services. + - **Security issue?** Email security@gitea.io instead of opening a public issue. + - **Need help** with setup or configuration? Ask on [Discord](https://discord.gg/Gitea) or the [forum](https://forum.gitea.com). + - Search [existing issues](https://github.com/go-gitea/gitea/issues?q=is%3Aissue) first. - type: input id: gitea-ver attributes: label: Gitea Version - description: Gitea version (or commit reference) of your instance validations: required: true - - type: dropdown - id: can-reproduce + - type: textarea + id: description attributes: - label: Can you reproduce the bug on the Gitea demo site? - description: | - If so, please provide a URL in the Description field - URL of Gitea demo: https://demo.gitea.com - options: - - "Yes" - - "No" + label: What happened? + description: What you did, what you expected to happen, and what happened instead. Include logs if relevant. validations: required: true - - type: markdown - attributes: - value: | - It's really important to provide pertinent logs - Please read https://docs.gitea.com/administration/logging-config#collecting-logs-for-help - In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini - - type: input - id: logs - attributes: - label: Log Gist - description: Please provide a gist URL of your logs, with any sensitive information (e.g. API keys) removed/hidden - type: textarea - id: screenshots - attributes: - label: Screenshots - description: If this issue involves the Web Interface, please provide one or more screenshots - - type: input - id: git-ver - attributes: - label: Git Version - description: The version of git running on the server - - type: input - id: os-ver - attributes: - label: Operating System - description: The operating system you are using to run Gitea - - type: textarea - id: run-info + id: environment attributes: label: How are you running Gitea? - description: | - Please include information on whether you built Gitea yourself, used one of our downloads, are using https://demo.gitea.com or are using some other package - Please also tell us how you are running Gitea, e.g. if it is being run from docker, a command-line, systemd etc. - If you are using a package or systemd tell us what distribution you are using - validations: - required: true - - type: dropdown - id: database - attributes: - label: Database - description: What database system are you running? - options: - - PostgreSQL - - MySQL/MariaDB - - MSSQL - - SQLite + description: Install method (binary, Docker, package), operating system, and database. diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml index d5c480d2023..3ad0fb9e643 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yaml +++ b/.github/ISSUE_TEMPLATE/feature-request.yaml @@ -1,24 +1,20 @@ name: Feature Request -description: Got an idea for a feature that Gitea doesn't have currently? Submit your idea here! +description: Suggest an idea for Gitea. labels: ["type/proposal"] body: - type: markdown attributes: value: | - 1. Please speak English, this is the language all maintainers can speak and write. - 2. Please ask questions or configuration/deploy problems on our Discord - server (https://discord.gg/gitea) or forum (https://forum.gitea.com). - 3. Please take a moment to check that your feature hasn't already been suggested. + Search [existing issues](https://github.com/go-gitea/gitea/issues?q=is%3Aissue) first. - type: textarea - id: description + id: problem attributes: - label: Feature Description - placeholder: | - I think it would be great if Gitea had... + label: What problem would this solve? validations: required: true - type: textarea - id: screenshots + id: proposal attributes: - label: Screenshots - description: If you can, provide screenshots of an implementation on another site e.g. GitHub + label: What do you propose? + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/ui.bug-report.yaml b/.github/ISSUE_TEMPLATE/ui.bug-report.yaml deleted file mode 100644 index 3ad5dbaf54e..00000000000 --- a/.github/ISSUE_TEMPLATE/ui.bug-report.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: Web Interface Bug Report -description: Something doesn't look quite as it should? Report it here! -labels: ["type/bug", "topic/ui"] -body: - - type: markdown - attributes: - value: | - NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue. - - type: markdown - attributes: - value: | - 1. Please speak English, this is the language all maintainers can speak and write. - 2. Please ask questions or configuration/deploy problems on our Discord - server (https://discord.gg/gitea) or forum (https://forum.gitea.com). - 3. Please take a moment to check that your issue doesn't already exist. - 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.com/help/faq) - 5. Please give all relevant information below for bug reports, because - incomplete details will be handled as an invalid report. - 6. In particular it's really important to provide pertinent logs. If you are certain that this is a javascript - error, show us the javascript console. If the error appears to relate to Gitea the server you must also give us - DEBUG level logs. (See https://docs.gitea.com/administration/logging-config#collecting-logs-for-help) - - type: textarea - id: description - attributes: - label: Description - description: | - Please provide a description of your issue here, with a URL if you were able to reproduce the issue (see below) - If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services. - - type: textarea - id: screenshots - attributes: - label: Screenshots - description: Please provide at least 1 screenshot showing the issue. - validations: - required: true - - type: input - id: gitea-ver - attributes: - label: Gitea Version - description: Gitea version (or commit reference) your instance is running - validations: - required: true - - type: dropdown - id: can-reproduce - attributes: - label: Can you reproduce the bug on the Gitea demo site? - description: | - If so, please provide a URL in the Description field - URL of Gitea demo: https://demo.gitea.com - options: - - "Yes" - - "No" - validations: - required: true - - type: input - id: os-ver - attributes: - label: Operating System - description: The operating system you are using to access Gitea - - type: input - id: browser-ver - attributes: - label: Browser Version - description: The browser and version that you are using to access Gitea - validations: - required: true diff --git a/.github/actions/docker-dryrun/action.yml b/.github/actions/docker-dryrun/action.yml index d280ea26ce7..e9cd88d46f6 100644 --- a/.github/actions/docker-dryrun/action.yml +++ b/.github/actions/docker-dryrun/action.yml @@ -9,10 +9,10 @@ inputs: runs: using: composite steps: - - uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 - - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 + - uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 + - uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 - name: Build regular image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: context: . platforms: ${{ inputs.platform }} @@ -20,7 +20,7 @@ runs: file: Dockerfile cache-from: type=registry,ref=ghcr.io/go-gitea/gitea:buildcache-rootful - name: Build rootless image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: context: . platforms: ${{ inputs.platform }} diff --git a/.github/actions/free-disk-space/action.yml b/.github/actions/free-disk-space/action.yml new file mode 100644 index 00000000000..510b643a334 --- /dev/null +++ b/.github/actions/free-disk-space/action.yml @@ -0,0 +1,9 @@ +name: free-disk-space +description: Free space on / before large cache restores + +# Delete preinstalled toolchains which gitea doesn't use +runs: + using: composite + steps: + - shell: bash + run: sudo rm -rf /usr/local/lib/android /usr/local/.ghcup /opt/ghc /usr/share/dotnet diff --git a/.github/actions/go-cache/action.yml b/.github/actions/go-cache/action.yml index 04d4bac3673..7096fa3952c 100644 --- a/.github/actions/go-cache/action.yml +++ b/.github/actions/go-cache/action.yml @@ -1,47 +1,51 @@ name: go-caches -description: Restore and save go module, build, and golangci-lint caches +description: Restore the go module, build, and golangci-lint caches. Save only on the cache-seeder workflow. + +# Only the cache-seeder workflow saves; rename requires updating cache-seeder.yml. +# The lint job restores but does not save the gobuild cache, so only one writer +# (the gobuild job) populates it and there is no contention on the cache key. inputs: - cache-name: - description: Short identifier used in the per-caller build cache key - required: true - build-cache: - description: Whether to include ~/.cache/go-build - default: "true" - build-cache-rotate: - description: Whether to rotate the build cache key per run so Go's test result cache can accumulate across runs - default: "false" lint-cache: - description: Whether to include ~/.cache/golangci-lint + description: Restore (and save in cache-seeder) ~/.cache/golangci-lint default: "false" runs: using: composite steps: - - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - if: ${{ github.workflow == 'cache-seeder' }} + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/go/pkg/mod key: gomod-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} restore-keys: gomod-${{ runner.os }}-${{ runner.arch }} - - if: ${{ inputs.build-cache == 'true' && inputs.build-cache-rotate == 'true' }} - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + - if: ${{ github.workflow != 'cache-seeder' }} + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: - path: ~/.cache/go-build - key: gobuild-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}-${{ hashFiles('go.sum') }}-${{ github.run_id }} - restore-keys: | - gobuild-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}-${{ hashFiles('go.sum') }} - gobuild-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }} - gobuild-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} - gobuild-${{ runner.os }}-${{ runner.arch }} - - if: ${{ inputs.build-cache == 'true' && inputs.build-cache-rotate != 'true' }} + path: ~/go/pkg/mod + key: gomod-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} + restore-keys: gomod-${{ runner.os }}-${{ runner.arch }} + - if: ${{ github.workflow == 'cache-seeder' && inputs.lint-cache != 'true' }} uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/.cache/go-build key: gobuild-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} restore-keys: gobuild-${{ runner.os }}-${{ runner.arch }} - - if: ${{ inputs.lint-cache == 'true' }} + - if: ${{ github.workflow != 'cache-seeder' || inputs.lint-cache == 'true' }} + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/.cache/go-build + key: gobuild-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum') }} + restore-keys: gobuild-${{ runner.os }}-${{ runner.arch }} + - if: ${{ inputs.lint-cache == 'true' && github.workflow == 'cache-seeder' }} uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 with: path: ~/.cache/golangci-lint - key: golangci-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }}-${{ hashFiles('go.sum', '.golangci.yml') }} - restore-keys: golangci-${{ runner.os }}-${{ runner.arch }}-${{ inputs.cache-name }} + key: golint-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum', '.golangci.yml') }} + restore-keys: golint-${{ runner.os }}-${{ runner.arch }} + - if: ${{ inputs.lint-cache == 'true' && github.workflow != 'cache-seeder' }} + uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 + with: + path: ~/.cache/golangci-lint + key: golint-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('go.sum', '.golangci.yml') }} + restore-keys: golint-${{ runner.os }}-${{ runner.arch }} diff --git a/.github/actions/go-setup/action.yml b/.github/actions/go-setup/action.yml new file mode 100644 index 00000000000..a99ef0629ac --- /dev/null +++ b/.github/actions/go-setup/action.yml @@ -0,0 +1,24 @@ +name: go-setup +description: Set up go and restore caches + +inputs: + cache: + description: Restore go caches + default: "true" + lint-cache: + description: Also restore the golangci-lint cache + default: "false" + +runs: + using: composite + steps: + - uses: ./.github/actions/free-disk-space + - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + with: + go-version-file: go.mod + check-latest: true + cache: false + - if: ${{ inputs.cache == 'true' }} + uses: ./.github/actions/go-cache + with: + lint-cache: ${{ inputs.lint-cache }} diff --git a/.github/actions/node-setup/action.yml b/.github/actions/node-setup/action.yml new file mode 100644 index 00000000000..c9ab484d57e --- /dev/null +++ b/.github/actions/node-setup/action.yml @@ -0,0 +1,22 @@ +name: node-setup +description: Set up pnpm and node and restore caches + +inputs: + cache: + description: Cache pnpm downloads + default: "true" + +runs: + using: composite + steps: + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 + - if: ${{ inputs.cache == 'true' }} + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: 24 + cache: pnpm + cache-dependency-path: pnpm-lock.yaml + - if: ${{ inputs.cache != 'true' }} + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: 24 diff --git a/.github/actions/pgsql-shard/action.yml b/.github/actions/pgsql-shard/action.yml new file mode 100644 index 00000000000..9a5a03ae0de --- /dev/null +++ b/.github/actions/pgsql-shard/action.yml @@ -0,0 +1,40 @@ +name: pgsql-shard +description: Run one pgsql integration test shard + +inputs: + shard: + description: Shard index + required: true + total-shards: + description: Total shard count + required: true + run-migration: + description: Also run migration tests + default: "false" + +runs: + using: composite + steps: + - name: Add hosts to /etc/hosts + shell: bash + run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts' + - shell: bash + run: make deps-backend + - shell: bash + run: make backend + env: + TAGS: bindata + - name: run migration tests + if: ${{ inputs.run-migration == 'true' }} + shell: bash + run: GITEA_TEST_DATABASE=pgsql make test-migration + - name: run tests + shell: bash + run: GITEA_TEST_DATABASE=pgsql make test-integration + env: + # pgsql is chosen to be the unlucky one to run with the slow "race detector", it is about 60% slower. + GOTEST_FLAGS: -race -timeout=40m + TAGS: bindata gogit + TEST_LDAP: 1 + TEST_SHARD: ${{ inputs.shard }} + TEST_TOTAL_SHARDS: ${{ inputs.total-shards }} diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b7594a1ba7f..6ae22da7be2 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,10 +1,9 @@ - -Please check the following: -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. For documentations contribution, please go to https://gitea.com/gitea/docs -4. Describe what your pull request does and which issue you're targeting (if any). -5. It is recommended to enable "Allow edits by maintainers", so maintainers can help more easily. -6. 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 `---`. -7. Delete all these tips before posting. - + diff --git a/.github/workflows/cache-seeder.yml b/.github/workflows/cache-seeder.yml index cd086fae17f..8ec7adee07d 100644 --- a/.github/workflows/cache-seeder.yml +++ b/.github/workflows/cache-seeder.yml @@ -1,15 +1,9 @@ -# Populates the go module, build, and golangci-lint caches under the default -# branch's cache scope so that PR runs have a warm fallback to restore from. +# Populates main's cache scope so PR runs warm-start from it. Saves the go +# module, go build (incl. test compile), and golangci-lint caches. # -# GitHub Actions caches are scoped per ref: a PR run can only write to its own -# branch's scope, but can read from the base branch's scope as a fallback. -# PRs therefore cannot seed main's scope themselves. Running the same cache -# steps on push-to-main is the only opportunity to populate that fallback -# scope so fresh PR branches start with a useful cache on first run. - -# A PR job's exact key lives in its own PR-scope (empty on first run, filled -# by later runs of the same PR); on miss, actions/cache's restore-keys fall -# back to prefix matches against entries this seeder saves in main's scope. +# Caches are ref-scoped: PR runs read their own scope then fall back to the +# base branch. Per .github/actions/go-cache/action.yml, PRs are restore-only, +# so push-to-main is the only opportunity to populate the fallback scope. name: cache-seeder @@ -21,6 +15,7 @@ on: - "go.sum" - ".golangci.yml" - ".github/actions/go-cache/action.yml" + - ".github/actions/go-setup/action.yml" - ".github/workflows/cache-seeder.yml" concurrency: @@ -35,18 +30,26 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: seed - - run: make deps-backend + - uses: ./.github/actions/go-setup + - run: make deps-backend deps-tools - run: TAGS="bindata" make backend - - run: TAGS="bindata sqlite sqlite_unlock_notify" make backend - - run: TAGS="bindata gogit sqlite sqlite_unlock_notify" GOEXPERIMENT="" make backend + - run: TAGS="bindata gogit" GOEXPERIMENT="" make backend + - name: warm test compile cache (bindata) + env: + TAGS: bindata + GOTEST_FLAGS: -race -list=^$$ -count=1 + run: make test-backend + - name: warm test compile cache (bindata gogit) + env: + TAGS: bindata gogit + GOEXPERIMENT: + GOTEST_FLAGS: -race -list=^$$ -count=1 + run: make test-backend + - name: warm integration compile cache + run: | + TAGS="bindata" make test-integration-compile + TAGS="bindata gogit" GOEXPERIMENT="" make test-integration-compile + TAGS="bindata gogit" GOTEST_FLAGS="-race" make test-integration-compile lint: runs-on: ubuntu-latest @@ -54,21 +57,16 @@ jobs: fail-fast: false matrix: include: - - { job: lint-backend, tags: "bindata sqlite sqlite_unlock_notify", target: "lint-backend" } - - { job: lint-go-windows, tags: "bindata sqlite sqlite_unlock_notify", target: "lint-go-windows" } - - { job: lint-go-gogit, tags: "bindata gogit sqlite sqlite_unlock_notify", target: "lint-go" } + - { tags: "bindata", target: "lint-backend" } steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + - uses: ./.github/actions/go-setup with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: ${{ matrix.job }} lint-cache: "true" - run: make deps-backend deps-tools + - run: make generate-go + env: + TAGS: ${{ matrix.tags }} - run: make ${{ matrix.target }} env: TAGS: ${{ matrix.tags }} diff --git a/.github/workflows/cron-renovate.yml b/.github/workflows/cron-renovate.yml index 39bcf26ac98..a50af530f20 100644 --- a/.github/workflows/cron-renovate.yml +++ b/.github/workflows/cron-renovate.yml @@ -2,7 +2,7 @@ name: cron-renovate on: schedule: - - cron: "0 1 * * *" # daily at 01:00 UTC + - cron: "23 * * * *" # hourly at :23 workflow_dispatch: concurrency: @@ -21,7 +21,7 @@ jobs: timeout-minutes: 30 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: renovatebot/github-action@83ec54fee49ab67d9cd201084c1ff325b4b462e4 # v46.1.10 + - uses: renovatebot/github-action@693b9ef15eec82123529a37c782242f091365961 # v46.1.14 with: renovate-version: ${{ env.RENOVATE_VERSION }} configurationFile: renovate.json5 diff --git a/.github/workflows/files-changed.yml b/.github/workflows/files-changed.yml index 78915d81ea4..c17afbca97f 100644 --- a/.github/workflows/files-changed.yml +++ b/.github/workflows/files-changed.yml @@ -25,6 +25,8 @@ on: value: ${{ jobs.detect.outputs.json }} e2e: value: ${{ jobs.detect.outputs.e2e }} + shell: + value: ${{ jobs.detect.outputs.shell }} permissions: contents: read @@ -45,6 +47,7 @@ jobs: yaml: ${{ steps.changes.outputs.yaml }} json: ${{ steps.changes.outputs.json }} e2e: ${{ steps.changes.outputs.e2e }} + shell: ${{ steps.changes.outputs.shell }} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 @@ -63,44 +66,46 @@ jobs: - "options/locale/locale_en-US.json" frontend: - - "*.js" - "*.ts" - "web_src/**" - - "tools/*.js" - - "tools/*.ts" + - "tools/generate-svg.ts" + - "tools/generate-svg-vscode-extensions.json" + - "tsconfig.json" - "assets/emoji.json" - "package.json" - "pnpm-lock.yaml" + - "pnpm-workspace.yaml" - "Makefile" - - ".eslintrc.cjs" - - ".npmrc" docs: - "**/*.md" - ".markdownlint.yaml" - "package.json" - "pnpm-lock.yaml" + - "pnpm-workspace.yaml" actions: - ".github/workflows/*" + - ".github/actions/**" - "Makefile" templates: - - "tools/lint-templates-*.js" + - "tools/lint-templates-*.ts" - "templates/**/*.tmpl" - "pyproject.toml" - "uv.lock" docker: - ".github/workflows/pull-docker-dryrun.yml" + - ".github/actions/docker-dryrun/**" - "Dockerfile" - "Dockerfile.rootless" - "docker/**" - "Makefile" dockerfile: - - "Dockerfile" - - "Dockerfile.rootless" + - "Dockerfile" + - "Dockerfile.rootless" swagger: - "templates/swagger/v1_json.tmpl" @@ -108,6 +113,7 @@ jobs: - "Makefile" - "package.json" - "pnpm-lock.yaml" + - "pnpm-workspace.yaml" - ".spectral.yaml" yaml: @@ -118,8 +124,14 @@ jobs: json: - "**/*.json" + - "**/*.json5" + - "eslint.json.config.ts" e2e: - "tests/e2e/**" - "tools/test-e2e.sh" - "playwright.config.ts" + + shell: + - "**/*.sh" + - ".shellcheckrc" diff --git a/.github/workflows/giteabot-backport.yml b/.github/workflows/giteabot-backport.yml new file mode 100644 index 00000000000..b90c225b4ba --- /dev/null +++ b/.github/workflows/giteabot-backport.yml @@ -0,0 +1,26 @@ +name: giteabot backport + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + +jobs: + giteabot: + if: github.repository == 'go-gitea/gitea' + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: go-gitea/giteabot@f8a6f4c14d46920b4b5448852be3de72d00066f0 # v1.0.3 + with: + github_token: ${{ secrets.GITEABOT_TOKEN }} + gitea_fork: giteabot/gitea + checks: backport diff --git a/.github/workflows/giteabot.yml b/.github/workflows/giteabot.yml new file mode 100644 index 00000000000..efa9fe047ae --- /dev/null +++ b/.github/workflows/giteabot.yml @@ -0,0 +1,51 @@ +name: giteabot + +on: + # pull_request_target gives this workflow access to GITEABOT_TOKEN on PRs from + # forks, which the bot needs to write labels, statuses and comments. Safe here + # because the job only runs a pinned action and never checks out PR HEAD. + pull_request_target: # zizmor: ignore[dangerous-triggers] + types: + - opened + - synchronize + - labeled + - unlabeled + - closed + - review_requested + - review_request_removed + pull_request_review: + types: + - submitted + - edited + - dismissed + schedule: + - cron: "15 3 * * *" + workflow_dispatch: + inputs: + checks: + description: Comma-separated list of non-backport checks to run + required: false + default: labels,merge_queue,lock,feedback,last_call,milestones,lgtm,translation_comment,pr_actions + +permissions: + contents: read + issues: write + pull-requests: write + statuses: write + +concurrency: + group: ${{ format('{0}-{1}', github.workflow, (github.event_name == 'pull_request_target' || github.event_name == 'pull_request_review') && format('pr-{0}', github.event.pull_request.number) || 'maintenance') }} + cancel-in-progress: false + +jobs: + giteabot: + if: github.repository == 'go-gitea/gitea' + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + # pull_request_review runs without repository secrets on fork PRs, so fall + # back to the workflow token for the non-backport checks handled here. + - uses: go-gitea/giteabot@f8a6f4c14d46920b4b5448852be3de72d00066f0 # v1.0.3 + with: + github_token: ${{ secrets.GITEABOT_TOKEN || github.token }} + checks: ${{ github.event.inputs.checks || 'labels,merge_queue,lock,feedback,last_call,milestones,lgtm,translation_comment,pr_actions' }} diff --git a/.github/workflows/pull-compliance.yml b/.github/workflows/pull-compliance.yml index dc46c9fa42e..801966e1444 100644 --- a/.github/workflows/pull-compliance.yml +++ b/.github/workflows/pull-compliance.yml @@ -20,43 +20,33 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + - uses: ./.github/actions/go-setup with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: lint-backend lint-cache: "true" - run: make deps-backend deps-tools + - run: TAGS="bindata" make generate-go # lint-go also lints with "bindata" tags which requires "_bindata.go" - run: make lint-backend - env: - TAGS: bindata sqlite sqlite_unlock_notify lint-on-demand: needs: files-changed runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + - uses: ./.github/actions/go-setup with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + cache: "false" + - uses: ./.github/actions/node-setup with: - node-version: 24 - cache: pnpm - cache-dependency-path: pnpm-lock.yaml + cache: "false" - run: make lint-spell - - if: needs.files-changed.outputs.templates == 'true' || needs.files-changed.outputs.yaml == 'true' + - if: needs.files-changed.outputs.templates == 'true' || needs.files-changed.outputs.yaml == 'true' || needs.files-changed.outputs.actions == 'true' uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + with: + python-version: 3.14 - if: needs.files-changed.outputs.templates == 'true' || needs.files-changed.outputs.yaml == 'true' - run: uv python install 3.14 && make deps-py lint-templates lint-yaml + run: make deps-py lint-templates lint-yaml - if: needs.files-changed.outputs.docs == 'true' || needs.files-changed.outputs.swagger == 'true' || needs.files-changed.outputs.json == 'true' run: make deps-frontend lint-md lint-swagger lint-json @@ -64,47 +54,8 @@ jobs: - if: needs.files-changed.outputs.actions == 'true' run: make lint-actions - lint-go-windows: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' - needs: files-changed - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: lint-go-windows - lint-cache: "true" - - run: make deps-backend deps-tools - - run: make lint-go-windows - env: - TAGS: bindata sqlite sqlite_unlock_notify - GOOS: windows - GOARCH: amd64 - - lint-go-gogit: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' - needs: files-changed - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: lint-go-gogit - lint-cache: "true" - - run: make deps-backend deps-tools - - run: make lint-go - env: - TAGS: bindata gogit sqlite sqlite_unlock_notify + - if: needs.files-changed.outputs.shell == 'true' + run: make lint-shell checks-backend: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' @@ -112,15 +63,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: checks-backend - build-cache: "false" + - uses: ./.github/actions/go-setup - run: make deps-backend deps-tools - run: make --always-make checks-backend # ensure the "go-licenses" make target runs @@ -130,12 +73,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 24 - cache: pnpm - cache-dependency-path: pnpm-lock.yaml + - uses: ./.github/actions/node-setup - run: make deps-frontend - run: make lint-frontend - run: make checks-frontend @@ -148,14 +86,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: compliance-backend + - uses: ./.github/actions/go-setup - run: make deps-backend generate-go # no frontend build here as backend should be able to build, even without any frontend files # CGO is not used when cross-compile, so these steps also test if the code is compatible with CGO disabled diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml index c2293ac8535..cbf86247ce1 100644 --- a/.github/workflows/pull-db-tests.yml +++ b/.github/workflows/pull-db-tests.yml @@ -14,10 +14,11 @@ jobs: files-changed: uses: ./.github/workflows/files-changed.yml - test-pgsql: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' + test-pgsql-shard-1: + if: needs.files-changed.outputs.backend == 'true' needs: files-changed runs-on: ubuntu-latest + timeout-minutes: 50 services: pgsql: image: postgres:14 @@ -27,14 +28,14 @@ jobs: ports: - "5432:5432" ldap: - image: gitea/test-openldap:latest + image: gitea/test-openldap:latest@sha256:4ac633b01d684e6b2a458cc0c8530c92f9b3702f6e040ce5f365607df34fbda0 ports: - "389:389" - "636:636" minio: # as github actions doesn't support "entrypoint", we need to use a non-official image # that has a custom entrypoint set to "minio server /data" - image: bitnamilegacy/minio:2023.8.31 + image: bitnamilegacy/minio:2025.7.23 env: MINIO_ROOT_USER: 123456 MINIO_ROOT_PASSWORD: 12345678 @@ -42,28 +43,47 @@ jobs: - "9000:9000" steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + - uses: ./.github/actions/go-setup + - uses: ./.github/actions/pgsql-shard with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache + shard: 1 + total-shards: 2 + run-migration: "true" + + test-pgsql-shard-2: + if: needs.files-changed.outputs.backend == 'true' + needs: files-changed + runs-on: ubuntu-latest + timeout-minutes: 50 + services: + pgsql: + image: postgres:14 + env: + POSTGRES_DB: test + POSTGRES_PASSWORD: postgres + ports: + - "5432:5432" + ldap: + image: gitea/test-openldap:latest@sha256:4ac633b01d684e6b2a458cc0c8530c92f9b3702f6e040ce5f365607df34fbda0 + ports: + - "389:389" + - "636:636" + minio: + # as github actions doesn't support "entrypoint", we need to use a non-official image + # that has a custom entrypoint set to "minio server /data" + image: bitnamilegacy/minio:2025.7.23 + env: + MINIO_ROOT_USER: 123456 + MINIO_ROOT_PASSWORD: 12345678 + ports: + - "9000:9000" + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: ./.github/actions/go-setup + - uses: ./.github/actions/pgsql-shard with: - cache-name: pgsql - - name: Add hosts to /etc/hosts - run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts' - - run: make deps-backend - - run: make backend - env: - TAGS: bindata - - name: run migration tests - run: GITEA_TEST_DATABASE=pgsql make test-migration - - name: run tests - run: GITEA_TEST_DATABASE=pgsql make test-integration - timeout-minutes: 50 - env: - TAGS: bindata gogit - TEST_LDAP: 1 + shard: 2 + total-shards: 2 test-sqlite: if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' @@ -71,41 +91,37 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: sqlite + - uses: ./.github/actions/go-setup - run: make deps-backend - run: make backend env: - TAGS: bindata gogit sqlite sqlite_unlock_notify + TAGS: bindata gogit GOEXPERIMENT: - - name: run migration tests - run: GITEA_TEST_DATABASE=sqlite make test-migration + - run: GITEA_TEST_DATABASE=sqlite make test-migration env: TAGS: bindata gogit - name: run tests run: GITEA_TEST_DATABASE=sqlite make test-integration timeout-minutes: 50 env: + # sqlite driver can contain large amount of Golang code, so don't use race detector for it, otherwise, extremely slow + GOTEST_FLAGS: -timeout=40m TAGS: bindata gogit GOEXPERIMENT: - GOTEST_FLAGS: -race -timeout=40m test-unit: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' + if: needs.files-changed.outputs.backend == 'true' needs: files-changed runs-on: ubuntu-latest services: elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:8.19.14 + image: docker.elastic.co/elasticsearch/elasticsearch:8.19.15 env: discovery.type: single-node xpack.security.enabled: false + xpack.ml.enabled: false + ingest.geoip.downloader.enabled: false + ES_JAVA_OPTS: "-Xms1g -Xmx1g" ports: - "9200:9200" meilisearch: @@ -115,7 +131,7 @@ jobs: ports: - "7700:7700" redis: - image: redis + image: redis:latest@sha256:e74c9b933d78e2829583d88f92793f4524752a15ac59c8baff2dd5ed000b7432 options: >- # wait until redis has started --health-cmd "redis-cli ping" --health-interval 5s @@ -124,55 +140,49 @@ jobs: ports: - 6379:6379 minio: - image: bitnamilegacy/minio:2021.3.17 + image: bitnamilegacy/minio:2025.7.23 env: - MINIO_ACCESS_KEY: 123456 - MINIO_SECRET_KEY: 12345678 + MINIO_ROOT_USER: 123456 + MINIO_ROOT_PASSWORD: 12345678 ports: - "9000:9000" devstoreaccount1.azurite.local: # https://github.com/Azure/Azurite/issues/1583 - image: mcr.microsoft.com/azure-storage/azurite:latest + image: mcr.microsoft.com/azure-storage/azurite:latest@sha256:dae2a5f96553962901304b94e72ef87e299d0825e4b679673bcc527a25076fe4 ports: - 10000:10000 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: unit - build-cache-rotate: "true" + - uses: ./.github/actions/go-setup - name: Add hosts to /etc/hosts run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 minio devstoreaccount1.azurite.local mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts' - run: make deps-backend - - run: make backend + - run: make generate-go env: TAGS: bindata - name: unit-tests - run: make test-backend test-check + run: make test-backend env: - TAGS: bindata sqlite sqlite_unlock_notify GOTEST_FLAGS: -race -timeout=20m + TAGS: bindata GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} - name: unit-tests-gogit - run: make test-backend test-check + run: make test-backend env: - TAGS: bindata gogit sqlite sqlite_unlock_notify - GOEXPERIMENT: GOTEST_FLAGS: -race -timeout=20m + TAGS: bindata gogit + GOEXPERIMENT: GITHUB_READ_TOKEN: ${{ secrets.GITHUB_READ_TOKEN }} + GITEA_TEST_CI_SKIP_EXTERNAL: true + - run: make test-check test-mysql: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' + if: needs.files-changed.outputs.backend == 'true' needs: files-changed runs-on: ubuntu-latest services: mysql: # the bitnami mysql image has more options than the official one, it's easier to customize - image: bitnamilegacy/mysql:8.0 + image: bitnamilegacy/mysql:8.4 env: ALLOW_EMPTY_PASSWORD: true MYSQL_DATABASE: testgitea @@ -181,14 +191,17 @@ jobs: options: >- --mount type=tmpfs,destination=/bitnami/mysql/data elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:8.19.14 + image: docker.elastic.co/elasticsearch/elasticsearch:8.19.15 env: discovery.type: single-node xpack.security.enabled: false + xpack.ml.enabled: false + ingest.geoip.downloader.enabled: false + ES_JAVA_OPTS: "-Xms1g -Xmx1g" ports: - "9200:9200" smtpimap: - image: tabascoterrier/docker-imap-devel:latest + image: tabascoterrier/docker-imap-devel:latest@sha256:3fb7cf50b47693e7b80f6f74abea2def4d7386016931d61359864de8a0aba551 ports: - "25:25" - "143:143" @@ -196,22 +209,14 @@ jobs: - "993:993" steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: mysql + - uses: ./.github/actions/go-setup - name: Add hosts to /etc/hosts run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: TAGS: bindata - - name: run migration tests - run: GITEA_TEST_DATABASE=mysql make test-migration + - run: GITEA_TEST_DATABASE=mysql make test-migration - name: run tests run: GITEA_TEST_DATABASE=mysql make test-integration env: @@ -219,7 +224,7 @@ jobs: TEST_INDEXER_CODE_ES_URL: "http://elastic:changeme@elasticsearch:9200" test-mssql: - if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true' + if: needs.files-changed.outputs.backend == 'true' needs: files-changed runs-on: ubuntu-latest services: @@ -232,19 +237,12 @@ jobs: ports: - "1433:1433" devstoreaccount1.azurite.local: # https://github.com/Azure/Azurite/issues/1583 - image: mcr.microsoft.com/azure-storage/azurite:latest + image: mcr.microsoft.com/azure-storage/azurite:latest@sha256:dae2a5f96553962901304b94e72ef87e299d0825e4b679673bcc527a25076fe4 ports: - 10000:10000 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: mssql + - uses: ./.github/actions/go-setup - name: Add hosts to /etc/hosts run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql devstoreaccount1.azurite.local" | sudo tee -a /etc/hosts' - run: make deps-backend diff --git a/.github/workflows/pull-e2e-tests.yml b/.github/workflows/pull-e2e-tests.yml index 974d82ea5e9..f0283f40227 100644 --- a/.github/workflows/pull-e2e-tests.yml +++ b/.github/workflows/pull-e2e-tests.yml @@ -20,31 +20,18 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 - with: - go-version-file: go.mod - check-latest: true - cache: false - - uses: ./.github/actions/go-cache - with: - cache-name: e2e - build-cache: "false" - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 24 - cache: pnpm - cache-dependency-path: pnpm-lock.yaml + - uses: ./.github/actions/go-setup + - uses: ./.github/actions/node-setup - run: make deps-frontend - run: make frontend - run: make deps-backend - run: make backend env: - TAGS: bindata sqlite sqlite_unlock_notify + TAGS: bindata - run: make playwright - run: make test-e2e timeout-minutes: 10 env: - TAGS: bindata sqlite sqlite_unlock_notify + TAGS: bindata FORCE_COLOR: 1 GITEA_TEST_E2E_DEBUG: 1 diff --git a/.github/workflows/pull-labeler.yml b/.github/workflows/pull-labeler.yml index f9e2e5e07b7..34395c8d9e3 100644 --- a/.github/workflows/pull-labeler.yml +++ b/.github/workflows/pull-labeler.yml @@ -1,8 +1,10 @@ name: labeler on: - pull_request_target: - types: [opened, synchronize, reopened] + # pull_request_target is required to label PRs from forks; jobs only use pinned + # actions or base-branch checkout, never PR-head code. + pull_request_target: # zizmor: ignore[dangerous-triggers] + types: [opened, synchronize, reopened, edited, ready_for_review] concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} @@ -15,6 +17,31 @@ jobs: contents: read pull-requests: write steps: - - uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1 + - uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 # v6.1.0 with: sync-labels: true + + pr-title: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + pull-requests: write + steps: + # Base-branch checkout only: pull_request_target runs with elevated token; never run PR-head code here. + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ github.event.pull_request.base.sha }} + - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version: 24 + # Labels are only synced after the title lints, so an invalid title never reaches the label diff. + - run: node ./tools/ci-tools.ts lint-pr-title + env: + PR_TITLE: ${{ github.event.pull_request.title }} + - run: node ./tools/ci-tools.ts set-pr-labels + env: + PR_TITLE: ${{ github.event.pull_request.title }} + PR_NUMBER: ${{ github.event.pull_request.number }} + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/release-nightly-snapcraft.yml b/.github/workflows/release-nightly-snapcraft.yml new file mode 100644 index 00000000000..0f9ac1d423b --- /dev/null +++ b/.github/workflows/release-nightly-snapcraft.yml @@ -0,0 +1,41 @@ +name: release-nightly-snapcraft + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Install snapcraft + run: sudo snap install snapcraft --classic + + - name: Remote build + run: | + snapcraft remote-build \ + --launchpad-accept-public-upload \ + --build-for=amd64,arm64,armhf + + - name: List built snaps + run: find . -maxdepth 1 -type f -name '*.snap' -print + + - name: Upload and release snapcraft nightly build + run: | + set -euo pipefail + + for snap in ./*.snap; do + echo "Uploading $snap to edge" + snapcraft upload --release="latest/edge" "$snap" + done diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index a5fa452ef36..d1561329431 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -22,7 +22,7 @@ jobs: with: go-version-file: go.mod check-latest: true - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: 24 @@ -32,7 +32,7 @@ jobs: # xgo build - run: make release env: - TAGS: bindata sqlite sqlite_unlock_notify + TAGS: bindata - name: import gpg key id: import_gpg uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 @@ -40,26 +40,34 @@ jobs: gpg_private_key: ${{ secrets.GPGSIGN_KEY }} passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }} - name: sign binaries + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + GPG_PASSPHRASE: ${{ secrets.GPGSIGN_PASSPHRASE }} run: | for f in dist/release/*; do - echo '${{ secrets.GPGSIGN_PASSPHRASE }}' | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u ${{ steps.import_gpg.outputs.fingerprint }} --output "$f.asc" "$f" + echo "$GPG_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u "$GPG_FINGERPRINT" --output "$f.asc" "$f" done # clean branch name to get the folder name in S3 - name: Get cleaned branch name id: clean_name + env: + REF: ${{ github.ref }} run: | - REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//') + REF_NAME=$(echo "$REF" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//') echo "Cleaned name is ${REF_NAME}" echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT" - name: configure aws - uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0 + uses: aws-actions/configure-aws-credentials@acca2b1b2070338fb9fd1ca27ecee81d687e58e5 # v6.1.2 with: aws-region: ${{ secrets.AWS_REGION }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: upload binaries to s3 + env: + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + BRANCH: ${{ steps.clean_name.outputs.branch }} run: | - aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress + aws s3 sync dist/release "s3://$AWS_S3_BUCKET/gitea/$BRANCH" --no-progress nightly-container: runs-on: namespace-profile-gitea-release-docker @@ -71,14 +79,16 @@ jobs: # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 - run: git fetch --unshallow --quiet --tags --force - - uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 - - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 + - uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 + - uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 - name: Get cleaned branch name id: clean_name + env: + REF: ${{ github.ref }} run: | - REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//') + REF_NAME=$(echo "$REF" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//') echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT" - - uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 + - uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 id: meta with: images: |- @@ -88,7 +98,7 @@ jobs: type=raw,value=${{ steps.clean_name.outputs.branch }} annotations: | org.opencontainers.image.authors="maintainers@gitea.io" - - uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 + - uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 id: meta_rootless with: images: |- @@ -102,18 +112,18 @@ jobs: annotations: | org.opencontainers.image.authors="maintainers@gitea.io" - name: Login to Docker Hub - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GHCR using PAT - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: build regular docker image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: context: . platforms: linux/amd64,linux/arm64,linux/riscv64 @@ -123,7 +133,7 @@ jobs: cache-from: type=registry,ref=ghcr.io/go-gitea/gitea:buildcache-rootful cache-to: type=registry,ref=ghcr.io/go-gitea/gitea:buildcache-rootful,mode=max - name: build rootless docker image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: context: . platforms: linux/amd64,linux/arm64,linux/riscv64 diff --git a/.github/workflows/release-tag-rc.yml b/.github/workflows/release-tag-rc.yml index 2e0f2dd5c0b..3e7655027c4 100644 --- a/.github/workflows/release-tag-rc.yml +++ b/.github/workflows/release-tag-rc.yml @@ -23,7 +23,7 @@ jobs: with: go-version-file: go.mod check-latest: true - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: 24 @@ -33,7 +33,7 @@ jobs: # xgo build - run: make release env: - TAGS: bindata sqlite sqlite_unlock_notify + TAGS: bindata - name: import gpg key id: import_gpg uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 @@ -41,35 +41,44 @@ jobs: gpg_private_key: ${{ secrets.GPGSIGN_KEY }} passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }} - name: sign binaries + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + GPG_PASSPHRASE: ${{ secrets.GPGSIGN_PASSPHRASE }} run: | for f in dist/release/*; do - echo '${{ secrets.GPGSIGN_PASSPHRASE }}' | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u ${{ steps.import_gpg.outputs.fingerprint }} --output "$f.asc" "$f" + echo "$GPG_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u "$GPG_FINGERPRINT" --output "$f.asc" "$f" done # clean branch name to get the folder name in S3 - name: Get cleaned branch name id: clean_name + env: + REF: ${{ github.ref }} run: | - REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//') + REF_NAME=$(echo "$REF" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//') echo "Cleaned name is ${REF_NAME}" echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT" - name: configure aws - uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0 + uses: aws-actions/configure-aws-credentials@acca2b1b2070338fb9fd1ca27ecee81d687e58e5 # v6.1.2 with: aws-region: ${{ secrets.AWS_REGION }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: upload binaries to s3 + env: + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + BRANCH: ${{ steps.clean_name.outputs.branch }} run: | - aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress + aws s3 sync dist/release "s3://$AWS_S3_BUCKET/gitea/$BRANCH" --no-progress - name: Install GH CLI uses: dev-hanz-ops/install-gh-cli-action@af38ce09b1ec248aeb08eea2b16bbecea9e059f8 # v0.2.1 with: gh-cli-version: 2.39.1 - name: create github release - run: | - gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --draft --notes-from-tag dist/release/* env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + gh release create "$TAG" --title "$TAG" --draft --notes-from-tag dist/release/* container: runs-on: namespace-profile-gitea-release-docker @@ -81,9 +90,9 @@ jobs: # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 - run: git fetch --unshallow --quiet --tags --force - - uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 - - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 - - uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 + - uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 + - uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 + - uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 id: meta with: images: |- @@ -96,7 +105,7 @@ jobs: type=semver,pattern={{version}} annotations: | org.opencontainers.image.authors="maintainers@gitea.io" - - uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 + - uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 id: meta_rootless with: images: |- @@ -112,18 +121,18 @@ jobs: annotations: | org.opencontainers.image.authors="maintainers@gitea.io" - name: Login to Docker Hub - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GHCR using PAT - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: build regular container image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: context: . platforms: linux/amd64,linux/arm64,linux/riscv64 @@ -131,7 +140,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} annotations: ${{ steps.meta.outputs.annotations }} - name: build rootless container image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: context: . platforms: linux/amd64,linux/arm64,linux/riscv64 diff --git a/.github/workflows/release-tag-version.yml b/.github/workflows/release-tag-version.yml index 2e7a9f5f54c..66a2984def3 100644 --- a/.github/workflows/release-tag-version.yml +++ b/.github/workflows/release-tag-version.yml @@ -26,7 +26,7 @@ jobs: with: go-version-file: go.mod check-latest: true - - uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0 + - uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: node-version: 24 @@ -36,7 +36,7 @@ jobs: # xgo build - run: make release env: - TAGS: bindata sqlite sqlite_unlock_notify + TAGS: bindata - name: import gpg key id: import_gpg uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 @@ -44,35 +44,44 @@ jobs: gpg_private_key: ${{ secrets.GPGSIGN_KEY }} passphrase: ${{ secrets.GPGSIGN_PASSPHRASE }} - name: sign binaries + env: + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + GPG_PASSPHRASE: ${{ secrets.GPGSIGN_PASSPHRASE }} run: | for f in dist/release/*; do - echo '${{ secrets.GPGSIGN_PASSPHRASE }}' | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u ${{ steps.import_gpg.outputs.fingerprint }} --output "$f.asc" "$f" + echo "$GPG_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --batch --yes --detach-sign -u "$GPG_FINGERPRINT" --output "$f.asc" "$f" done # clean branch name to get the folder name in S3 - name: Get cleaned branch name id: clean_name + env: + REF: ${{ github.ref }} run: | - REF_NAME=$(echo "${{ github.ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//') + REF_NAME=$(echo "$REF" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\/v//' -e 's/release\/v//') echo "Cleaned name is ${REF_NAME}" echo "branch=${REF_NAME}" >> "$GITHUB_OUTPUT" - name: configure aws - uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0 + uses: aws-actions/configure-aws-credentials@acca2b1b2070338fb9fd1ca27ecee81d687e58e5 # v6.1.2 with: aws-region: ${{ secrets.AWS_REGION }} aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: upload binaries to s3 + env: + AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + BRANCH: ${{ steps.clean_name.outputs.branch }} run: | - aws s3 sync dist/release s3://${{ secrets.AWS_S3_BUCKET }}/gitea/${{ steps.clean_name.outputs.branch }} --no-progress + aws s3 sync dist/release "s3://$AWS_S3_BUCKET/gitea/$BRANCH" --no-progress - name: Install GH CLI uses: dev-hanz-ops/install-gh-cli-action@af38ce09b1ec248aeb08eea2b16bbecea9e059f8 # v0.2.1 with: gh-cli-version: 2.39.1 - name: create github release - run: | - gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --notes-from-tag dist/release/* env: GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + gh release create "$TAG" --title "$TAG" --notes-from-tag dist/release/* container: runs-on: namespace-profile-gitea-release-docker @@ -84,9 +93,9 @@ jobs: # fetch all commits instead of only the last as some branches are long lived and could have many between versions # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 - run: git fetch --unshallow --quiet --tags --force - - uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 - - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 - - uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 + - uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0 + - uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0 + - uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 id: meta with: images: |- @@ -103,7 +112,7 @@ jobs: type=semver,pattern={{major}}.{{minor}} annotations: | org.opencontainers.image.authors="maintainers@gitea.io" - - uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 + - uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0 id: meta_rootless with: images: |- @@ -124,18 +133,18 @@ jobs: annotations: | org.opencontainers.image.authors="maintainers@gitea.io" - name: Login to Docker Hub - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GHCR using PAT - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 + uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: build regular container image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: context: . platforms: linux/amd64,linux/arm64,linux/riscv64 @@ -143,7 +152,7 @@ jobs: tags: ${{ steps.meta.outputs.tags }} annotations: ${{ steps.meta.outputs.annotations }} - name: build rootless container image - uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 + uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0 with: context: . platforms: linux/amd64,linux/arm64,linux/riscv64 diff --git a/.golangci.yml b/.golangci.yml index 570942bdd32..b72b3fbebd6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -13,7 +13,6 @@ linters: - forbidigo - gocheckcompilerdirectives - gocritic - - goheader - govet - ineffassign - mirror @@ -44,7 +43,7 @@ linters: desc: use os or io instead - pkg: golang.org/x/exp desc: it's experimental and unreliable - - pkg: code.gitea.io/gitea/modules/git/internal + - pkg: gitea.dev/modules/git/internal desc: do not use the internal package, use AddXxx function instead - pkg: gopkg.in/ini.v1 desc: do not use the ini package, use gitea's config system instead @@ -56,9 +55,9 @@ linters: files: - '**/models/migrations/**/*.go' deny: - - pkg: code.gitea.io/gitea/models$ + - pkg: gitea.dev/models$ desc: migrations must not depend on the models package - - pkg: code.gitea.io/gitea/modules/structs + - pkg: gitea.dev/modules/structs desc: migrations must not depend on modules/structs (API structures change over time) nolintlint: allow-unused: false @@ -118,11 +117,6 @@ linters: enable: - nilness - unusedwrite - goheader: - values: - regexp: - HEADER: '((Copyright [^\n]+|All rights reserved\.)\n)*Copyright \d{4} (The (Gogs|Gitea) Authors|Gitea Authors|Gitea)\.( All rights reserved\.)?(\n(Copyright [^\n]+|All rights reserved\.))*\nSPDX-License-Identifier: [\w.-]+' - template: '{{ HEADER }}' exclusions: generated: lax presets: @@ -179,7 +173,7 @@ formatters: custom-order: true sections: - standard - - prefix(code.gitea.io/gitea) + - prefix(gitea.dev) - blank - default gofumpt: diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 790a49a6eb9..00000000000 --- a/.npmrc +++ /dev/null @@ -1,7 +0,0 @@ -audit=false -fund=false -update-notifier=false -save-exact=true -auto-install-peers=true -dedupe-peer-dependents=false -enable-pre-post-scripts=true diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 00000000000..a012fba96e5 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1 @@ +disable=SC1091,SC2001,SC2002,SC2016,SC2028,SC2046,SC2124,SC2128,SC2129,SC2154,SC2155,SC2164,SC2181,SC2207 diff --git a/AGENTS.md b/AGENTS.md index fd87f432b71..5a4ecda6da9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,14 +2,19 @@ - Run `make fmt` to format `.go` files, and run `make lint-go` to lint them - Run `make lint-js` to lint `.ts` files - Run `make tidy` after any `go.mod` changes -- Run single go tests with `go test -tags 'sqlite sqlite_unlock_notify' -run '^TestName$' ./modulepath/` +- Run single go tests with `go test -run '^TestName$' ./modulepath/` - Run single js test files with `pnpm exec vitest ` - Run single playwright e2e test files with `GITEA_TEST_E2E_FLAGS='' make test-e2e` - Add the current year into the copyright header of new `.go` files - Ensure no trailing whitespace in edited files +- Use Conventional Commits for commit messages and PR titles, e.g. `type(scope): subject`; `!` before the colon if breaking. Use `test` type for test-only changes. - Never force-push, amend, or squash unless asked. Use new commits and normal push for pull request updates - Preserve existing code comments, do not remove or rewrite comments that are still relevant +- Keep comments short, prefer same-line, explain why, never narrate code +- Prefer unit tests over integration tests when logic is testable in isolation +- Aim for sub-2s local runtime for integration and e2e tests - In TypeScript, use `!` (non-null assertion) instead of `?.`/`??` when a value is known to always exist - For CSS layout, prefer `flex-*` helpers over per-child `tw-ml-*` / `tw-mr-*` margins; fall back to `tw-*` utilities when specificity requires `!important` - Include authorship attribution in issue and pull request comments -- Add `Co-Authored-By` lines to all commits, indicating name and model used +- Always add `Assisted-By` trailers to commit messages in format `Assisted-by: AGENT_NAME:MODEL_VERSION` +- Never add `Co-Authored-By` `Signed-off-by` trailer to commit messages. Sign off must be done by a human. diff --git a/CHANGELOG.md b/CHANGELOG.md index c3b6b94269b..691e6eaed14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,68 @@ This changelog goes through 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.com). +## [1.26.2](https://github.com/go-gitea/gitea/releases/tag/1.26.2) - 2026-05-20 + +* SECURITY + * fix(permissions): Fix reading permission (#37769) + * fix(actions): make artifact signature payloads unambiguous (#37707) + * fix: Unify public-only token filtering in API queries and repo access checks (#37118) + * fix: Add missed token scope checking (#37735) + * fix(oauth): bind token exchanges to the original client request (#37704) + * fix(oauth): strengthen PKCE validation and refresh token replay protection (#37706) + * fix(web): enforce token scopes on raw, media, and attachment downloads (#37698) + * fix(security): enforce wiki git writes and LFS token access at request time (#37695) + * feat(api): encrypt AWS creds (#37679) + * fix(deps): update dependency mermaid to v11.15.0 [security], add e2e test + * fix(packages): Add label for private and internal package and fix composor package source permission check (#37610) + * fix(git): Fix smart http request scope bug (#37583) + * Fix basic auth bug (#37503) + * Fix allow maintainer edit permission check (#37479) (#37484) + * Fix URL sanitization to handle schemeless credentials (#37440) (#37471) + * Fix attachment Content-Security-Policy (#37455) (#37464) + * chore(deps): bump go-git/go-git/v5 to 5.19.0 (#37608) + +* BUGFIXES + * fix(pull): handle empty pull request files view to allow reviews (#37783) + * fix(markup): make RenderString never fail (#37779) + * fix: add natural sort to sortTreeViewNodes (#37772) + * fix: package creation unique conflict (#37774) + * fix!: add DEFAULT_TITLE_SOURCE setting for pull request title default behavior (#37465) + * fix: Allow direct commits for unprotected files with push restrictions (#37657) + * fix(actions): wrong assumption that run id always >= job id (#37737) + * fix(auth): set User-Agent on avatar fetch and sync avatar on link-account register (#37564) (#37588) + * fix(actions): deadlock between PrepareRunAndInsert and UpdateTaskByState (#37692) + * fix(repo): /generate must sync the branch table for the new repo (#37693) + * build: Fix snap build (1.26) + * fix(actions): run TransferLogs on UpdateLog{Rows:[], NoMore:true} (#37631) + * fix show correct mergebase + * fix: make clone URL respect public URL detection setting (#37615) + * fix: "run as root" check (#37622) + * chore(deps): update dependency go to v1.26.3 (#37601) + * Compare dropdown fails when selecting branch with no common merge-base (#37470) + * fix: treat email addresses case-insensitively (#37600) + * fix(actions): fix blank lines after ::endgroup:: (#37597) + * fix(actions): report individual step status in workflow job API response (#37592) + * fix: Invalid UTF-8 commit messages in JSON API responses (#37542) + * fix: use consistent GetUser family functions (#37553) + * fix(api): return 409 message instead of empty JSON for wrong commit id (#37572) + * fix(actions): prevent panic when workflow contains null jobs (#37570) + * Make ServeSetHeaders default to download attachment if filename exists (#37552) (#37555) + * Fix(actions): validate workflow param to prevent 500 error (#37546) (#37554) + * Don't unblock run-level-concurrency-blocked runs in the resolver (#37461) (#37538) + * Fix(packages): use file names for generic web downloads (#37514) (#37520) + * Fix merge autodetect can't close other PRs but only the last one when multiple PRs are pushed at once (#37512) (#37516) + * Fix update branch protection order (#37508) (#37513) + * Fix mCaptcha broken after Vite migration (#37492) (#37509) + * Fix review submission from single-commit PR view (#37475) (#37485) + * Fix scheduled action panic with null event payload (#37459) (#37466) + * Make GetPossibleUserByID can handle deleted user (#37430) (#37431) + * Remove excessive quote from terraform instructions (#37424) (#37426) + * Fix color regressions, add `priority` color (#37417) (#37421) + +* MISC + * Add CurrentURL template variable back (#37444) (#37449) + ## [1.26.1](https://github.com/go-gitea/gitea/releases/tag/v1.26.1) - 2026-04-21 * BUGFIXES @@ -1383,7 +1445,7 @@ been added to each release, please refer to the [blog](https://blog.gitea.com). * Fix mCaptcha bug (#33659) (#33661) * Git graph: don't show detached commits (#33645) (#33650) * Use MatchPhraseQuery for bleve code search (#33628) - * Adjust appearence of commit status webhook (#33778) #33789 + * Adjust appearance of commit status webhook (#33778) #33789 * Upgrade golang net from 0.35.0 -> 0.36.0 (#33795) #33796 ## [1.23.4](https://github.com/go-gitea/gitea/releases/tag/v1.23.4) - 2025-02-16 @@ -2114,7 +2176,7 @@ been added to each release, please refer to the [blog](https://blog.gitea.com). * Optimize repo-list layout to enhance visual experience (#31272) (#31276) * fixed the dropdown menu for the top New button to expand to the left (#31273) (#31275) * Fix Activity Page Contributors dropdown (#31264) (#31269) - * fix: allow actions artifacts storage migration to complete succesfully (#31251) (#31257) + * fix: allow actions artifacts storage migration to complete successfully (#31251) (#31257) * Make blockquote attention recognize more syntaxes (#31240) (#31250) * Remove .segment from .project-column (#31204) (#31239) * Ignore FindRecentlyPushedNewBranches err (#31164) (#31171) @@ -2298,7 +2360,7 @@ Key highlights of this release encompass significant changes categorized under ` * Performance optimization for git push and check permissions for push options (#30104) (#30354) * BUGFIXES * Fix close file in the Upload func (#30262) (#30269) - * Fix inline math blocks can't be preceeded/followed by alphanumerical characters (#30175) (#30250) + * Fix inline math blocks can't be preceded/followed by alphanumerical characters (#30175) (#30250) * Fix missing 0 prefix of GPG key id (#30245) (#30247) * Include encoding in signature payload (#30174) (#30181) * Move from `max( id )` to `max( index )` for latest commit statuses (#30076) (#30155) @@ -5590,7 +5652,7 @@ Key highlights of this release encompass significant changes categorized under ` * Fix navbar on project view (#17749) * More pleasantly handle broken or missing git repositories (#17747) * Use `*PushUpdateOptions` as receiver (#17724) - * Remove unused `user` paramater (#17723) + * Remove unused `user` parameter (#17723) * Better builtin avatar generator (#17707) * Cleanup and use global style on popups (#17674) * Move user/org deletion to services (#17673) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f1871f14701..6888b4ad653 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -189,6 +189,38 @@ In the PR title, describe the problem you are fixing, not how you are fixing it. Use the first comment as a summary of your PR. \ In the PR summary, you can describe exactly how you are fixing this problem. +PR titles must follow the [Conventional Commits](https://www.conventionalcommits.org/) format, because PRs are squash-merged and the PR title becomes the resulting commit message: + +```text +type(scope)!: subject +``` + +The scope in parentheses is optional. A `!` immediately before the colon marks a [breaking change](https://www.conventionalcommits.org/en/v1.0.0/#summary): either `type!:` or `type(scope)!:` (not `type!(scope):`). + +Use one of these types: + +- `build`: Changes affecting the build system, packaging, or external dependencies +- `ci`: Changes to CI/CD configuration files and scripts +- `chore`: Maintenance changes that do not affect production code or should not appear in the changelog +- `docs`: Documentation-only changes +- `feat`: A larger user-facing feature, improvement, or new functionality +- `enhance`: Small or trivial user-facing improvements or UX polish (for example wording changes, color adjustments, spacing or padding tweaks, placeholders, small UI behavior improvements) +- `fix`: A bug fix, UX correction, or security-related dependency update +- `perf`: Performance improvements (speed, memory, scalability) +- `refactor`: A code change that neither fixes a bug nor adds a feature +- `revert`: Reverts a previous change +- `style`: Formatting or style-only changes that do not affect code behavior (for example lint-driven edits) +- `test`: Adding or correcting tests + +Examples: + +```text +fix(web): prevent avatar upload crash on empty file +feat(api): add pagination to repo hooks list +enhance(repo): improve diff toolbar spacing +ci(workflows): lint PR titles in CI +``` + Keep this summary up-to-date as the PR evolves. \ If your PR changes the UI, you must add **after** screenshots in the PR summary. \ If you are not implementing a new feature, you should also post **before** screenshots for comparison. @@ -201,6 +233,10 @@ Another requirement for merging PRs is that the PR is labeled correctly.\ However, this is not your job as a contributor, but the job of the person merging your PR.\ If you think that your PR was labeled incorrectly, or notice that it was merged without labels, please let us know. +For pull requests that use a valid Conventional Commits title, CI automatically applies a matching `type/…` label when the title prefix is `feat`, `enhance`, `fix`, `docs`, or `test` (for example `enhance(web): …` receives `type/enhancement`).\ +That label is kept in sync with the PR title when the title is edited.\ +Other title prefixes do not get an automatic `type/…` label; the merger still assigns the correct labels (including `type/…` when needed) for changelog and backport decisions. + If your PR closes some issues, you must note that in a way that both GitHub and Gitea understand, i.e. by appending a paragraph like ```text diff --git a/Dockerfile b/Dockerfile index 323f06125fe..383e761330e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.26-alpine3.23 AS frontend-build RUN apk --no-cache add build-base git nodejs pnpm WORKDIR /src -COPY package.json pnpm-lock.yaml .npmrc ./ +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile COPY --exclude=.git/ . . RUN make frontend @@ -12,7 +12,7 @@ RUN make frontend FROM docker.io/library/golang:1.26-alpine3.23 AS build-env ARG GITEA_VERSION -ARG TAGS="sqlite sqlite_unlock_notify" +ARG TAGS="" ENV TAGS="bindata timetzdata $TAGS" ARG CGO_EXTRA_CFLAGS @@ -21,7 +21,7 @@ RUN apk --no-cache add \ build-base \ git -WORKDIR ${GOPATH}/src/code.gitea.io/gitea +WORKDIR ${GOPATH}/src/gitea.dev COPY go.mod go.sum ./ RUN go mod download # Use COPY instead of bind mount as read-only one breaks makefile state tracking and read-write one needs binary to be moved as it's discarded. @@ -42,7 +42,7 @@ RUN chmod 755 /tmp/local/usr/bin/entrypoint \ /tmp/local/etc/s6/gitea/* \ /tmp/local/etc/s6/openssh/* \ /tmp/local/etc/s6/.s6-svscan/* \ - /go/src/code.gitea.io/gitea/gitea + /go/src/gitea.dev/gitea FROM docker.io/library/alpine:3.23 AS gitea @@ -74,7 +74,7 @@ RUN addgroup \ echo "git:*" | chpasswd -e COPY --from=build-env /tmp/local / -COPY --from=build-env /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea +COPY --from=build-env /go/src/gitea.dev/gitea /app/gitea/gitea ENV USER=git ENV GITEA_CUSTOM=/data/gitea diff --git a/Dockerfile.rootless b/Dockerfile.rootless index 83c69cbd513..af1ef336ae4 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -3,7 +3,7 @@ FROM --platform=$BUILDPLATFORM docker.io/library/golang:1.26-alpine3.23 AS frontend-build RUN apk --no-cache add build-base git nodejs pnpm WORKDIR /src -COPY package.json pnpm-lock.yaml .npmrc ./ +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ RUN --mount=type=cache,target=/root/.local/share/pnpm/store pnpm install --frozen-lockfile COPY --exclude=.git/ . . RUN make frontend @@ -12,7 +12,7 @@ RUN make frontend FROM docker.io/library/golang:1.26-alpine3.23 AS build-env ARG GITEA_VERSION -ARG TAGS="sqlite sqlite_unlock_notify" +ARG TAGS="" ENV TAGS="bindata timetzdata $TAGS" ARG CGO_EXTRA_CFLAGS @@ -21,7 +21,7 @@ RUN apk --no-cache add \ build-base \ git -WORKDIR ${GOPATH}/src/code.gitea.io/gitea +WORKDIR ${GOPATH}/src/gitea.dev COPY go.mod go.sum ./ RUN go mod download # See the comments in Dockerfile @@ -37,7 +37,7 @@ COPY docker/rootless /tmp/local # Set permissions for builds that made under windows which strips the executable bit from file RUN chmod 755 /tmp/local/usr/local/bin/* \ - /go/src/code.gitea.io/gitea/gitea + /go/src/gitea.dev/gitea FROM docker.io/library/alpine:3.23 AS gitea-rootless @@ -68,7 +68,7 @@ RUN mkdir -p /var/lib/gitea /etc/gitea RUN chown git:git /var/lib/gitea /etc/gitea COPY --from=build-env /tmp/local / -COPY --from=build-env --chown=root:root /go/src/code.gitea.io/gitea/gitea /app/gitea/gitea +COPY --from=build-env --chown=root:root /go/src/gitea.dev/gitea /app/gitea/gitea # git:git USER 1000:1000 diff --git a/MAINTAINERS b/MAINTAINERS index 26192eff447..03ff6999f33 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -64,4 +64,4 @@ metiftikci (@metiftikci) Christopher Homberger (@ChristopherHX) Tobias Balle-Petersen (@tobiasbp) TheFox (@TheFox0x7) -Nicolas (@bircni) \ No newline at end of file +Nicolas (@bircni) diff --git a/Makefile b/Makefile index ad7739c07b9..2b19075a484 100644 --- a/Makefile +++ b/Makefile @@ -11,15 +11,18 @@ COMMA := , XGO_VERSION := go-1.26.x -AIR_PACKAGE ?= github.com/air-verse/air@v1 # renovate: datasource=go -EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3 # renovate: datasource=go -GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4 # renovate: datasource=go +AIR_PACKAGE ?= github.com/air-verse/air@v1.65.3 # renovate: datasource=go +EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3.7.0 # renovate: datasource=go +GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2 # renovate: datasource=go GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.15 # renovate: datasource=go MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.8.0 # renovate: datasource=go -SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.33.1 # renovate: datasource=go -XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest -GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 # renovate: datasource=go -ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.7.11 # renovate: datasource=go +SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.33.2 # renovate: datasource=go +XGO_PACKAGE ?= src.techknowlogick.com/xgo@v1.9.0 # renovate: datasource=go +GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1.3.0 # renovate: datasource=go +ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 # renovate: datasource=go +SHELLCHECK_IMAGE ?= docker.io/koalaman/shellcheck:v0.11.0@sha256:61862eba1fcf09a484ebcc6feea46f1782532571a34ed51fedf90dd25f925a8d # renovate: datasource=docker + +CONTAINER_RUNTIME ?= $(shell hash docker >/dev/null 2>&1 && echo docker || echo podman) HAS_GO := $(shell hash $(GO) > /dev/null 2>&1 && echo yes) ifeq ($(HAS_GO), yes) @@ -38,13 +41,10 @@ ifneq ($(findstring test-,$(MAKECMDGOALS)),) endif TAGS ?= -ifeq ($(GITEA_TEST_DATABASE),sqlite) - TAGS += sqlite sqlite_unlock_notify -endif TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags CGO_ENABLED ?= 0 -ifneq (,$(findstring sqlite,$(TAGS))$(findstring pam,$(TAGS))) +ifneq (,$(findstring sqlite_mattn,$(TAGS))$(findstring pam,$(TAGS))) CGO_ENABLED = 1 endif @@ -113,8 +113,8 @@ LDFLAGS := $(LDFLAGS) -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)" LINUX_ARCHS ?= linux/amd64,linux/386,linux/arm-5,linux/arm-6,linux/arm64,linux/riscv64 -GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) code.gitea.io/gitea/tests/integration/migration-test code.gitea.io/gitea/tests code.gitea.io/gitea/tests/integration,$(shell $(GO) list ./... | grep -v /vendor/)) -MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list code.gitea.io/gitea/models/migrations/...) +GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list gitea.dev/models/migrations/...) gitea.dev/tests/integration/migration-test gitea.dev/tests gitea.dev/tests/integration,$(shell $(GO) list ./... | grep -v /vendor/)) +MIGRATE_TEST_PACKAGES ?= $(shell $(GO) list gitea.dev/models/migrations/...) FRONTEND_SOURCES := $(shell find web_src/js web_src/css -type f) FRONTEND_CONFIGS := vite.config.ts tailwind.config.ts @@ -150,7 +150,7 @@ ESLINT_CONCURRENCY ?= 2 SWAGGER_SPEC := templates/swagger/v1_json.tmpl SWAGGER_SPEC_INPUT := templates/swagger/v1_input.json -SWAGGER_EXCLUDE := code.gitea.io/sdk +SWAGGER_EXCLUDE := gitea.dev/sdk OPENAPI3_SPEC := templates/swagger/v1_openapi3_json.tmpl TEST_MYSQL_HOST ?= mysql:3306 @@ -274,7 +274,7 @@ checks-frontend: lockfile-check svg-check ## check frontend files checks-backend: tidy-check swagger-check openapi3-check fmt-check swagger-validate security-check ## check backend files .PHONY: lint -lint: lint-frontend lint-backend lint-templates lint-swagger lint-spell lint-md lint-actions lint-json lint-yaml ## lint everything +lint: lint-frontend lint-backend lint-templates lint-swagger lint-spell lint-md lint-actions lint-json lint-yaml lint-shell ## lint everything .PHONY: lint-fix lint-fix: lint-frontend-fix lint-backend-fix lint-spell-fix ## lint everything and fix issues @@ -331,18 +331,11 @@ lint-spell-fix: ## lint spelling and fix issues .PHONY: lint-go lint-go: ## lint go files - $(GO) run $(GOLANGCI_LINT_PACKAGE) run + GO=$(GO) GOLANGCI_LINT_PACKAGE=$(GOLANGCI_LINT_PACKAGE) $(GO) run ./tools/lint-go-all.go .PHONY: lint-go-fix lint-go-fix: ## lint go files and fix issues - $(GO) run $(GOLANGCI_LINT_PACKAGE) run --fix - -# workaround step for the lint-go-windows CI task because 'go run' can not -# have distinct GOOS/GOARCH for its build and run steps -.PHONY: lint-go-windows -lint-go-windows: - @GOOS= GOARCH= $(GO) install $(GOLANGCI_LINT_PACKAGE) - golangci-lint run + GO=$(GO) GOLANGCI_LINT_PACKAGE=$(GOLANGCI_LINT_PACKAGE) $(GO) run ./tools/lint-go-all.go --fix .PHONY: lint-editorconfig lint-editorconfig: @@ -350,8 +343,13 @@ lint-editorconfig: @$(GO) run $(EDITORCONFIG_CHECKER_PACKAGE) $(EDITORCONFIG_FILES) .PHONY: lint-actions -lint-actions: ## lint action workflow files - $(GO) run $(ACTIONLINT_PACKAGE) +lint-actions: .venv ## lint action workflow files + @$(GO) run $(ACTIONLINT_PACKAGE) + @uv run --frozen zizmor --quiet --min-confidence=medium .github + +.PHONY: lint-shell +lint-shell: ## lint shell scripts + @SHELLCHECK_IMAGE=$(SHELLCHECK_IMAGE) CONTAINER_RUNTIME=$(CONTAINER_RUNTIME) ./tools/lint-shell.sh $$(git ls-files '*.sh') .PHONY: lint-templates lint-templates: .venv node_modules ## lint template files @@ -449,19 +447,23 @@ test-integration: @# Use a compiled binary: testlogger forwards gitea logs to t.Log, so `go test -v` @# would flood output per passing test. testcache can't help these tests anyway — @# they mutate the work directory, so cache inputs change between runs. - $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -c code.gitea.io/gitea/tests/integration -o ./test-integration-$(GITEA_TEST_DATABASE).test - ./test-integration-$(GITEA_TEST_DATABASE).test + $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -c gitea.dev/tests/integration -o ./test-integration-$(GITEA_TEST_DATABASE).test + ./tools/test-integration.sh ./test-integration-$(GITEA_TEST_DATABASE).test + +.PHONY: test-integration-compile +test-integration-compile: + $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -c -o /dev/null gitea.dev/tests/integration .PHONY: test-integration\#% test-integration\#%: - $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -run $(subst .,/,$*) code.gitea.io/gitea/tests/integration + $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' -run $(subst .,/,$*) gitea.dev/tests/integration .PHONY: test-migration test-migration: migrations.integration.test migrations.individual.test .PHONY: migrations.integration.test migrations.integration.test: - $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' code.gitea.io/gitea/tests/integration/migration-test + $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' gitea.dev/tests/integration/migration-test .PHONY: migrations.individual.test migrations.individual.test: @@ -470,16 +472,15 @@ migrations.individual.test: .PHONY: migrations.individual.test\#% migrations.individual.test\#%: - $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' code.gitea.io/gitea/models/migrations/$* + $(GO) test $(GOTEST_FLAGS) -tags '$(TAGS)' gitea.dev/models/migrations/$* .PHONY: playwright playwright: deps-frontend - @# on GitHub Actions VMs, playwright's system deps are pre-installed - @pnpm exec playwright install $(if $(GITHUB_ACTIONS),,--with-deps) chromium firefox $(PLAYWRIGHT_FLAGS) + @CONTAINER_RUNTIME=$(CONTAINER_RUNTIME) ./tools/test-e2e.sh install .PHONY: test-e2e test-e2e: playwright frontend backend - @EXECUTABLE=$(EXECUTABLE) ./tools/test-e2e.sh $(GITEA_TEST_E2E_FLAGS) + @CONTAINER_RUNTIME=$(CONTAINER_RUNTIME) EXECUTABLE=$(EXECUTABLE) ./tools/test-e2e.sh run $(GITEA_TEST_E2E_FLAGS) .PHONY: build build: frontend backend ## build everything @@ -606,8 +607,6 @@ update-js: node_modules ## update js dependencies pnpm exec updates -u -f package.json rm -rf node_modules pnpm-lock.yaml pnpm install - pnpm exec nolyfill install - pnpm install @touch node_modules .PHONY: update-py @@ -661,6 +660,10 @@ generate-gitignore: ## update gitignore files generate-images: | node_modules ## generate images cd tools && node generate-images.ts $(TAGS) +.PHONY: generate-codemirror-languages +generate-codemirror-languages: | node_modules ## generate codemirror languages + node tools/generate-codemirror-languages.ts + .PHONY: generate-manpage generate-manpage: ## generate manpage @[ -f gitea ] || make backend diff --git a/README.md b/README.md index 7ebeac97be0..3aa5138dac4 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ [![](https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml/badge.svg?branch=main)](https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml?query=branch%3Amain "Release Nightly") [![](https://img.shields.io/discord/322538954119184384.svg?logo=discord&logoColor=white&label=Discord&color=5865F2)](https://discord.gg/Gitea "Join the Discord chat at https://discord.gg/Gitea") -[![](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea "Go Report Card") -[![](https://pkg.go.dev/badge/code.gitea.io/gitea?status.svg)](https://pkg.go.dev/code.gitea.io/gitea "GoDoc") +[![](https://goreportcard.com/badge/gitea.dev)](https://goreportcard.com/report/gitea.dev "Go Report Card") +[![](https://pkg.go.dev/badge/gitea.dev?status.svg)](https://pkg.go.dev/gitea.dev "GoDoc") [![](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest "GitHub release") [![](https://www.codetriage.com/go-gitea/gitea/badges/users.svg)](https://www.codetriage.com/go-gitea/gitea "Help Contribute to Open Source") [![](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea "Become a backer/sponsor of gitea") @@ -44,10 +44,6 @@ From the root of the source tree, run: TAGS="bindata" make build -or if SQLite support is required: - - TAGS="bindata sqlite sqlite_unlock_notify" make build - The `build` target is split into two sub-targets: - `make backend` which requires [Go Stable](https://go.dev/dl/), the required version is defined in [go.mod](/go.mod). diff --git a/README.zh-cn.md b/README.zh-cn.md index 8ccacc0fea4..0855827f2e2 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -2,8 +2,8 @@ [![](https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml/badge.svg?branch=main)](https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml?query=branch%3Amain "Release Nightly") [![](https://img.shields.io/discord/322538954119184384.svg?logo=discord&logoColor=white&label=Discord&color=5865F2)](https://discord.gg/Gitea "Join the Discord chat at https://discord.gg/Gitea") -[![](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea "Go Report Card") -[![](https://pkg.go.dev/badge/code.gitea.io/gitea?status.svg)](https://pkg.go.dev/code.gitea.io/gitea "GoDoc") +[![](https://goreportcard.com/badge/gitea.dev)](https://goreportcard.com/report/gitea.dev "Go Report Card") +[![](https://pkg.go.dev/badge/gitea.dev?status.svg)](https://pkg.go.dev/gitea.dev "GoDoc") [![](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest "GitHub release") [![](https://www.codetriage.com/go-gitea/gitea/badges/users.svg)](https://www.codetriage.com/go-gitea/gitea "Help Contribute to Open Source") [![](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea "Become a backer/sponsor of gitea") @@ -38,10 +38,6 @@ TAGS="bindata" make build -如果需要 SQLite 支持: - - TAGS="bindata sqlite sqlite_unlock_notify" make build - `build` 目标分为两个子目标: - `make backend` 需要 [Go Stable](https://go.dev/dl/),所需版本在 [go.mod](/go.mod) 中定义。 diff --git a/README.zh-tw.md b/README.zh-tw.md index 4160fd0bd91..0c89d041667 100644 --- a/README.zh-tw.md +++ b/README.zh-tw.md @@ -2,8 +2,8 @@ [![](https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml/badge.svg?branch=main)](https://github.com/go-gitea/gitea/actions/workflows/release-nightly.yml?query=branch%3Amain "Release Nightly") [![](https://img.shields.io/discord/322538954119184384.svg?logo=discord&logoColor=white&label=Discord&color=5865F2)](https://discord.gg/Gitea "Join the Discord chat at https://discord.gg/Gitea") -[![](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea "Go Report Card") -[![](https://pkg.go.dev/badge/code.gitea.io/gitea?status.svg)](https://pkg.go.dev/code.gitea.io/gitea "GoDoc") +[![](https://goreportcard.com/badge/gitea.dev)](https://goreportcard.com/report/gitea.dev "Go Report Card") +[![](https://pkg.go.dev/badge/gitea.dev?status.svg)](https://pkg.go.dev/gitea.dev "GoDoc") [![](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest "GitHub release") [![](https://www.codetriage.com/go-gitea/gitea/badges/users.svg)](https://www.codetriage.com/go-gitea/gitea "Help Contribute to Open Source") [![](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea "Become a backer/sponsor of gitea") @@ -38,10 +38,6 @@ TAGS="bindata" make build -如果需要 SQLite 支援: - - TAGS="bindata sqlite sqlite_unlock_notify" make build - `build` 目標分為兩個子目標: - `make backend` 需要 [Go Stable](https://go.dev/dl/),所需版本在 [go.mod](/go.mod) 中定義。 diff --git a/assets/codemirror-languages.json b/assets/codemirror-languages.json new file mode 100644 index 00000000000..573e7c493b3 --- /dev/null +++ b/assets/codemirror-languages.json @@ -0,0 +1,1277 @@ +[ + { + "name": "APL", + "extensions": [ + "apl", + "dyalog" + ], + "filenames": [] + }, + { + "name": "ASN.1", + "extensions": [ + "asn", + "asn1" + ], + "filenames": [] + }, + { + "name": "Brainfuck", + "extensions": [ + "b", + "bf" + ], + "filenames": [] + }, + { + "name": "C", + "extensions": [ + "c", + "cats", + "h", + "idc" + ], + "filenames": [] + }, + { + "name": "C#", + "extensions": [ + "cs", + "cake", + "csx", + "linq" + ], + "filenames": [] + }, + { + "name": "C++", + "extensions": [ + "cpp", + "c++", + "cc", + "cp", + "cppm", + "cxx", + "h++", + "hh", + "hpp", + "hxx", + "inl", + "ipp", + "ixx", + "re", + "tcc", + "tpp", + "txx" + ], + "filenames": [] + }, + { + "name": "Clojure", + "extensions": [ + "clj", + "bb", + "boot", + "cl2", + "cljc", + "cljscm", + "cljx", + "hic" + ], + "filenames": [ + "riemann.config" + ] + }, + { + "name": "CMake", + "extensions": [ + "cmake" + ], + "filenames": [ + "CMakeLists.txt" + ] + }, + { + "name": "Cobol", + "extensions": [ + "cob", + "cbl", + "ccp", + "cobol", + "cpy" + ], + "filenames": [] + }, + { + "name": "CoffeeScript", + "extensions": [ + "coffee", + "_coffee", + "cake", + "cjsx", + "iced" + ], + "filenames": [ + "Cakefile" + ] + }, + { + "name": "Common Lisp", + "extensions": [ + "lisp", + "asd", + "cl", + "l", + "lsp", + "ny", + "podsl", + "sexp" + ], + "filenames": [] + }, + { + "name": "CQL", + "extensions": [ + "cql" + ], + "filenames": [] + }, + { + "name": "Crystal", + "extensions": [ + "cr" + ], + "filenames": [] + }, + { + "name": "CSS", + "extensions": [ + "css" + ], + "filenames": [] + }, + { + "name": "Cypher", + "extensions": [ + "cyp", + "cypher" + ], + "filenames": [] + }, + { + "name": "Cython", + "extensions": [ + "pyx", + "pxd", + "pxi" + ], + "filenames": [] + }, + { + "name": "D", + "extensions": [ + "d", + "di" + ], + "filenames": [] + }, + { + "name": "Dart", + "extensions": [ + "dart" + ], + "filenames": [] + }, + { + "name": "diff", + "extensions": [ + "diff", + "patch" + ], + "filenames": [] + }, + { + "name": "Dylan", + "extensions": [ + "dylan", + "dyl", + "intr", + "lid" + ], + "filenames": [] + }, + { + "name": "EBNF", + "extensions": [ + "ebnf" + ], + "filenames": [] + }, + { + "name": "ECL", + "extensions": [ + "ecl", + "eclxml" + ], + "filenames": [] + }, + { + "name": "edn", + "extensions": [ + "edn" + ], + "filenames": [] + }, + { + "name": "Eiffel", + "extensions": [ + "e" + ], + "filenames": [] + }, + { + "name": "Elm", + "extensions": [ + "elm" + ], + "filenames": [] + }, + { + "name": "Erlang", + "extensions": [ + "erl", + "app", + "es", + "escript", + "hrl", + "xrl", + "yrl" + ], + "filenames": [ + "Emakefile", + "rebar.config", + "rebar.config.lock", + "rebar.lock" + ] + }, + { + "name": "F#", + "extensions": [ + "fs", + "fsi", + "fsx" + ], + "filenames": [] + }, + { + "name": "Factor", + "extensions": [ + "factor" + ], + "filenames": [ + ".factor-boot-rc", + ".factor-rc" + ] + }, + { + "name": "Forth", + "extensions": [ + "fth", + "4th", + "forth", + "fr", + "frt" + ], + "filenames": [] + }, + { + "name": "Fortran", + "extensions": [ + "f", + "f77", + "for", + "fpp" + ], + "filenames": [] + }, + { + "name": "Gherkin", + "extensions": [ + "feature", + "story" + ], + "filenames": [] + }, + { + "name": "Go", + "extensions": [ + "go" + ], + "filenames": [] + }, + { + "name": "Groovy", + "extensions": [ + "groovy", + "grt", + "gtpl", + "gvy" + ], + "filenames": [ + "Jenkinsfile" + ] + }, + { + "name": "Haskell", + "extensions": [ + "hs", + "hs-boot", + "hsc" + ], + "filenames": [] + }, + { + "name": "Haxe", + "extensions": [ + "hx", + "hxsl" + ], + "filenames": [] + }, + { + "name": "HTML", + "extensions": [ + "html", + "hta", + "htm", + "xht", + "xhtml" + ], + "filenames": [] + }, + { + "name": "HTTP", + "extensions": [ + "http" + ], + "filenames": [] + }, + { + "name": "HXML", + "extensions": [ + "hxml" + ], + "filenames": [] + }, + { + "name": "IDL", + "extensions": [ + "pro", + "dlm" + ], + "filenames": [] + }, + { + "name": "Java", + "extensions": [ + "java", + "jav", + "jsh" + ], + "filenames": [] + }, + { + "name": "JavaScript", + "extensions": [ + "js", + "_js", + "bones", + "cjs", + "es", + "es6", + "frag", + "gs", + "jake", + "javascript", + "jsb", + "jscad", + "jsfl", + "jslib", + "jsm", + "jspre", + "jss", + "mjs", + "njs", + "pac", + "sjs", + "ssjs", + "xsjs", + "xsjslib" + ], + "filenames": [ + "Jakefile" + ] + }, + { + "name": "Jinja", + "extensions": [ + "jinja", + "j2", + "jinja2" + ], + "filenames": [] + }, + { + "name": "JSON", + "extensions": [ + "json", + "4DForm", + "4DProject", + "avsc", + "geojson", + "gltf", + "har", + "ice", + "JSON-tmLanguage", + "jsonl", + "mcmeta", + "sarif", + "tact", + "tfstate", + "topojson", + "webapp", + "webmanifest", + "yy", + "yyp" + ], + "filenames": [ + ".all-contributorsrc", + ".arcconfig", + ".auto-changelog", + ".c8rc", + ".htmlhintrc", + ".imgbotconfig", + ".nycrc", + ".tern-config", + ".tern-project", + ".watchmanconfig", + "MODULE.bazel.lock", + "Package.resolved", + "Pipfile.lock", + "bun.lock", + "composer.lock", + "deno.lock", + "flake.lock", + "mcmod.info" + ] + }, + { + "name": "JSON-LD", + "extensions": [ + "jsonld" + ], + "filenames": [] + }, + { + "name": "Julia", + "extensions": [ + "jl" + ], + "filenames": [] + }, + { + "name": "Kotlin", + "extensions": [ + "kt", + "ktm", + "kts" + ], + "filenames": [] + }, + { + "name": "LaTeX", + "extensions": [ + "tex", + "aux", + "bbx", + "cbx", + "cls", + "dtx", + "ins", + "lbx", + "ltx", + "mkii", + "mkiv", + "mkvi", + "sty", + "toc" + ], + "filenames": [] + }, + { + "name": "LESS", + "extensions": [ + "less" + ], + "filenames": [] + }, + { + "name": "Liquid", + "extensions": [ + "liquid" + ], + "filenames": [] + }, + { + "name": "LiveScript", + "extensions": [ + "ls", + "_ls" + ], + "filenames": [ + "Slakefile" + ] + }, + { + "name": "Lua", + "extensions": [ + "lua", + "nse", + "p8", + "pd_lua", + "rbxs", + "rockspec", + "wlua" + ], + "filenames": [ + ".luacheckrc" + ] + }, + { + "name": "Modelica", + "extensions": [ + "mo" + ], + "filenames": [] + }, + { + "name": "Nginx", + "extensions": [ + "nginx", + "nginxconf", + "vhost" + ], + "filenames": [ + "nginx.conf" + ] + }, + { + "name": "NSIS", + "extensions": [ + "nsi", + "nsh" + ], + "filenames": [] + }, + { + "name": "Objective-C", + "extensions": [], + "filenames": [] + }, + { + "name": "Objective-C++", + "extensions": [ + "mm" + ], + "filenames": [] + }, + { + "name": "OCaml", + "extensions": [ + "ml", + "eliom", + "eliomi", + "ml4", + "mli", + "mll", + "mly" + ], + "filenames": [] + }, + { + "name": "Oz", + "extensions": [ + "oz" + ], + "filenames": [] + }, + { + "name": "Pascal", + "extensions": [ + "pas", + "dfm", + "dpr", + "lpr", + "pascal" + ], + "filenames": [] + }, + { + "name": "Perl", + "extensions": [ + "pl", + "al", + "perl", + "ph", + "plx", + "pm", + "psgi", + "t" + ], + "filenames": [ + ".latexmkrc", + "Makefile.PL", + "Rexfile", + "ack", + "cpanfile", + "latexmkrc" + ] + }, + { + "name": "PHP", + "extensions": [ + "php", + "aw", + "ctp", + "php3", + "php4", + "php5", + "phps", + "phpt" + ], + "filenames": [ + ".php", + ".php_cs", + ".php_cs.dist", + "Phakefile" + ] + }, + { + "name": "PLSQL", + "extensions": [ + "pls", + "bdy", + "ddl", + "fnc", + "pck", + "pkb", + "pks", + "plb", + "plsql", + "prc", + "spc", + "tpb", + "tps", + "trg", + "vw" + ], + "filenames": [] + }, + { + "name": "PowerShell", + "extensions": [ + "ps1", + "psd1", + "psm1" + ], + "filenames": [] + }, + { + "name": "Properties files", + "extensions": [ + "ini", + "cnf", + "dof", + "lektorproject", + "prefs", + "properties", + "url", + "conf" + ], + "filenames": [ + ".buckconfig", + ".coveragerc", + ".flake8", + ".pylintrc", + "HOSTS", + "buildozer.spec", + "hosts", + "pylintrc", + "vlcrc", + ".editorconfig", + ".gitconfig", + ".npmrc" + ] + }, + { + "name": "ProtoBuf", + "extensions": [ + "proto" + ], + "filenames": [] + }, + { + "name": "Pug", + "extensions": [ + "jade", + "pug" + ], + "filenames": [] + }, + { + "name": "Puppet", + "extensions": [ + "pp" + ], + "filenames": [ + "Modulefile" + ] + }, + { + "name": "Python", + "extensions": [ + "py", + "gyp", + "gypi", + "lmi", + "py3", + "pyde", + "pyi", + "pyp", + "pyt", + "pyw", + "rpy", + "tac", + "wsgi", + "xpy" + ], + "filenames": [ + ".gclient", + "DEPS", + "SConscript", + "SConstruct", + "wscript", + "Snakefile" + ] + }, + { + "name": "Q", + "extensions": [ + "q" + ], + "filenames": [] + }, + { + "name": "R", + "extensions": [ + "r", + "rd", + "rsx" + ], + "filenames": [ + ".Rprofile", + "expr-dist" + ] + }, + { + "name": "RPM Spec", + "extensions": [ + "spec" + ], + "filenames": [] + }, + { + "name": "Ruby", + "extensions": [ + "rb", + "builder", + "eye", + "gemspec", + "god", + "jbuilder", + "mspec", + "pluginspec", + "podspec", + "prawn", + "rabl", + "rake", + "rbi", + "rbuild", + "rbw", + "rbx", + "ru", + "ruby", + "thor", + "watchr" + ], + "filenames": [ + ".irbrc", + ".pryrc", + ".simplecov", + "Appraisals", + "Berksfile", + "Brewfile", + "Buildfile", + "Capfile", + "Dangerfile", + "Deliverfile", + "Fastfile", + "Gemfile", + "Guardfile", + "Jarfile", + "Mavenfile", + "Podfile", + "Puppetfile", + "Rakefile", + "Snapfile", + "Steepfile", + "Thorfile", + "Vagrantfile", + "buildfile" + ] + }, + { + "name": "Rust", + "extensions": [ + "rs" + ], + "filenames": [] + }, + { + "name": "SAS", + "extensions": [ + "sas" + ], + "filenames": [] + }, + { + "name": "Sass", + "extensions": [ + "sass" + ], + "filenames": [] + }, + { + "name": "Scala", + "extensions": [ + "scala", + "kojo", + "sbt", + "sc" + ], + "filenames": [] + }, + { + "name": "Scheme", + "extensions": [ + "scm", + "sch", + "sld", + "sls", + "sps", + "ss" + ], + "filenames": [] + }, + { + "name": "SCSS", + "extensions": [ + "scss" + ], + "filenames": [] + }, + { + "name": "Shell", + "extensions": [ + "sh", + "bash", + "bats", + "command", + "ksh", + "sbatch", + "slurm", + "tmux", + "tool", + "trigger", + "zsh", + "zsh-theme" + ], + "filenames": [ + ".bash_aliases", + ".bash_functions", + ".bash_history", + ".bash_logout", + ".bash_profile", + ".bashrc", + ".cshrc", + ".envrc", + ".flaskenv", + ".kshrc", + ".login", + ".profile", + ".tmux.conf", + ".xinitrc", + ".xsession", + ".zlogin", + ".zlogout", + ".zprofile", + ".zshenv", + ".zshrc", + "9fs", + "PKGBUILD", + "bash_aliases", + "bash_logout", + "bash_profile", + "bashrc", + "cshrc", + "gradlew", + "kshrc", + "login", + "man", + "mvnw", + "profile", + "tmux.conf", + "xinitrc", + "xsession", + "zlogin", + "zlogout", + "zprofile", + "zshenv", + "zshrc" + ] + }, + { + "name": "Sieve", + "extensions": [ + "sieve" + ], + "filenames": [] + }, + { + "name": "Smalltalk", + "extensions": [ + "st" + ], + "filenames": [] + }, + { + "name": "SPARQL", + "extensions": [ + "sparql", + "rq" + ], + "filenames": [] + }, + { + "name": "SQL", + "extensions": [ + "sql", + "ddl", + "mysql", + "prc", + "tab", + "udf", + "viw" + ], + "filenames": [] + }, + { + "name": "Squirrel", + "extensions": [ + "nut" + ], + "filenames": [] + }, + { + "name": "Stylus", + "extensions": [ + "styl" + ], + "filenames": [] + }, + { + "name": "Swift", + "extensions": [ + "swift" + ], + "filenames": [] + }, + { + "name": "SystemVerilog", + "extensions": [ + "sv", + "svh", + "vh" + ], + "filenames": [] + }, + { + "name": "Tcl", + "extensions": [ + "tcl", + "adp", + "sdc", + "tm", + "xdc" + ], + "filenames": [ + "owh", + "starfield" + ] + }, + { + "name": "Textile", + "extensions": [ + "textile" + ], + "filenames": [] + }, + { + "name": "TOML", + "extensions": [ + "toml" + ], + "filenames": [ + "Cargo.lock", + "Cargo.toml.orig", + "Gopkg.lock", + "Pipfile", + "mise.local.lock", + "mise.lock", + "pdm.lock", + "poetry.lock", + "uv.lock" + ] + }, + { + "name": "TSX", + "extensions": [ + "tsx" + ], + "filenames": [] + }, + { + "name": "Turtle", + "extensions": [ + "ttl" + ], + "filenames": [] + }, + { + "name": "TypeScript", + "extensions": [ + "ts", + "cts", + "mts" + ], + "filenames": [] + }, + { + "name": "VBScript", + "extensions": [ + "vbs" + ], + "filenames": [] + }, + { + "name": "Verilog", + "extensions": [ + "veo" + ], + "filenames": [] + }, + { + "name": "VHDL", + "extensions": [ + "vhdl", + "vhd", + "vhf", + "vhi", + "vho", + "vhs", + "vht", + "vhw" + ], + "filenames": [] + }, + { + "name": "Vue", + "extensions": [ + "vue" + ], + "filenames": [] + }, + { + "name": "WebAssembly", + "extensions": [ + "wast", + "wat" + ], + "filenames": [] + }, + { + "name": "XML", + "extensions": [ + "xml", + "adml", + "admx", + "ant", + "axaml", + "axml", + "builds", + "ccproj", + "ccxml", + "clixml", + "cproject", + "cscfg", + "csdef", + "csl", + "csproj", + "ct", + "depproj", + "dita", + "ditamap", + "ditaval", + "dotsettings", + "filters", + "fsproj", + "fxml", + "glade", + "gml", + "gmx", + "gpx", + "grxml", + "gst", + "hzp", + "icls", + "iml", + "ivy", + "jelly", + "jsproj", + "kml", + "launch", + "mdpolicy", + "mjml", + "mod", + "mojo", + "mxml", + "natvis", + "ncl", + "ndproj", + "nproj", + "nuspec", + "odd", + "osm", + "pkgproj", + "pluginspec", + "proj", + "props", + "ps1xml", + "psc1", + "pt", + "pubxml", + "qhelp", + "rdf", + "res", + "resx", + "rss", + "sch", + "scxml", + "sfproj", + "shproj", + "slnx", + "srdf", + "storyboard", + "sublime-snippet", + "sw", + "targets", + "tml", + "typ", + "ui", + "urdf", + "ux", + "vbproj", + "vcxproj", + "vsixmanifest", + "vssettings", + "vstemplate", + "vxml", + "wixproj", + "workflow", + "wsdl", + "wsf", + "wxi", + "wxl", + "wxs", + "x3d", + "xacro", + "xaml", + "xib", + "xlf", + "xliff", + "xmi", + "xmp", + "xproj", + "xsd", + "xspec", + "xul", + "zcml" + ], + "filenames": [ + ".classpath", + ".cproject", + ".project", + "App.config", + "NuGet.config", + "Settings.StyleCop", + "Web.Debug.config", + "Web.Release.config", + "Web.config", + "packages.config" + ] + }, + { + "name": "XQuery", + "extensions": [ + "xquery", + "xq", + "xql", + "xqm", + "xqy" + ], + "filenames": [] + }, + { + "name": "YAML", + "extensions": [ + "yml", + "mir", + "reek", + "rviz", + "sublime-syntax", + "syntax", + "yaml", + "yaml-tmlanguage" + ], + "filenames": [ + ".clang-format", + ".clang-tidy", + ".clangd", + ".gemrc", + "CITATION.cff", + "glide.lock", + "pixi.lock", + "yarn.lock" + ] + } +] diff --git a/assets/go-licenses.json b/assets/go-licenses.json index e642cb2c59f..22dc1696246 100644 --- a/assets/go-licenses.json +++ b/assets/go-licenses.json @@ -4,21 +4,6 @@ "path": "cloud.google.com/go/compute/metadata/LICENSE", "licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n" }, - { - "name": "code.gitea.io/actions-proto-go", - "path": "code.gitea.io/actions-proto-go/LICENSE", - "licenseText": "MIT License\n\nCopyright (c) 2022 The Gitea Authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n" - }, - { - "name": "code.gitea.io/gitea/modules/lfs", - "path": "code.gitea.io/gitea/modules/lfs/LICENSE", - "licenseText": "Copyright (c) 2016 The Gitea Authors\nCopyright (c) GitHub, Inc. and LFS Test Server contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" - }, - { - "name": "code.gitea.io/sdk/gitea", - "path": "code.gitea.io/sdk/gitea/LICENSE", - "licenseText": "Copyright (c) 2016 The Gitea Authors\nCopyright (c) 2014 The Gogs Authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n" - }, { "name": "codeberg.org/gusted/mcaptcha", "path": "codeberg.org/gusted/mcaptcha/LICENSE", @@ -39,6 +24,16 @@ "path": "filippo.io/edwards25519/LICENSE", "licenseText": "Copyright (c) 2009 The Go Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" }, + { + "name": "gitea.com/gitea/runner", + "path": "gitea.com/gitea/runner/LICENSE", + "licenseText": "Copyright (c) 2022 The Gitea Authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n" + }, + { + "name": "gitea.com/gitea/runner/act", + "path": "gitea.com/gitea/runner/act/LICENSE", + "licenseText": "MIT License\n\nCopyright (c) 2022 The Gitea Authors\nCopyright (c) 2019\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" + }, { "name": "gitea.com/go-chi/binding", "path": "gitea.com/go-chi/binding/LICENSE", @@ -69,6 +64,21 @@ "path": "gitea.com/lunny/levelqueue/LICENSE", "licenseText": "Copyright (c) 2019 Lunny Xiao\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n" }, + { + "name": "gitea.dev/actions-proto-go", + "path": "gitea.dev/actions-proto-go/LICENSE", + "licenseText": "MIT License\n\nCopyright (c) 2022 The Gitea Authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n" + }, + { + "name": "gitea.dev/modules/lfs", + "path": "gitea.dev/modules/lfs/LICENSE", + "licenseText": "Copyright (c) 2016 The Gitea Authors\nCopyright (c) GitHub, Inc. and LFS Test Server contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" + }, + { + "name": "gitea.dev/sdk", + "path": "gitea.dev/sdk/LICENSE", + "licenseText": "Copyright (c) 2016 The Gitea Authors\nCopyright (c) 2014 The Gogs Authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n" + }, { "name": "github.com/42wim/httpsig", "path": "github.com/42wim/httpsig/LICENSE", @@ -104,6 +114,11 @@ "path": "github.com/DataDog/zstd/LICENSE", "licenseText": "Simplified BSD License\n\nCopyright (c) 2016, Datadog \u003cinfo@datadoghq.com\u003e\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice,\n this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n * Neither the name of the copyright holder nor the names of its contributors\n may be used to endorse or promote products derived from this software\n without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" }, + { + "name": "github.com/Necoro/html2text", + "path": "github.com/Necoro/html2text/LICENSE", + "licenseText": "The MIT License (MIT)\n\nCopyright (c) 2015 Jay Taylor\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n" + }, { "name": "github.com/ProtonMail/go-crypto", "path": "github.com/ProtonMail/go-crypto/LICENSE", @@ -132,7 +147,7 @@ { "name": "github.com/alecthomas/chroma/v2", "path": "github.com/alecthomas/chroma/v2/COPYING", - "licenseText": "Copyright (C) 2017 Alec Thomas\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" + "licenseText": "Copyright (C) 2017 Alec Thomas\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n// formatters/svg/font_liberation_mono.go\n\nDigitized data copyright (c) 2010 Google Corporation\nwith Reserved Font Arimo, Tinos and Cousine.\nCopyright (c) 2012 Red Hat, Inc.\nwith Reserved Font Name Liberation.\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttps://openfontlicense.org\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 26 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded,\nredistributed and/or sold with any software provided that any reserved\nnames are not used by derivative works. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION \u0026 CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n" }, { "name": "github.com/andybalholm/brotli", @@ -304,6 +319,11 @@ "path": "github.com/blevesearch/zapx/v16/LICENSE", "licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License." }, + { + "name": "github.com/blevesearch/zapx/v17", + "path": "github.com/blevesearch/zapx/v17/LICENSE", + "licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License." + }, { "name": "github.com/bmatcuk/doublestar/v4", "path": "github.com/bmatcuk/doublestar/v4/LICENSE", @@ -420,18 +440,8 @@ "licenseText": "ISC License\n\nCopyright (c) 2012-2016 Dave Collins \u003cdave@davec.name\u003e\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n" }, { - "name": "github.com/dgryski/go-rendezvous", - "path": "github.com/dgryski/go-rendezvous/LICENSE", - "licenseText": "The MIT License (MIT)\n\nCopyright (c) 2017-2020 Damian Gryski \u003cdamian@gryski.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n" - }, - { - "name": "github.com/dimiro1/reply", - "path": "github.com/dimiro1/reply/LICENSE", - "licenseText": "MIT License\n\nCopyright (c) Discourse\nCopyright (c) Claudemiro\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" - }, - { - "name": "github.com/dlclark/regexp2", - "path": "github.com/dlclark/regexp2/LICENSE", + "name": "github.com/dlclark/regexp2/v2", + "path": "github.com/dlclark/regexp2/v2/LICENSE", "licenseText": "The MIT License (MIT)\n\nCopyright (c) Doug Clark\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" }, { @@ -650,8 +660,8 @@ "licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n" }, { - "name": "github.com/google/go-github/v84", - "path": "github.com/google/go-github/v84/LICENSE", + "name": "github.com/google/go-github/v88", + "path": "github.com/google/go-github/v88/LICENSE", "licenseText": "Copyright (c) 2013 The go-github AUTHORS. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" }, { @@ -749,11 +759,6 @@ "path": "github.com/inbucket/html2text/LICENSE", "licenseText": "The MIT License (MIT)\n\nCopyright (c) 2015 Jay Taylor\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n" }, - { - "name": "github.com/jaytaylor/html2text", - "path": "github.com/jaytaylor/html2text/LICENSE", - "licenseText": "The MIT License (MIT)\n\nCopyright (c) 2015 Jay Taylor\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n" - }, { "name": "github.com/jbenet/go-context", "path": "github.com/jbenet/go-context/LICENSE", @@ -959,11 +964,6 @@ "path": "github.com/munnerz/goautoneg/LICENSE", "licenseText": "Copyright (c) 2011, Open Knowledge Foundation Ltd.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in\n the documentation and/or other materials provided with the\n distribution.\n\n Neither the name of the Open Knowledge Foundation Ltd. nor the\n names of its contributors may be used to endorse or promote\n products derived from this software without specific prior written\n permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nHOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" }, - { - "name": "github.com/nektos/act", - "path": "github.com/nektos/act/LICENSE", - "licenseText": "MIT License\n\nCopyright (c) 2022 The Gitea Authors\nCopyright (c) 2019\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" - }, { "name": "github.com/niklasfasching/go-org", "path": "github.com/niklasfasching/go-org/LICENSE", @@ -1079,6 +1079,11 @@ "path": "github.com/redis/go-redis/v9/LICENSE", "licenseText": "Copyright (c) 2013 The github.com/redis/go-redis Authors.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" }, + { + "name": "github.com/remyoudompheng/bigfft", + "path": "github.com/remyoudompheng/bigfft/LICENSE", + "licenseText": "Copyright (c) 2012 The Go Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + }, { "name": "github.com/rhysd/actionlint", "path": "github.com/rhysd/actionlint/LICENSE.txt", @@ -1235,8 +1240,13 @@ "licenseText": "This work is released into the public domain with CC0 1.0.\n\n-------------------------------------------------------------------------------\n\nCreative Commons Legal Code\n\nCC0 1.0 Universal\n\n CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE\n LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN\n ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS\n INFORMATION ON AN \"AS-IS\" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES\n REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS\n PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM\n THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED\n HEREUNDER.\n\nStatement of Purpose\n\nThe laws of most jurisdictions throughout the world automatically confer\nexclusive Copyright and Related Rights (defined below) upon the creator\nand subsequent owner(s) (each and all, an \"owner\") of an original work of\nauthorship and/or a database (each, a \"Work\").\n\nCertain owners wish to permanently relinquish those rights to a Work for\nthe purpose of contributing to a commons of creative, cultural and\nscientific works (\"Commons\") that the public can reliably and without fear\nof later claims of infringement build upon, modify, incorporate in other\nworks, reuse and redistribute as freely as possible in any form whatsoever\nand for any purposes, including without limitation commercial purposes.\nThese owners may contribute to the Commons to promote the ideal of a free\nculture and the further production of creative, cultural and scientific\nworks, or to gain reputation or greater distribution for their Work in\npart through the use and efforts of others.\n\nFor these and/or other purposes and motivations, and without any\nexpectation of additional consideration or compensation, the person\nassociating CC0 with a Work (the \"Affirmer\"), to the extent that he or she\nis an owner of Copyright and Related Rights in the Work, voluntarily\nelects to apply CC0 to the Work and publicly distribute the Work under its\nterms, with knowledge of his or her Copyright and Related Rights in the\nWork and the meaning and intended legal effect of CC0 on those rights.\n\n1. Copyright and Related Rights. A Work made available under CC0 may be\nprotected by copyright and related or neighboring rights (\"Copyright and\nRelated Rights\"). Copyright and Related Rights include, but are not\nlimited to, the following:\n\n i. the right to reproduce, adapt, distribute, perform, display,\n communicate, and translate a Work;\n ii. moral rights retained by the original author(s) and/or performer(s);\niii. publicity and privacy rights pertaining to a person's image or\n likeness depicted in a Work;\n iv. rights protecting against unfair competition in regards to a Work,\n subject to the limitations in paragraph 4(a), below;\n v. rights protecting the extraction, dissemination, use and reuse of data\n in a Work;\n vi. database rights (such as those arising under Directive 96/9/EC of the\n European Parliament and of the Council of 11 March 1996 on the legal\n protection of databases, and under any national implementation\n thereof, including any amended or successor version of such\n directive); and\nvii. other similar, equivalent or corresponding rights throughout the\n world based on applicable law or treaty, and any national\n implementations thereof.\n\n2. Waiver. To the greatest extent permitted by, but not in contravention\nof, applicable law, Affirmer hereby overtly, fully, permanently,\nirrevocably and unconditionally waives, abandons, and surrenders all of\nAffirmer's Copyright and Related Rights and associated claims and causes\nof action, whether now known or unknown (including existing as well as\nfuture claims and causes of action), in the Work (i) in all territories\nworldwide, (ii) for the maximum duration provided by applicable law or\ntreaty (including future time extensions), (iii) in any current or future\nmedium and for any number of copies, and (iv) for any purpose whatsoever,\nincluding without limitation commercial, advertising or promotional\npurposes (the \"Waiver\"). Affirmer makes the Waiver for the benefit of each\nmember of the public at large and to the detriment of Affirmer's heirs and\nsuccessors, fully intending that such Waiver shall not be subject to\nrevocation, rescission, cancellation, termination, or any other legal or\nequitable action to disrupt the quiet enjoyment of the Work by the public\nas contemplated by Affirmer's express Statement of Purpose.\n\n3. Public License Fallback. Should any part of the Waiver for any reason\nbe judged legally invalid or ineffective under applicable law, then the\nWaiver shall be preserved to the maximum extent permitted taking into\naccount Affirmer's express Statement of Purpose. In addition, to the\nextent the Waiver is so judged Affirmer hereby grants to each affected\nperson a royalty-free, non transferable, non sublicensable, non exclusive,\nirrevocable and unconditional license to exercise Affirmer's Copyright and\nRelated Rights in the Work (i) in all territories worldwide, (ii) for the\nmaximum duration provided by applicable law or treaty (including future\ntime extensions), (iii) in any current or future medium and for any number\nof copies, and (iv) for any purpose whatsoever, including without\nlimitation commercial, advertising or promotional purposes (the\n\"License\"). The License shall be deemed effective as of the date CC0 was\napplied by Affirmer to the Work. Should any part of the License for any\nreason be judged legally invalid or ineffective under applicable law, such\npartial invalidity or ineffectiveness shall not invalidate the remainder\nof the License, and in such case Affirmer hereby affirms that he or she\nwill not (i) exercise any of his or her remaining Copyright and Related\nRights in the Work or (ii) assert any associated claims and causes of\naction with respect to the Work, in either case contrary to Affirmer's\nexpress Statement of Purpose.\n\n4. Limitations and Disclaimers.\n\n a. No trademark or patent rights held by Affirmer are waived, abandoned,\n surrendered, licensed or otherwise affected by this document.\n b. Affirmer offers the Work as-is and makes no representations or\n warranties of any kind concerning the Work, express, implied,\n statutory or otherwise, including without limitation warranties of\n title, merchantability, fitness for a particular purpose, non\n infringement, or the absence of latent or other defects, accuracy, or\n the present or absence of errors, whether or not discoverable, all to\n the greatest extent permissible under applicable law.\n c. Affirmer disclaims responsibility for clearing rights of other persons\n that may apply to the Work or any use thereof, including without\n limitation any person's Copyright and Related Rights in the Work.\n Further, Affirmer disclaims responsibility for obtaining any necessary\n consents, permissions or other rights required for any use of the\n Work.\n d. Affirmer understands and acknowledges that Creative Commons is not a\n party to this document and has no duty or obligation with respect to\n this CC0 or use of the Work.\n" }, { - "name": "gitlab.com/gitlab-org/api/client-go", - "path": "gitlab.com/gitlab-org/api/client-go/LICENSE", + "name": "github.com/zeebo/xxh3", + "path": "github.com/zeebo/xxh3/LICENSE", + "licenseText": "BSD 2-Clause License\n\nCopyright (c) 2012-2014, Yann Collet\nCopyright (c) 2019, Jeff Wendling\nAll rights reserved.\n\nxxHash Library\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice, this\n list of conditions and the following disclaimer in the documentation and/or\n other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + }, + { + "name": "gitlab.com/gitlab-org/api/client-go/v2", + "path": "gitlab.com/gitlab-org/api/client-go/v2/LICENSE", "licenseText": " Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"{}\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright {yyyy} {name of copyright owner}\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n" }, { @@ -1359,6 +1369,26 @@ "path": "gopkg.in/yaml.v3/LICENSE", "licenseText": "\nThis project is covered by two different licenses: MIT and Apache.\n\n#### MIT License ####\n\nThe following files were ported to Go from C files of libyaml, and thus\nare still covered by their original MIT license, with the additional\ncopyright staring in 2011 when the project was ported over:\n\n apic.go emitterc.go parserc.go readerc.go scannerc.go\n writerc.go yamlh.go yamlprivateh.go\n\nCopyright (c) 2006-2010 Kirill Simonov\nCopyright (c) 2006-2011 Kirill Simonov\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n### Apache License ###\n\nAll the remaining project files are covered by the Apache license:\n\nCopyright (c) 2011-2019 Canonical Ltd\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" }, + { + "name": "modernc.org/libc", + "path": "modernc.org/libc/LICENSE", + "licenseText": "Copyright (c) 2017 The Libc Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the names of the authors nor the names of the\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + }, + { + "name": "modernc.org/mathutil", + "path": "modernc.org/mathutil/LICENSE", + "licenseText": "Copyright (c) 2014 The mathutil Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the names of the authors nor the names of the\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + }, + { + "name": "modernc.org/memory", + "path": "modernc.org/memory/LICENSE", + "licenseText": "Copyright (c) 2017 The Memory Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the names of the authors nor the names of the\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + }, + { + "name": "modernc.org/sqlite", + "path": "modernc.org/sqlite/LICENSE", + "licenseText": "Copyright (c) 2017 The Sqlite Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\nthis list of conditions and the following disclaimer in the documentation\nand/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its contributors\nmay be used to endorse or promote products derived from this software without\nspecific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" + }, { "name": "mvdan.cc/xurls/v2", "path": "mvdan.cc/xurls/v2/LICENSE", diff --git a/build/generate-bindata.go b/build/generate-bindata.go index 2553770762f..3e14eba4cb3 100644 --- a/build/generate-bindata.go +++ b/build/generate-bindata.go @@ -9,7 +9,7 @@ import ( "fmt" "os" - "code.gitea.io/gitea/modules/assetfs" + "gitea.dev/modules/assetfs" ) func main() { diff --git a/build/generate-emoji.go b/build/generate-emoji.go index cbc1be2139e..7d38a4cbd56 100644 --- a/build/generate-emoji.go +++ b/build/generate-emoji.go @@ -20,7 +20,7 @@ import ( "strings" "unicode/utf8" - "code.gitea.io/gitea/modules/json" + "gitea.dev/modules/json" ) const ( diff --git a/build/generate-gitignores.go b/build/generate-gitignores.go index 1e09c83a6a7..11af4eb70ea 100644 --- a/build/generate-gitignores.go +++ b/build/generate-gitignores.go @@ -1,3 +1,6 @@ +// Copyright 2020 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + //go:build ignore package main @@ -15,7 +18,7 @@ import ( "path/filepath" "strings" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/util" ) func main() { diff --git a/build/generate-go-licenses.go b/build/generate-go-licenses.go index 057e6a6e49a..a4aa5b08323 100644 --- a/build/generate-go-licenses.go +++ b/build/generate-go-licenses.go @@ -29,8 +29,8 @@ var primaryLicenseRe = regexp.MustCompile(`^(?i)(LICEN[SC]E|COPYING)$`) // ignoredNames are LicenseEntry.Name values to exclude from the output. var ignoredNames = map[string]bool{ - "code.gitea.io/gitea": true, - "code.gitea.io/gitea/options/license": true, + "gitea.dev": true, + "gitea.dev/options/license": true, } var excludedExt = map[string]bool{ diff --git a/build/generate-openapi.go b/build/generate-openapi.go index 7b37a5bbba9..3c65781481d 100644 --- a/build/generate-openapi.go +++ b/build/generate-openapi.go @@ -25,7 +25,7 @@ import ( "sort" "strings" - "code.gitea.io/gitea/build/openapi3gen" + "gitea.dev/build/openapi3gen" "github.com/getkin/kin-openapi/openapi3" ) diff --git a/build/openapi3gen/convert.go b/build/openapi3gen/convert.go index 04587b33039..9d446ff45b8 100644 --- a/build/openapi3gen/convert.go +++ b/build/openapi3gen/convert.go @@ -8,7 +8,7 @@ import ( "regexp" "strings" - "code.gitea.io/gitea/modules/json" + "gitea.dev/modules/json" "github.com/getkin/kin-openapi/openapi2" "github.com/getkin/kin-openapi/openapi2conv" diff --git a/build/test-env-check.sh b/build/test-env-check.sh deleted file mode 100755 index 38e5a288231..00000000000 --- a/build/test-env-check.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -set -e - -if [ ! -f ./build/test-env-check.sh ]; then - echo "${0} can only be executed in gitea source root directory" - exit 1 -fi - - -echo "check uid ..." - -# the uid of gitea defined in "https://gitea.com/gitea/test-env" is 1000 -gitea_uid=$(id -u gitea) -if [ "$gitea_uid" != "1000" ]; then - echo "The uid of linux user 'gitea' is expected to be 1000, but it is $gitea_uid" - exit 1 -fi - -cur_uid=$(id -u) -if [ "$cur_uid" != "0" -a "$cur_uid" != "$gitea_uid" ]; then - echo "The uid of current linux user is expected to be 0 or $gitea_uid, but it is $cur_uid" - exit 1 -fi diff --git a/build/test-env-prepare.sh b/build/test-env-prepare.sh deleted file mode 100755 index 0c5bc25f116..00000000000 --- a/build/test-env-prepare.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -set -e - -if [ ! -f ./build/test-env-prepare.sh ]; then - echo "${0} can only be executed in gitea source root directory" - exit 1 -fi - -echo "change the owner of files to gitea ..." -chown -R gitea:gitea . diff --git a/cmd/actions.go b/cmd/actions.go index 44b6b7b54cf..576be764881 100644 --- a/cmd/actions.go +++ b/cmd/actions.go @@ -7,8 +7,8 @@ import ( "context" "fmt" - "code.gitea.io/gitea/modules/private" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/private" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin.go b/cmd/admin.go index c0e21731cbe..2396bbb47c9 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -8,12 +8,12 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/gitrepo" - "code.gitea.io/gitea/modules/log" - repo_module "code.gitea.io/gitea/modules/repository" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/git" + "gitea.dev/modules/gitrepo" + "gitea.dev/modules/log" + repo_module "gitea.dev/modules/repository" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_auth.go b/cmd/admin_auth.go index b55bb1481cf..6a00e961b9a 100644 --- a/cmd/admin_auth.go +++ b/cmd/admin_auth.go @@ -10,9 +10,9 @@ import ( "os" "text/tabwriter" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" - auth_service "code.gitea.io/gitea/services/auth" + auth_model "gitea.dev/models/auth" + "gitea.dev/models/db" + auth_service "gitea.dev/services/auth" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_auth_ldap.go b/cmd/admin_auth_ldap.go index c9be5abb379..d3266fa48d5 100644 --- a/cmd/admin_auth_ldap.go +++ b/cmd/admin_auth_ldap.go @@ -8,9 +8,9 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/modules/util" - "code.gitea.io/gitea/services/auth/source/ldap" + "gitea.dev/models/auth" + "gitea.dev/modules/util" + "gitea.dev/services/auth/source/ldap" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_auth_ldap_test.go b/cmd/admin_auth_ldap_test.go index 0e3e465e81e..f9b5338ba0e 100644 --- a/cmd/admin_auth_ldap_test.go +++ b/cmd/admin_auth_ldap_test.go @@ -7,9 +7,9 @@ import ( "context" "testing" - "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/modules/test" - "code.gitea.io/gitea/services/auth/source/ldap" + "gitea.dev/models/auth" + "gitea.dev/modules/test" + "gitea.dev/services/auth/source/ldap" "github.com/stretchr/testify/assert" "github.com/urfave/cli/v3" diff --git a/cmd/admin_auth_oauth.go b/cmd/admin_auth_oauth.go index 8848c94fc51..c4a86191a17 100644 --- a/cmd/admin_auth_oauth.go +++ b/cmd/admin_auth_oauth.go @@ -9,9 +9,9 @@ import ( "fmt" "net/url" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/modules/util" - "code.gitea.io/gitea/services/auth/source/oauth2" + auth_model "gitea.dev/models/auth" + "gitea.dev/modules/util" + "gitea.dev/services/auth/source/oauth2" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_auth_oauth_test.go b/cmd/admin_auth_oauth_test.go index bb9da667fd1..c16dd96d565 100644 --- a/cmd/admin_auth_oauth_test.go +++ b/cmd/admin_auth_oauth_test.go @@ -7,8 +7,8 @@ import ( "context" "testing" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/services/auth/source/oauth2" + auth_model "gitea.dev/models/auth" + "gitea.dev/services/auth/source/oauth2" "github.com/stretchr/testify/assert" "github.com/urfave/cli/v3" diff --git a/cmd/admin_auth_smtp.go b/cmd/admin_auth_smtp.go index 93e0587fc3c..b7c1a8807ee 100644 --- a/cmd/admin_auth_smtp.go +++ b/cmd/admin_auth_smtp.go @@ -8,9 +8,9 @@ import ( "errors" "strings" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/modules/util" - "code.gitea.io/gitea/services/auth/source/smtp" + auth_model "gitea.dev/models/auth" + "gitea.dev/modules/util" + "gitea.dev/services/auth/source/smtp" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_auth_smtp_test.go b/cmd/admin_auth_smtp_test.go index e54e01830c7..2b890f154aa 100644 --- a/cmd/admin_auth_smtp_test.go +++ b/cmd/admin_auth_smtp_test.go @@ -7,8 +7,8 @@ import ( "context" "testing" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/services/auth/source/smtp" + auth_model "gitea.dev/models/auth" + "gitea.dev/services/auth/source/smtp" "github.com/stretchr/testify/assert" "github.com/urfave/cli/v3" diff --git a/cmd/admin_regenerate.go b/cmd/admin_regenerate.go index aa235441bac..89b7bf383ce 100644 --- a/cmd/admin_regenerate.go +++ b/cmd/admin_regenerate.go @@ -6,9 +6,9 @@ package cmd import ( "context" - "code.gitea.io/gitea/modules/graceful" - asymkey_service "code.gitea.io/gitea/services/asymkey" - repo_service "code.gitea.io/gitea/services/repository" + "gitea.dev/modules/graceful" + asymkey_service "gitea.dev/services/asymkey" + repo_service "gitea.dev/services/repository" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_user_change_password.go b/cmd/admin_user_change_password.go index c27905b4db5..4d5fe586e1d 100644 --- a/cmd/admin_user_change_password.go +++ b/cmd/admin_user_change_password.go @@ -8,11 +8,11 @@ import ( "errors" "fmt" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/auth/password" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/setting" - user_service "code.gitea.io/gitea/services/user" + user_model "gitea.dev/models/user" + "gitea.dev/modules/auth/password" + "gitea.dev/modules/optional" + "gitea.dev/modules/setting" + user_service "gitea.dev/services/user" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_user_change_password_test.go b/cmd/admin_user_change_password_test.go index cf497517f74..50fd8d9e4dd 100644 --- a/cmd/admin_user_change_password_test.go +++ b/cmd/admin_user_change_password_test.go @@ -7,9 +7,9 @@ import ( "io" "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + "gitea.dev/models/db" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/cmd/admin_user_create.go b/cmd/admin_user_create.go index 7e5675cf58d..340ea072d5f 100644 --- a/cmd/admin_user_create.go +++ b/cmd/admin_user_create.go @@ -9,12 +9,12 @@ import ( "fmt" "strings" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - pwd "code.gitea.io/gitea/modules/auth/password" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/setting" + auth_model "gitea.dev/models/auth" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + pwd "gitea.dev/modules/auth/password" + "gitea.dev/modules/optional" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_user_create_test.go b/cmd/admin_user_create_test.go index dbe949ff8d2..f3794c5dffb 100644 --- a/cmd/admin_user_create_test.go +++ b/cmd/admin_user_create_test.go @@ -8,10 +8,10 @@ import ( "strings" "testing" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + auth_model "gitea.dev/models/auth" + "gitea.dev/models/db" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/cmd/admin_user_delete.go b/cmd/admin_user_delete.go index f91041577c3..cc70fe70bf7 100644 --- a/cmd/admin_user_delete.go +++ b/cmd/admin_user_delete.go @@ -9,10 +9,10 @@ import ( "fmt" "strings" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/storage" - user_service "code.gitea.io/gitea/services/user" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/storage" + user_service "gitea.dev/services/user" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_user_delete_test.go b/cmd/admin_user_delete_test.go index b68b358152a..4fbd0435c51 100644 --- a/cmd/admin_user_delete_test.go +++ b/cmd/admin_user_delete_test.go @@ -8,10 +8,10 @@ import ( "strings" "testing" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + auth_model "gitea.dev/models/auth" + "gitea.dev/models/db" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/require" ) diff --git a/cmd/admin_user_generate_access_token.go b/cmd/admin_user_generate_access_token.go index 7f8330ff7e4..cf42a97cddb 100644 --- a/cmd/admin_user_generate_access_token.go +++ b/cmd/admin_user_generate_access_token.go @@ -8,8 +8,8 @@ import ( "errors" "fmt" - auth_model "code.gitea.io/gitea/models/auth" - user_model "code.gitea.io/gitea/models/user" + auth_model "gitea.dev/models/auth" + user_model "gitea.dev/models/user" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_user_list.go b/cmd/admin_user_list.go index 2958fe0cc8b..7f9ce57e24d 100644 --- a/cmd/admin_user_list.go +++ b/cmd/admin_user_list.go @@ -9,7 +9,7 @@ import ( "os" "text/tabwriter" - user_model "code.gitea.io/gitea/models/user" + user_model "gitea.dev/models/user" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_user_must_change_password.go b/cmd/admin_user_must_change_password.go index 468d462b74c..ff318dd0bce 100644 --- a/cmd/admin_user_must_change_password.go +++ b/cmd/admin_user_must_change_password.go @@ -8,8 +8,8 @@ import ( "errors" "fmt" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) diff --git a/cmd/admin_user_must_change_password_test.go b/cmd/admin_user_must_change_password_test.go index efdbe3a9ee9..cf81fbe0ba7 100644 --- a/cmd/admin_user_must_change_password_test.go +++ b/cmd/admin_user_must_change_password_test.go @@ -6,9 +6,9 @@ package cmd import ( "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + "gitea.dev/models/db" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/cmd/cmdtest/cmd_test.go b/cmd/cmdtest/cmd_test.go index 4ff854f8abf..6d4937fa110 100644 --- a/cmd/cmdtest/cmd_test.go +++ b/cmd/cmdtest/cmd_test.go @@ -15,11 +15,11 @@ import ( "strings" "testing" - "code.gitea.io/gitea/cmd" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/test" - "code.gitea.io/gitea/modules/util" + "gitea.dev/cmd" + "gitea.dev/models/unittest" + "gitea.dev/modules/setting" + "gitea.dev/modules/test" + "gitea.dev/modules/util" "github.com/stretchr/testify/assert" "github.com/urfave/cli/v3" diff --git a/cmd/config.go b/cmd/config.go index 5303b0e1e07..42880d99f23 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -9,7 +9,7 @@ import ( "fmt" "os" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) diff --git a/cmd/doctor.go b/cmd/doctor.go index 188740dbcea..8941be0ca0e 100644 --- a/cmd/doctor.go +++ b/cmd/doctor.go @@ -12,16 +12,15 @@ import ( "strings" "text/tabwriter" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/migrations" - migrate_base "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/services/doctor" + "gitea.dev/models/db" + "gitea.dev/models/migrations" + migrate_base "gitea.dev/models/migrations/base" + "gitea.dev/modules/container" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/services/doctor" "github.com/urfave/cli/v3" - "xorm.io/xorm" ) func newDoctorCommand() *cli.Command { @@ -132,7 +131,7 @@ func runRecreateTable(ctx context.Context, cmd *cli.Command) error { } recreateTables := migrate_base.RecreateTables(beans...) - return db.InitEngineWithMigration(context.Background(), func(ctx context.Context, x *xorm.Engine) error { + return db.InitEngineWithMigration(context.Background(), func(ctx context.Context, x db.EngineMigration) error { if err := migrations.EnsureUpToDate(ctx, x); err != nil { return err } diff --git a/cmd/doctor_convert.go b/cmd/doctor_convert.go index f4867912ab3..eceda00183b 100644 --- a/cmd/doctor_convert.go +++ b/cmd/doctor_convert.go @@ -7,9 +7,9 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) diff --git a/cmd/doctor_test.go b/cmd/doctor_test.go index 7d2f3589475..6cc22b0c494 100644 --- a/cmd/doctor_test.go +++ b/cmd/doctor_test.go @@ -7,8 +7,8 @@ import ( "context" "testing" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/services/doctor" + "gitea.dev/modules/log" + "gitea.dev/services/doctor" "github.com/stretchr/testify/assert" "github.com/urfave/cli/v3" diff --git a/cmd/dump.go b/cmd/dump.go index 40b73f69aa1..719e62d3afa 100644 --- a/cmd/dump.go +++ b/cmd/dump.go @@ -11,13 +11,13 @@ import ( "path/filepath" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/dump" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/storage" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/dump" + "gitea.dev/modules/json" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/storage" + "gitea.dev/modules/util" "gitea.com/go-chi/session" "github.com/urfave/cli/v3" diff --git a/cmd/dump_repo.go b/cmd/dump_repo.go index 367454366ec..cc84922e6ab 100644 --- a/cmd/dump_repo.go +++ b/cmd/dump_repo.go @@ -10,14 +10,14 @@ import ( "os" "strings" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/log" - base "code.gitea.io/gitea/modules/migration" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/util" - "code.gitea.io/gitea/services/convert" - "code.gitea.io/gitea/services/migrations" + "gitea.dev/modules/git" + "gitea.dev/modules/log" + base "gitea.dev/modules/migration" + "gitea.dev/modules/setting" + "gitea.dev/modules/structs" + "gitea.dev/modules/util" + "gitea.dev/services/convert" + "gitea.dev/services/migrations" "github.com/urfave/cli/v3" ) diff --git a/cmd/embedded.go b/cmd/embedded.go index e2110756b8f..add8dda12b9 100644 --- a/cmd/embedded.go +++ b/cmd/embedded.go @@ -11,14 +11,14 @@ import ( "path/filepath" "strings" - "code.gitea.io/gitea/modules/assetfs" - "code.gitea.io/gitea/modules/glob" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/options" - "code.gitea.io/gitea/modules/public" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/templates" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/assetfs" + "gitea.dev/modules/glob" + "gitea.dev/modules/log" + "gitea.dev/modules/options" + "gitea.dev/modules/public" + "gitea.dev/modules/setting" + "gitea.dev/modules/templates" + "gitea.dev/modules/util" "github.com/urfave/cli/v3" ) diff --git a/cmd/generate.go b/cmd/generate.go index 21f8b42bff7..01be73c2d11 100644 --- a/cmd/generate.go +++ b/cmd/generate.go @@ -9,7 +9,7 @@ import ( "fmt" "os" - "code.gitea.io/gitea/modules/generate" + "gitea.dev/modules/generate" "github.com/mattn/go-isatty" "github.com/urfave/cli/v3" diff --git a/cmd/helper.go b/cmd/helper.go index ca4cddb49d7..9150e1c2338 100644 --- a/cmd/helper.go +++ b/cmd/helper.go @@ -15,9 +15,9 @@ import ( "strings" "syscall" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) @@ -142,9 +142,9 @@ func PrepareConsoleLoggerLevel(defaultLevel log.Level) func(context.Context, *cl func isValidDefaultSubCommand(cmd *cli.Command) (string, bool) { // Dirty patch for urfave/cli's strange design. // "./gitea bad-cmd" should not start the web server. - rootArgs := cmd.Root().Args().Slice() - if len(rootArgs) != 0 && rootArgs[0] != cmd.Name { - return rootArgs[0], false + args := cmd.Args().Slice() + if len(args) != 0 { + return args[0], false } return "", true } diff --git a/cmd/hook.go b/cmd/hook.go index 4a6c7c2905a..26b3b56053c 100644 --- a/cmd/hook.go +++ b/cmd/hook.go @@ -14,12 +14,12 @@ import ( "strings" "time" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/git/gitcmd" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/private" - repo_module "code.gitea.io/gitea/modules/repository" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/git" + "gitea.dev/modules/git/gitcmd" + "gitea.dev/modules/log" + "gitea.dev/modules/private" + repo_module "gitea.dev/modules/repository" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) diff --git a/cmd/keys.go b/cmd/keys.go index 912cf250915..2f9f52e5dbf 100644 --- a/cmd/keys.go +++ b/cmd/keys.go @@ -9,8 +9,8 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/private" + "gitea.dev/modules/log" + "gitea.dev/modules/private" "github.com/urfave/cli/v3" ) diff --git a/cmd/mailer.go b/cmd/mailer.go index a7dbd68e20a..61bd66c963a 100644 --- a/cmd/mailer.go +++ b/cmd/mailer.go @@ -7,8 +7,8 @@ import ( "context" "fmt" - "code.gitea.io/gitea/modules/private" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/private" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) diff --git a/cmd/main.go b/cmd/main.go index 27d8cba2e90..243995d634b 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -10,8 +10,8 @@ import ( "os" "strings" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) diff --git a/cmd/main_test.go b/cmd/main_test.go index f367bf12e42..047698074c6 100644 --- a/cmd/main_test.go +++ b/cmd/main_test.go @@ -7,7 +7,7 @@ import ( "context" "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" "github.com/urfave/cli/v3" @@ -41,4 +41,5 @@ func TestDefaultCommand(t *testing.T) { test(t, []string{"./gitea"}, "", true) test(t, []string{"./gitea", "test"}, "", true) test(t, []string{"./gitea", "other"}, "other", false) + test(t, []string{"./gitea", "test", "extra"}, "extra", false) } diff --git a/cmd/manager.go b/cmd/manager.go index 586c65990bc..85fccc992de 100644 --- a/cmd/manager.go +++ b/cmd/manager.go @@ -8,7 +8,7 @@ import ( "os" "time" - "code.gitea.io/gitea/modules/private" + "gitea.dev/modules/private" "github.com/urfave/cli/v3" ) diff --git a/cmd/manager_logging.go b/cmd/manager_logging.go index 5812e707e20..4fae0c96c74 100644 --- a/cmd/manager_logging.go +++ b/cmd/manager_logging.go @@ -9,8 +9,8 @@ import ( "fmt" "os" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/private" + "gitea.dev/modules/log" + "gitea.dev/modules/private" "github.com/urfave/cli/v3" ) diff --git a/cmd/migrate.go b/cmd/migrate.go index 016f8a0db56..cc4fee3308a 100644 --- a/cmd/migrate.go +++ b/cmd/migrate.go @@ -6,10 +6,10 @@ package cmd import ( "context" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/services/versioned_migration" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/services/versioned_migration" "github.com/urfave/cli/v3" ) diff --git a/cmd/migrate_storage.go b/cmd/migrate_storage.go index c9b82055c13..36b224fbf38 100644 --- a/cmd/migrate_storage.go +++ b/cmd/migrate_storage.go @@ -10,17 +10,17 @@ import ( "io/fs" "strings" - actions_model "code.gitea.io/gitea/models/actions" - "code.gitea.io/gitea/models/db" - git_model "code.gitea.io/gitea/models/git" - packages_model "code.gitea.io/gitea/models/packages" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/log" - packages_module "code.gitea.io/gitea/modules/packages" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/storage" - "code.gitea.io/gitea/services/versioned_migration" + actions_model "gitea.dev/models/actions" + "gitea.dev/models/db" + git_model "gitea.dev/models/git" + packages_model "gitea.dev/models/packages" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/log" + packages_module "gitea.dev/modules/packages" + "gitea.dev/modules/setting" + "gitea.dev/modules/storage" + "gitea.dev/services/versioned_migration" "github.com/urfave/cli/v3" ) diff --git a/cmd/migrate_storage_test.go b/cmd/migrate_storage_test.go index 3ea193eb1ea..67a6b9e2eef 100644 --- a/cmd/migrate_storage_test.go +++ b/cmd/migrate_storage_test.go @@ -8,13 +8,13 @@ import ( "strings" "testing" - "code.gitea.io/gitea/models/packages" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - packages_module "code.gitea.io/gitea/modules/packages" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/storage" - packages_service "code.gitea.io/gitea/services/packages" + "gitea.dev/models/packages" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + packages_module "gitea.dev/modules/packages" + "gitea.dev/modules/setting" + "gitea.dev/modules/storage" + packages_service "gitea.dev/services/packages" "github.com/stretchr/testify/assert" ) diff --git a/cmd/restore_repo.go b/cmd/restore_repo.go index 26b4682f136..c7bbddd7c4f 100644 --- a/cmd/restore_repo.go +++ b/cmd/restore_repo.go @@ -7,8 +7,8 @@ import ( "context" "strings" - "code.gitea.io/gitea/modules/private" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/private" + "gitea.dev/modules/setting" "github.com/urfave/cli/v3" ) diff --git a/cmd/serv.go b/cmd/serv.go index a35d476c860..93009cd32a3 100644 --- a/cmd/serv.go +++ b/cmd/serv.go @@ -15,21 +15,21 @@ import ( "strings" "unicode" - asymkey_model "code.gitea.io/gitea/models/asymkey" - git_model "code.gitea.io/gitea/models/git" - "code.gitea.io/gitea/models/perm" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/git/gitcmd" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/lfstransfer" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/pprof" - "code.gitea.io/gitea/modules/private" - "code.gitea.io/gitea/modules/process" - repo_module "code.gitea.io/gitea/modules/repository" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/services/lfs" + asymkey_model "gitea.dev/models/asymkey" + git_model "gitea.dev/models/git" + "gitea.dev/models/perm" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/git" + "gitea.dev/modules/git/gitcmd" + "gitea.dev/modules/json" + "gitea.dev/modules/lfstransfer" + "gitea.dev/modules/log" + "gitea.dev/modules/pprof" + "gitea.dev/modules/private" + "gitea.dev/modules/process" + repo_module "gitea.dev/modules/repository" + "gitea.dev/modules/setting" + "gitea.dev/services/lfs" "github.com/kballard/go-shellquote" "github.com/urfave/cli/v3" diff --git a/cmd/web.go b/cmd/web.go index 994c481fc08..5644f37d232 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -15,17 +15,17 @@ import ( "strings" "time" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/graceful" - "code.gitea.io/gitea/modules/gtprof" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/process" - "code.gitea.io/gitea/modules/public" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/templates" - "code.gitea.io/gitea/modules/util" - "code.gitea.io/gitea/routers" - "code.gitea.io/gitea/routers/install" + "gitea.dev/modules/container" + "gitea.dev/modules/graceful" + "gitea.dev/modules/gtprof" + "gitea.dev/modules/log" + "gitea.dev/modules/process" + "gitea.dev/modules/public" + "gitea.dev/modules/setting" + "gitea.dev/modules/templates" + "gitea.dev/modules/util" + "gitea.dev/routers" + "gitea.dev/routers/install" "github.com/felixge/fgprof" "github.com/urfave/cli/v3" @@ -150,7 +150,7 @@ func serveInstall(cmd *cli.Command) error { c := install.Routes() err := listen(c, false) if err != nil { - log.Critical("Unable to open listener for installer. Is Gitea already running?") + log.Error("Unable to open listener for installer. Is Gitea already running?") graceful.GetManager().DoGracefulShutdown() } select { @@ -375,7 +375,7 @@ func listen(m http.Handler, handleRedirector bool) error { log.Fatal("Invalid protocol: %s", setting.Protocol) } if err != nil { - log.Critical("Failed to start server: %v", err) + log.Error("Failed to start server: %v", err) } log.Info("HTTP Listener: %s Closed", listenAddr) return err diff --git a/cmd/web_acme.go b/cmd/web_acme.go index a2e14638f8c..512a990e02d 100644 --- a/cmd/web_acme.go +++ b/cmd/web_acme.go @@ -13,11 +13,11 @@ import ( "strconv" "strings" - "code.gitea.io/gitea/modules/graceful" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/process" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/graceful" + "gitea.dev/modules/log" + "gitea.dev/modules/process" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" "github.com/caddyserver/certmagic" ) diff --git a/cmd/web_graceful.go b/cmd/web_graceful.go index 5e06d2c2164..13eb9ddc46f 100644 --- a/cmd/web_graceful.go +++ b/cmd/web_graceful.go @@ -9,9 +9,9 @@ import ( "net/http/fcgi" "strings" - "code.gitea.io/gitea/modules/graceful" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/graceful" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" ) func runHTTP(network, listenAddr, name string, m http.Handler, useProxyProtocol bool) error { diff --git a/cmd/web_https.go b/cmd/web_https.go index 70d35cd40d8..2eabe32ca5b 100644 --- a/cmd/web_https.go +++ b/cmd/web_https.go @@ -9,9 +9,9 @@ import ( "os" "strings" - "code.gitea.io/gitea/modules/graceful" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/graceful" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" "github.com/klauspost/cpuid/v2" ) diff --git a/contrib/backport/README b/contrib/backport/README deleted file mode 100644 index 466b79c6d49..00000000000 --- a/contrib/backport/README +++ /dev/null @@ -1,41 +0,0 @@ -`backport` -========== - -`backport` is a command to help create backports of PRs. It backports a -provided PR from main on to a released version. - -It will create a backport branch, cherry-pick the PR's merge commit, adjust -the commit message and then push this back up to your fork's remote. - -The default version will read from `docs/config.yml`. You can override this -using the option `--version`. - -The upstream branches will be fetched, using the remote `origin`. This can -be overridden using `--upstream`, and fetching can be avoided using -`--no-fetch`. - -By default the branch created will be called `backport-$PR-$VERSION`. You -can override this using the option `--backport-branch`. This branch will -be created from `--release-branch` which is `release/$(VERSION)` -by default and will be pulled from `$(UPSTREAM)`. - -The merge-commit as determined by the github API will be used as the SHA to -cherry-pick. You can override this using `--cherry-pick`. - -The commit message will be amended to add the `Backport` header. -`--no-amend-message` can be set to stop this from happening. - -If cherry-pick is successful the backported branch will be pushed up to your -fork using your remote. These will be determined using `git remote -v`. You -can set your fork name using `--fork-user` and your remote name using -`--remote`. You can avoid pushing using `--no-push`. - -If the push is successful, `xdg-open` will be called to open a backport url. -You can stop this using `--no-xdg-open`. - -Installation -============ - -```bash -go install contrib/backport/backport.go -``` diff --git a/contrib/backport/backport.go b/contrib/backport/backport.go deleted file mode 100644 index 2af980e5e3c..00000000000 --- a/contrib/backport/backport.go +++ /dev/null @@ -1,456 +0,0 @@ -// Copyright 2023 The Gitea Authors. All rights reserved. -// SPDX-License-Identifier: MIT - -//nolint:forbidigo // use of print functions is allowed in cli -package main - -import ( - "context" - "errors" - "fmt" - "log" - "net/http" - "os" - "os/exec" - "path" - "strconv" - "strings" - - "github.com/google/go-github/v84/github" - "github.com/urfave/cli/v3" - "gopkg.in/yaml.v3" -) - -const defaultVersion = "v1.18" // to backport to - -func main() { - app := &cli.Command{} - app.Name = "backport" - app.Usage = "Backport provided PR-number on to the current or previous released version" - app.Description = `Backport will look-up the PR in Gitea's git log and attempt to cherry-pick it on the current version` - app.ArgsUsage = "" - - app.Flags = []cli.Flag{ - &cli.StringFlag{ - Name: "version", - Usage: "Version branch to backport on to", - }, - &cli.StringFlag{ - Name: "upstream", - Value: "origin", - Usage: "Upstream remote for the Gitea upstream", - }, - &cli.StringFlag{ - Name: "release-branch", - Value: "", - Usage: "Release branch to backport on. Will default to release/", - }, - &cli.StringFlag{ - Name: "cherry-pick", - Usage: "SHA to cherry-pick as backport", - }, - &cli.StringFlag{ - Name: "backport-branch", - Usage: "Backport branch to backport on to (default: backport--", - }, - &cli.StringFlag{ - Name: "remote", - Value: "", - Usage: "Remote for your fork of the Gitea upstream", - }, - &cli.StringFlag{ - Name: "fork-user", - Value: "", - Usage: "Forked user name on Github", - }, - &cli.StringFlag{ - Name: "gh-access-token", - Value: "", - Usage: "Access token for GitHub api request", - }, - &cli.BoolFlag{ - Name: "no-fetch", - Usage: "Set this flag to prevent fetch of remote branches", - }, - &cli.BoolFlag{ - Name: "no-amend-message", - Usage: "Set this flag to prevent automatic amendment of the commit message", - }, - &cli.BoolFlag{ - Name: "no-push", - Usage: "Set this flag to prevent pushing the backport up to your fork", - }, - &cli.BoolFlag{ - Name: "no-xdg-open", - Usage: "Set this flag to not use xdg-open to open the PR URL", - }, - &cli.BoolFlag{ - Name: "continue", - Usage: "Set this flag to continue from a git cherry-pick that has broken", - }, - } - cli.RootCommandHelpTemplate = `NAME: - {{.Name}} - {{.Usage}} -USAGE: - {{.HelpName}} {{if .VisibleFlags}}[options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}} - {{if len .Authors}} -AUTHOR: - {{range .Authors}}{{ . }}{{end}} - {{end}}{{if .Commands}} -OPTIONS: - {{range .VisibleFlags}}{{.}} - {{end}}{{end}} -` - - app.Action = runBackport - if err := app.Run(context.Background(), os.Args); err != nil { - fmt.Fprintf(os.Stderr, "Unable to backport: %v\n", err) - } -} - -func runBackport(ctx context.Context, c *cli.Command) error { - continuing := c.Bool("continue") - - var pr string - - version := c.String("version") - if version == "" && continuing { - // determine version from current branch name - var err error - pr, version, err = readCurrentBranch(ctx) - if err != nil { - return err - } - } - if version == "" { - version = readVersion() - } - if version == "" { - version = defaultVersion - } - - upstream := c.String("upstream") - if upstream == "" { - upstream = "origin" - } - - forkUser := c.String("fork-user") - remote := c.String("remote") - if remote == "" && !c.Bool("--no-push") { - var err error - remote, forkUser, err = determineRemote(ctx, forkUser) - if err != nil { - return err - } - } - - upstreamReleaseBranch := c.String("release-branch") - if upstreamReleaseBranch == "" { - upstreamReleaseBranch = path.Join("release", version) - } - - localReleaseBranch := path.Join(upstream, upstreamReleaseBranch) - - args := c.Args().Slice() - if len(args) == 0 && pr == "" { - return errors.New("no PR number provided\nProvide a PR number to backport") - } else if len(args) != 1 && pr == "" { - return fmt.Errorf("multiple PRs provided %v\nOnly a single PR can be backported at a time", args) - } - if pr == "" { - pr = args[0] - } - - backportBranch := c.String("backport-branch") - if backportBranch == "" { - backportBranch = "backport-" + pr + "-" + version - } - - fmt.Printf("* Backporting %s to %s as %s\n", pr, localReleaseBranch, backportBranch) - - sha := c.String("cherry-pick") - accessToken := c.String("gh-access-token") - if sha == "" { - var err error - sha, err = determineSHAforPR(ctx, pr, accessToken) - if err != nil { - return err - } - } - if sha == "" { - return fmt.Errorf("unable to determine sha for cherry-pick of %s", pr) - } - - if !c.Bool("no-fetch") { - if err := fetchRemoteAndMain(ctx, upstream, upstreamReleaseBranch); err != nil { - return err - } - } - - if !continuing { - if err := checkoutBackportBranch(ctx, backportBranch, localReleaseBranch); err != nil { - return err - } - } - - if err := cherrypick(ctx, sha); err != nil { - return err - } - - if !c.Bool("no-amend-message") { - if err := amendCommit(ctx, pr); err != nil { - return err - } - } - - if !c.Bool("no-push") { - url := "https://github.com/go-gitea/gitea/compare/" + upstreamReleaseBranch + "..." + forkUser + ":" + backportBranch - - if err := gitPushUp(ctx, remote, backportBranch); err != nil { - return err - } - - if !c.Bool("no-xdg-open") { - if err := xdgOpen(ctx, url); err != nil { - return err - } - } else { - fmt.Printf("* Navigate to %s to open PR\n", url) - } - } - return nil -} - -func xdgOpen(ctx context.Context, url string) error { - fmt.Printf("* `xdg-open %s`\n", url) - out, err := exec.CommandContext(ctx, "xdg-open", url).Output() - if err != nil { - fmt.Fprintf(os.Stderr, "%s", string(out)) - return fmt.Errorf("unable to xdg-open to %s: %w", url, err) - } - return nil -} - -func gitPushUp(ctx context.Context, remote, backportBranch string) error { - fmt.Printf("* `git push -u %s %s`\n", remote, backportBranch) - out, err := exec.CommandContext(ctx, "git", "push", "-u", remote, backportBranch).Output() - if err != nil { - fmt.Fprintf(os.Stderr, "%s", string(out)) - return fmt.Errorf("unable to push up to %s: %w", remote, err) - } - return nil -} - -func amendCommit(ctx context.Context, pr string) error { - fmt.Printf("* Amending commit to prepend `Backport #%s` to body\n", pr) - out, err := exec.CommandContext(ctx, "git", "log", "-1", "--pretty=format:%B").Output() - if err != nil { - fmt.Fprintf(os.Stderr, "%s", string(out)) - return fmt.Errorf("unable to get last log message: %w", err) - } - - parts := strings.SplitN(string(out), "\n", 2) - - if len(parts) != 2 { - return fmt.Errorf("unable to interpret log message:\n%s", string(out)) - } - subject, body := parts[0], parts[1] - if !strings.HasSuffix(subject, " (#"+pr+")") { - subject = subject + " (#" + pr + ")" - } - - out, err = exec.CommandContext(ctx, "git", "commit", "--amend", "-m", subject+"\n\nBackport #"+pr+"\n"+body).Output() - if err != nil { - fmt.Fprintf(os.Stderr, "%s", string(out)) - return fmt.Errorf("unable to amend last log message: %w", err) - } - return nil -} - -func cherrypick(ctx context.Context, sha string) error { - // Check if a CHERRY_PICK_HEAD exists - if _, err := os.Stat(".git/CHERRY_PICK_HEAD"); err == nil { - // Assume that we are in the middle of cherry-pick - continue it - fmt.Println("* Attempting git cherry-pick --continue") - out, err := exec.CommandContext(ctx, "git", "cherry-pick", "--continue").Output() - if err != nil { - fmt.Fprintf(os.Stderr, "git cherry-pick --continue failed:\n%s\n", string(out)) - return fmt.Errorf("unable to continue cherry-pick: %w", err) - } - return nil - } - - fmt.Printf("* Attempting git cherry-pick %s\n", sha) - out, err := exec.CommandContext(ctx, "git", "cherry-pick", sha).Output() - if err != nil { - fmt.Fprintf(os.Stderr, "git cherry-pick %s failed:\n%s\n", sha, string(out)) - return fmt.Errorf("git cherry-pick %s failed: %w", sha, err) - } - return nil -} - -func checkoutBackportBranch(ctx context.Context, backportBranch, releaseBranch string) error { - out, err := exec.CommandContext(ctx, "git", "branch", "--show-current").Output() - if err != nil { - return fmt.Errorf("unable to check current branch %w", err) - } - - currentBranch := strings.TrimSpace(string(out)) - fmt.Printf("* Current branch is %s\n", currentBranch) - if currentBranch == backportBranch { - fmt.Printf("* Current branch is %s - not checking out\n", currentBranch) - return nil - } - - if _, err := exec.CommandContext(ctx, "git", "rev-list", "-1", backportBranch).Output(); err == nil { - fmt.Printf("* Branch %s already exists. Checking it out...\n", backportBranch) - return exec.CommandContext(ctx, "git", "checkout", "-f", backportBranch).Run() - } - - fmt.Printf("* `git checkout -b %s %s`\n", backportBranch, releaseBranch) - return exec.CommandContext(ctx, "git", "checkout", "-b", backportBranch, releaseBranch).Run() -} - -func fetchRemoteAndMain(ctx context.Context, remote, releaseBranch string) error { - fmt.Printf("* `git fetch %s main`\n", remote) - out, err := exec.CommandContext(ctx, "git", "fetch", remote, "main").Output() - if err != nil { - fmt.Println(string(out)) - return fmt.Errorf("unable to fetch %s from %s: %w", "main", remote, err) - } - fmt.Println(string(out)) - - fmt.Printf("* `git fetch %s %s`\n", remote, releaseBranch) - out, err = exec.CommandContext(ctx, "git", "fetch", remote, releaseBranch).Output() - if err != nil { - fmt.Println(string(out)) - return fmt.Errorf("unable to fetch %s from %s: %w", releaseBranch, remote, err) - } - fmt.Println(string(out)) - - return nil -} - -func determineRemote(ctx context.Context, forkUser string) (string, string, error) { - out, err := exec.CommandContext(ctx, "git", "remote", "-v").Output() - if err != nil { - fmt.Fprintf(os.Stderr, "Unable to list git remotes:\n%s\n", string(out)) - return "", "", fmt.Errorf("unable to determine forked remote: %w", err) - } - lines := strings.SplitSeq(string(out), "\n") - for line := range lines { - fields := strings.Split(line, "\t") - name, remote := fields[0], fields[1] - // only look at pushers - if !strings.HasSuffix(remote, " (push)") { - continue - } - // only look at github.com pushes - if !strings.Contains(remote, "github.com") { - continue - } - // ignore go-gitea/gitea - if strings.Contains(remote, "go-gitea/gitea") { - continue - } - if !strings.Contains(remote, forkUser) { - continue - } - if after, ok := strings.CutPrefix(remote, "git@github.com:"); ok { - forkUser = after - } else if after, ok := strings.CutPrefix(remote, "https://github.com/"); ok { - forkUser = after - } else if after, ok := strings.CutPrefix(remote, "https://www.github.com/"); ok { - forkUser = after - } else if forkUser == "" { - return "", "", fmt.Errorf("unable to extract forkUser from remote %s: %s", name, remote) - } - idx := strings.Index(forkUser, "/") - if idx >= 0 { - forkUser = forkUser[:idx] - } - return name, forkUser, nil - } - return "", "", fmt.Errorf("unable to find appropriate remote in:\n%s", string(out)) -} - -func readCurrentBranch(ctx context.Context) (pr, version string, err error) { - out, err := exec.CommandContext(ctx, "git", "branch", "--show-current").Output() - if err != nil { - fmt.Fprintf(os.Stderr, "Unable to read current git branch:\n%s\n", string(out)) - return "", "", fmt.Errorf("unable to read current git branch: %w", err) - } - parts := strings.Split(strings.TrimSpace(string(out)), "-") - - if len(parts) != 3 || parts[0] != "backport" { - fmt.Fprintf(os.Stderr, "Unable to continue from git branch:\n%s\n", string(out)) - return "", "", fmt.Errorf("unable to continue from git branch:\n%s", string(out)) - } - - return parts[1], parts[2], nil -} - -func readVersion() string { - bs, err := os.ReadFile("docs/config.yaml") - if err != nil { - if err == os.ErrNotExist { - log.Println("`docs/config.yaml` not present") - return "" - } - fmt.Fprintf(os.Stderr, "Unable to read `docs/config.yaml`: %v\n", err) - return "" - } - - type params struct { - Version string - } - type docConfig struct { - Params params - } - dc := &docConfig{} - if err := yaml.Unmarshal(bs, dc); err != nil { - fmt.Fprintf(os.Stderr, "Unable to read `docs/config.yaml`: %v\n", err) - return "" - } - - if dc.Params.Version == "" { - fmt.Fprintf(os.Stderr, "No version in `docs/config.yaml`") - return "" - } - - version := dc.Params.Version - if version[0] != 'v' { - version = "v" + version - } - - split := strings.SplitN(version, ".", 3) - - return strings.Join(split[:2], ".") -} - -func determineSHAforPR(ctx context.Context, prStr, accessToken string) (string, error) { - prNum, err := strconv.Atoi(prStr) - if err != nil { - return "", err - } - - client := github.NewClient(http.DefaultClient) - if accessToken != "" { - client = client.WithAuthToken(accessToken) - } - - pr, _, err := client.PullRequests.Get(ctx, "go-gitea", "gitea", prNum) - if err != nil { - return "", err - } - - if pr.Merged == nil || !*pr.Merged { - return "", fmt.Errorf("PR #%d is not yet merged - cannot determine sha to backport", prNum) - } - - if pr.MergeCommitSHA != nil { - return *pr.MergeCommitSHA, nil - } - - return "", nil -} diff --git a/contrib/ide/README.md b/contrib/development/README.md similarity index 100% rename from contrib/ide/README.md rename to contrib/development/README.md diff --git a/contrib/ide/vscode/launch.json b/contrib/development/vscode/launch.json similarity index 50% rename from contrib/ide/vscode/launch.json rename to contrib/development/vscode/launch.json index b80b826fc0b..048428fc27f 100644 --- a/contrib/ide/vscode/launch.json +++ b/contrib/development/vscode/launch.json @@ -13,19 +13,6 @@ }, "args": ["web"], "showLog": true - }, - { - "name": "Launch (with SQLite3)", - "type": "go", - "request": "launch", - "mode": "debug", - "buildFlags": "-tags='sqlite sqlite_unlock_notify'", - "program": "${workspaceRoot}/main.go", - "env": { - "GITEA_WORK_DIR": "${workspaceRoot}", - }, - "args": ["web"], - "showLog": true } ] } diff --git a/contrib/development/vscode/settings.json b/contrib/development/vscode/settings.json new file mode 100644 index 00000000000..d968e4daca4 --- /dev/null +++ b/contrib/development/vscode/settings.json @@ -0,0 +1,4 @@ +{ + "go.buildTags": "", + "go.testFlags": ["-v"] +} diff --git a/contrib/development/vscode/tasks.json b/contrib/development/vscode/tasks.json new file mode 100644 index 00000000000..490e30338b1 --- /dev/null +++ b/contrib/development/vscode/tasks.json @@ -0,0 +1,27 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build", + "type": "shell", + "command": "go", + "group": "build", + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "shared" + }, + "linux": { + "args": ["build", "-o", "gitea", "${workspaceRoot}/main.go" ] + }, + "osx": { + "args": ["build", "-o", "gitea", "${workspaceRoot}/main.go" ] + }, + "windows": { + "args": ["build", "-o", "gitea.exe", "\"${workspaceRoot}\\main.go\""] + }, + "problemMatcher": ["$go"] + } + ] +} diff --git a/contrib/gitea-monitoring-mixin/.gitignore b/contrib/grafana-monitoring-mixin/.gitignore similarity index 100% rename from contrib/gitea-monitoring-mixin/.gitignore rename to contrib/grafana-monitoring-mixin/.gitignore diff --git a/contrib/gitea-monitoring-mixin/Makefile b/contrib/grafana-monitoring-mixin/Makefile similarity index 100% rename from contrib/gitea-monitoring-mixin/Makefile rename to contrib/grafana-monitoring-mixin/Makefile diff --git a/contrib/gitea-monitoring-mixin/README.md b/contrib/grafana-monitoring-mixin/README.md similarity index 100% rename from contrib/gitea-monitoring-mixin/README.md rename to contrib/grafana-monitoring-mixin/README.md diff --git a/contrib/gitea-monitoring-mixin/config.libsonnet b/contrib/grafana-monitoring-mixin/config.libsonnet similarity index 100% rename from contrib/gitea-monitoring-mixin/config.libsonnet rename to contrib/grafana-monitoring-mixin/config.libsonnet diff --git a/contrib/gitea-monitoring-mixin/dashboards/dashboards.libsonnet b/contrib/grafana-monitoring-mixin/dashboards/dashboards.libsonnet similarity index 100% rename from contrib/gitea-monitoring-mixin/dashboards/dashboards.libsonnet rename to contrib/grafana-monitoring-mixin/dashboards/dashboards.libsonnet diff --git a/contrib/gitea-monitoring-mixin/dashboards/overview.libsonnet b/contrib/grafana-monitoring-mixin/dashboards/overview.libsonnet similarity index 100% rename from contrib/gitea-monitoring-mixin/dashboards/overview.libsonnet rename to contrib/grafana-monitoring-mixin/dashboards/overview.libsonnet diff --git a/contrib/gitea-monitoring-mixin/jsonnetfile.json b/contrib/grafana-monitoring-mixin/jsonnetfile.json similarity index 100% rename from contrib/gitea-monitoring-mixin/jsonnetfile.json rename to contrib/grafana-monitoring-mixin/jsonnetfile.json diff --git a/contrib/gitea-monitoring-mixin/jsonnetfile.lock.json b/contrib/grafana-monitoring-mixin/jsonnetfile.lock.json similarity index 100% rename from contrib/gitea-monitoring-mixin/jsonnetfile.lock.json rename to contrib/grafana-monitoring-mixin/jsonnetfile.lock.json diff --git a/contrib/gitea-monitoring-mixin/lib/alerts.jsonnet b/contrib/grafana-monitoring-mixin/lib/alerts.jsonnet similarity index 100% rename from contrib/gitea-monitoring-mixin/lib/alerts.jsonnet rename to contrib/grafana-monitoring-mixin/lib/alerts.jsonnet diff --git a/contrib/gitea-monitoring-mixin/lib/dashboards.jsonnet b/contrib/grafana-monitoring-mixin/lib/dashboards.jsonnet similarity index 100% rename from contrib/gitea-monitoring-mixin/lib/dashboards.jsonnet rename to contrib/grafana-monitoring-mixin/lib/dashboards.jsonnet diff --git a/contrib/gitea-monitoring-mixin/lib/rules.jsonnet b/contrib/grafana-monitoring-mixin/lib/rules.jsonnet similarity index 100% rename from contrib/gitea-monitoring-mixin/lib/rules.jsonnet rename to contrib/grafana-monitoring-mixin/lib/rules.jsonnet diff --git a/contrib/gitea-monitoring-mixin/mixin.libsonnet b/contrib/grafana-monitoring-mixin/mixin.libsonnet similarity index 100% rename from contrib/gitea-monitoring-mixin/mixin.libsonnet rename to contrib/grafana-monitoring-mixin/mixin.libsonnet diff --git a/contrib/ide/vscode/settings.json b/contrib/ide/vscode/settings.json deleted file mode 100644 index e33bccf9028..00000000000 --- a/contrib/ide/vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "go.buildTags": "'sqlite sqlite_unlock_notify'", - "go.testFlags": ["-v"] -} \ No newline at end of file diff --git a/contrib/ide/vscode/tasks.json b/contrib/ide/vscode/tasks.json deleted file mode 100644 index e35ae303b27..00000000000 --- a/contrib/ide/vscode/tasks.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "Build", - "type": "shell", - "command": "go", - "group": "build", - "presentation": { - "echo": true, - "reveal": "always", - "focus": false, - "panel": "shared" - }, - "linux": { - "args": ["build", "-o", "gitea", "${workspaceRoot}/main.go" ] - }, - "osx": { - "args": ["build", "-o", "gitea", "${workspaceRoot}/main.go" ] - }, - "windows": { - "args": ["build", "-o", "gitea.exe", "\"${workspaceRoot}\\main.go\""] - }, - "problemMatcher": ["$go"] - }, - { - "label": "Build (with SQLite3)", - "type": "shell", - "command": "go", - "group": "build", - "presentation": { - "echo": true, - "reveal": "always", - "focus": false, - "panel": "shared" - }, - "linux": { - "args": ["build", "-tags=\"sqlite sqlite_unlock_notify\"", "-o", "gitea", "${workspaceRoot}/main.go"] - }, - "osx": { - "args": ["build", "-tags=\"sqlite sqlite_unlock_notify\"", "-o", "gitea", "${workspaceRoot}/main.go"] - }, - "windows": { - "args": ["build", "-tags=\"sqlite sqlite_unlock_notify\"", "-o", "gitea.exe", "\"${workspaceRoot}\\main.go\""] - }, - "problemMatcher": ["$go"] - } - ] -} diff --git a/contrib/init/centos/gitea b/contrib/init/centos/gitea deleted file mode 100644 index 4f0d0d99b26..00000000000 --- a/contrib/init/centos/gitea +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -# -# /etc/rc.d/init.d/gitea -# -# Runs the Gitea Git with a cup of tea. -# -# -# chkconfig: - 85 15 -# - -### BEGIN INIT INFO -# Provides: gitea -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start gitea at boot time. -# Description: Control gitea. -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -# Default values - -NAME=gitea -GITEA_HOME=/var/lib/${NAME} -GITEA_PATH=/usr/local/bin/${NAME} -GITEA_USER=git -SERVICENAME="Gitea - Git with a cup of tea" -LOCKFILE=/var/lock/subsys/gitea -LOGPATH=${GITEA_HOME}/log -LOGFILE=${LOGPATH}/gitea.log -RETVAL=0 - -# Read configuration from /etc/sysconfig/gitea to override defaults -[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME - -# Don't do anything if nothing is installed -[ -x ${GITEA_PATH} ] || exit 0 -# exit if logpath dir is not created. -[ -x ${LOGPATH} ] || exit 0 - -DAEMON_OPTS="--check $NAME" - -# Set additional options, if any -[ ! -z "$GITEA_USER" ] && DAEMON_OPTS="$DAEMON_OPTS --user=${GITEA_USER}" - -start() { - cd ${GITEA_HOME} - echo -n "Starting ${SERVICENAME}: " - daemon $DAEMON_OPTS "${GITEA_PATH} web -c /etc/${NAME}/app.ini > ${LOGFILE} 2>&1 &" - RETVAL=$? - echo - [ $RETVAL = 0 ] && touch ${LOCKFILE} - - return $RETVAL -} - -stop() { - cd ${GITEA_HOME} - echo -n "Shutting down ${SERVICENAME}: " - killproc ${NAME} - RETVAL=$? - echo - [ $RETVAL = 0 ] && rm -f ${LOCKFILE} -} - -case "$1" in - start) - status ${NAME} > /dev/null 2>&1 && exit 0 - start - ;; - stop) - stop - ;; - status) - status ${NAME} - ;; - restart) - stop - start - ;; - reload) - stop - start - ;; - *) - echo "Usage: ${NAME} {start|stop|status|restart}" - exit 1 - ;; -esac -exit $RETVAL diff --git a/contrib/init/debian/gitea b/contrib/init/debian/gitea deleted file mode 100644 index 22463094407..00000000000 --- a/contrib/init/debian/gitea +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: gitea -# Required-Start: $syslog $network -# Required-Stop: $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: A self-hosted Git service written in Go. -# Description: A self-hosted Git service written in Go. -### END INIT INFO - -# Author: Danny Boisvert - -# Do NOT "set -e" - -# PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin -DESC="Gitea - Git with a cup of tea" -NAME=gitea -SERVICEVERBOSE=yes -PIDFILE=/run/$NAME.pid -SCRIPTNAME=/etc/init.d/$NAME -WORKINGDIR=/var/lib/$NAME -DAEMON=/usr/local/bin/$NAME -DAEMON_ARGS="web -c /etc/$NAME/app.ini" -USER=git -USERBIND="" -# If you want to bind Gitea to a port below 1024 uncomment -# the line below -#USERBIND="setcap cap_net_bind_service=+ep" -STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/1/KILL/5}" - -# Read configuration variable file if it is present -[ -r /etc/default/$NAME ] && . /etc/default/$NAME - -# Exit if the package is not installed -[ -x "$DAEMON" ] || exit 0 - -do_start() -{ - $USERBIND $DAEMON - sh -c "USER=$USER HOME=/home/$USER GITEA_WORK_DIR=$WORKINGDIR start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\ - --background --chdir $WORKINGDIR --chuid $USER \\ - --exec $DAEMON -- $DAEMON_ARGS" -} - -do_stop() -{ - start-stop-daemon --stop --quiet --retry=$STOP_SCHEDULE --pidfile $PIDFILE --name $NAME --oknodo - rm -f $PIDFILE -} - -do_status() -{ - if [ -f $PIDFILE ]; then - if kill -0 $(cat "$PIDFILE"); then - echo "$NAME is running, PID is $(cat $PIDFILE)" - else - echo "$NAME process is dead, but pidfile exists" - fi - else - echo "$NAME is not running" - fi -} - -case "$1" in - start) - echo "Starting $DESC" "$NAME" - do_start - ;; - stop) - echo "Stopping $DESC" "$NAME" - do_stop - ;; - status) - do_status - ;; - restart) - echo "Restarting $DESC" "$NAME" - do_stop - do_start - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2 - exit 2 - ;; -esac - -exit 0 diff --git a/contrib/init/suse/gitea b/contrib/init/suse/gitea deleted file mode 100644 index 6391bedaf83..00000000000 --- a/contrib/init/suse/gitea +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/sh -# -# /etc/init.d/gitea -# -# Runs the Gitea Git with a cup of tea. -# - -### BEGIN INIT INFO -# Provides: gitea -# Required-Start: $remote_fs -# Required-Stop: $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start gitea at boot time. -# Description: Control gitea. -### END INIT INFO - -# Default values - -NAME=gitea -GITEA_HOME=/var/lib/$NAME -GITEA_PATH=/usr/local/bin/$NAME -GITEA_USER=git -SERVICENAME="Gitea - Git with a cup of tea" -LOCKFILE=/var/lock/subsys/gitea -LOGPATH=${GITEA_HOME}/log -LOGFILE=${LOGPATH}/error.log -# gitea creates its own gitea.log from stdout -RETVAL=0 - -# Read configuration from /etc/sysconfig/gitea to override defaults -[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME - -# Don't do anything if nothing is installed -test -x ${GITEA_PATH} || { echo "$NAME not installed"; - if [ "$1" = "stop" ]; then exit 0; - else exit 5; fi; } - -# exit if logpath dir is not created. -test -r ${LOGPATH} || { echo "$LOGPATH not existing"; - if [ "$1" = "stop" ]; then exit 0; - else exit 6; fi; } - -# Source function library. -. /etc/rc.status - -# Reset status of this service -rc_reset - - -case "$1" in - start) - echo -n "Starting ${SERVICENAME} " - - # As we can't use startproc, we have to check ourselves if the service is already running - /sbin/checkproc ${GITEA_PATH} - if [ $? -eq 0 ]; then - # return skipped as service is already running - (exit 5) - else - su - ${GITEA_USER} -c "USER=${GITEA_USER} GITEA_WORK_DIR=${GITEA_HOME} ${GITEA_PATH} web -c /etc/${NAME}/app.ini 2>&1 >>${LOGFILE} &" - fi - - # Remember status and be verbose - rc_status -v - ;; - - stop) - echo -n "Shutting down ${SERVICENAME} " - - ## Stop daemon with killproc(8) and if this fails - ## killproc sets the return value according to LSB. - /sbin/killproc ${GITEA_PATH} - - # Remember status and be verbose - rc_status -v - ;; - - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - - status) - echo -n "Checking for ${SERVICENAME} " - ## Check status with checkproc(8), if process is running - ## checkproc will return with exit status 0. - - # Return value is slightly different for the status command: - # 0 - service up and running - # 1 - service dead, but /run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists - # 3 - service not running (unused) - # 4 - service status unknown :-( - # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.) - - # NOTE: checkproc returns LSB compliant status values. - /sbin/checkproc ${GITEA_PATH} - # NOTE: rc_status knows that we called this init script with - # "status" option and adapts its messages accordingly. - rc_status -v - ;; - - *) - echo "Usage: $0 {start|stop|status|restart}" - exit 1 - ;; - -esac -rc_exit diff --git a/contrib/legal/privacy.html.sample b/contrib/sample-page/privacy.html.sample similarity index 100% rename from contrib/legal/privacy.html.sample rename to contrib/sample-page/privacy.html.sample diff --git a/contrib/legal/tos.html.sample b/contrib/sample-page/tos.html.sample similarity index 100% rename from contrib/legal/tos.html.sample rename to contrib/sample-page/tos.html.sample diff --git a/contrib/init/freebsd/gitea b/contrib/service/freebsd/gitea similarity index 100% rename from contrib/init/freebsd/gitea rename to contrib/service/freebsd/gitea diff --git a/contrib/init/gentoo/gitea b/contrib/service/gentoo/gitea similarity index 100% rename from contrib/init/gentoo/gitea rename to contrib/service/gentoo/gitea diff --git a/contrib/launchd/io.gitea.web.plist b/contrib/service/launchd/io.gitea.web.plist similarity index 100% rename from contrib/launchd/io.gitea.web.plist rename to contrib/service/launchd/io.gitea.web.plist diff --git a/contrib/init/openbsd/gitea b/contrib/service/openbsd/gitea similarity index 100% rename from contrib/init/openbsd/gitea rename to contrib/service/openbsd/gitea diff --git a/contrib/init/openwrt/gitea b/contrib/service/openwrt/gitea similarity index 100% rename from contrib/init/openwrt/gitea rename to contrib/service/openwrt/gitea diff --git a/contrib/init/sunos/gitea.xml b/contrib/service/sunos/gitea.xml similarity index 100% rename from contrib/init/sunos/gitea.xml rename to contrib/service/sunos/gitea.xml diff --git a/contrib/supervisor/gitea b/contrib/service/supervisor/gitea similarity index 100% rename from contrib/supervisor/gitea rename to contrib/service/supervisor/gitea diff --git a/contrib/systemd/gitea.service b/contrib/service/systemd/gitea.service similarity index 100% rename from contrib/systemd/gitea.service rename to contrib/service/systemd/gitea.service diff --git a/contrib/init/ubuntu/gitea b/contrib/service/sysvinit/gitea similarity index 90% rename from contrib/init/ubuntu/gitea rename to contrib/service/sysvinit/gitea index da56b6e4a97..1508da7f843 100644 --- a/contrib/init/ubuntu/gitea +++ b/contrib/service/sysvinit/gitea @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash ### BEGIN INIT INFO # Provides: gitea # Required-Start: $syslog $network @@ -9,6 +9,8 @@ # Description: A self-hosted Git service written in Go. ### END INIT INFO +# This is a System V Init (init.d) startup script for legacy Linux distributions + # Do NOT "set -e" # PATH should only include /usr/* if it runs after the mountnfs.sh script @@ -24,6 +26,9 @@ DAEMON_ARGS="web -c /etc/$NAME/app.ini" USER=git STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/1/KILL/5}" +# If you want to bind Gitea to a port below 1024, apply "setcap" to the gitea binary +#setcap cap_net_bind_service=+ep $DAEMON" + # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME diff --git a/contrib/update_dependencies.sh b/contrib/update_dependencies.sh deleted file mode 100755 index 5700a198974..00000000000 --- a/contrib/update_dependencies.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -grep 'git' go.mod | grep '\.com' | grep -v indirect | grep -v replace | cut -f 2 | cut -d ' ' -f 1 | while read line; do - go get -u "$line" - make vendor - git add . - git commit -m "update $line" -done diff --git a/contrib/upgrade.sh b/contrib/upgrade.sh index 2593d245093..71d0435d146 100755 --- a/contrib/upgrade.sh +++ b/contrib/upgrade.sh @@ -126,6 +126,7 @@ giteacmd manager flush-queues echo "Stopping gitea at $(date)" $service_stop echo "Creating backup in $giteahome" +# shellcheck disable=SC2086 # flag string giteacmd dump $backupopts echo "Updating binary at $giteabin" cp -f "$giteabin" "$giteabin.bak" && mv -f "$binname" "$giteabin" diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini index dd62cf8e830..2793dd1ca09 100644 --- a/custom/conf/app.example.ini +++ b/custom/conf/app.example.ini @@ -159,6 +159,16 @@ ;; Domain name to be exposed in clone URL, defaults to DOMAIN or the domain part of ROOT_URL ;SSH_DOMAIN = ;; +;; Port number to be exposed in clone URL. +;; If you need a different "SSH clone port" from the real "SSH listen port", set the SSH_LISTEN_PORT separately. +;SSH_PORT = 22 +;; +;; The network interface that the builtin SSH server should listen on +;SSH_LISTEN_HOST = +;; +;; The port number that the builtin SSH server should listen on, defaults to SSH_PORT +;SSH_LISTEN_PORT = +;; ;; SSH username displayed in clone URLs. It defaults to BUILTIN_SSH_SERVER_USER or RUN_USER. ;; If it is set to "(DOER_USERNAME)", it will use current signed-in user's username. ;; This option is only for some advanced users who have configured their SSH reverse-proxy @@ -166,15 +176,6 @@ ;; Most users should just leave it blank. ;SSH_USER = ;; -;; The network interface the builtin SSH server should listen on -;SSH_LISTEN_HOST = -;; -;; Port number to be exposed in clone URL -;SSH_PORT = 22 -;; -;; The port number the builtin SSH server should listen on, defaults to SSH_PORT -;SSH_LISTEN_PORT = -;; ;; Root path of SSH user directory for the system's standalone SSH server if Gitea is not using its builtin SSH server. ;; Default is the '.ssh' directory in the run user's home directory. ;SSH_ROOT_PATH = @@ -383,7 +384,7 @@ USER = root ;; ;DB_TYPE = sqlite3 ;PATH= ; defaults to data/gitea.db -;SQLITE_TIMEOUT = ; Query timeout defaults to: 500 +;SQLITE_TIMEOUT = ; Query timeout in milliseconds, defaults to: 20000 ;SQLITE_JOURNAL_MODE = ; defaults to sqlite database default (often DELETE), can be used to enable WAL mode. https://www.sqlite.org/pragma.html#pragma_journal_mode ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -1023,9 +1024,18 @@ LEVEL = Info ;; Default private when using push-to-create ;DEFAULT_PUSH_CREATE_PRIVATE = true ;; -;; Global limit of repositories per user, applied at creation time. -1 means no limit +;; Global limit of repositories per user or org, applied at creation time. -1 means no limit +;; To configure independent limits for users and orgs, use USER_MAX_CREATION_LIMIT and ORG_MAX_CREATION_LIMIT ;MAX_CREATION_LIMIT = -1 ;; +;; Global limit of repositories per user, applied at creation time. -1 means no limit +;; Takes precedence over MAX_CREATION_LIMIT when set +;USER_MAX_CREATION_LIMIT = -1 +;; +;; Global limit of repositories per organization, applied at creation time. -1 means no limit +;; Takes precedence over MAX_CREATION_LIMIT when set +;ORG_MAX_CREATION_LIMIT = -1 +;; ;; Preferred Licenses to place at the top of the List ;; The name here must match the filename in options/license or custom/options/license ;PREFERRED_LICENSES = Apache License 2.0,MIT License @@ -1172,7 +1182,7 @@ LEVEL = Info ;; Default source for the pull request title when opening a new PR. ;; "first-commit" uses the oldest commit's summary. ;; "auto" uses commit's summary if the PR only has one commit, normalizes the branch name if multiple commits. -;DEFAULT_TITLE_SOURCE = first-commit +;DEFAULT_TITLE_SOURCE = auto ;; ;; Delay mergeable check until page view or API access, for pull requests that have not been updated in the specified days when their base branches get updated. ;; Use "-1" to always check all pull requests (old behavior). Use "0" to always delay the checks. diff --git a/docker/rootless/usr/local/bin/docker-entrypoint.sh b/docker/rootless/usr/local/bin/docker-entrypoint.sh index ca509214bff..4ffc4ff3a11 100755 --- a/docker/rootless/usr/local/bin/docker-entrypoint.sh +++ b/docker/rootless/usr/local/bin/docker-entrypoint.sh @@ -13,5 +13,5 @@ fi if [ $# -gt 0 ]; then exec "$@" else - exec /usr/local/bin/gitea -c ${GITEA_APP_INI} web + exec /usr/local/bin/gitea -c "${GITEA_APP_INI}" web fi diff --git a/docker/rootless/usr/local/bin/docker-setup.sh b/docker/rootless/usr/local/bin/docker-setup.sh index feab02a3793..3320d69dde8 100755 --- a/docker/rootless/usr/local/bin/docker-setup.sh +++ b/docker/rootless/usr/local/bin/docker-setup.sh @@ -1,23 +1,23 @@ #!/bin/bash # Prepare git folder -mkdir -p ${HOME} && chmod 0700 ${HOME} -if [ ! -w ${HOME} ]; then echo "${HOME} is not writable"; exit 1; fi +mkdir -p "${HOME}" && chmod 0700 "${HOME}" +if [ ! -w "${HOME}" ]; then echo "${HOME} is not writable"; exit 1; fi # Prepare custom folder -mkdir -p ${GITEA_CUSTOM} && chmod 0700 ${GITEA_CUSTOM} +mkdir -p "${GITEA_CUSTOM}" && chmod 0700 "${GITEA_CUSTOM}" # Prepare temp folder -mkdir -p ${GITEA_TEMP} && chmod 0700 ${GITEA_TEMP} -if [ ! -w ${GITEA_TEMP} ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi +mkdir -p "${GITEA_TEMP}" && chmod 0700 "${GITEA_TEMP}" +if [ ! -w "${GITEA_TEMP}" ]; then echo "${GITEA_TEMP} is not writable"; exit 1; fi #Prepare config file -if [ ! -f ${GITEA_APP_INI} ]; then +if [ ! -f "${GITEA_APP_INI}" ]; then #Prepare config file folder - GITEA_APP_INI_DIR=$(dirname ${GITEA_APP_INI}) - mkdir -p ${GITEA_APP_INI_DIR} && chmod 0700 ${GITEA_APP_INI_DIR} - if [ ! -w ${GITEA_APP_INI_DIR} ]; then echo "${GITEA_APP_INI_DIR} is not writable"; exit 1; fi + GITEA_APP_INI_DIR=$(dirname "${GITEA_APP_INI}") + mkdir -p "${GITEA_APP_INI_DIR}" && chmod 0700 "${GITEA_APP_INI_DIR}" + if [ ! -w "${GITEA_APP_INI_DIR}" ]; then echo "${GITEA_APP_INI_DIR} is not writable"; exit 1; fi # Set INSTALL_LOCK to true only if SECRET_KEY is not empty and # INSTALL_LOCK is empty @@ -34,7 +34,7 @@ if [ ! -f ${GITEA_APP_INI} ]; then ROOT_URL=${ROOT_URL:-""} \ DISABLE_SSH=${DISABLE_SSH:-"false"} \ SSH_PORT=${SSH_PORT:-"2222"} \ - SSH_LISTEN_PORT=${SSH_LISTEN_PORT:-$SSH_PORT} \ + SSH_LISTEN_PORT=${SSH_LISTEN_PORT:-} \ DB_TYPE=${DB_TYPE:-"sqlite3"} \ DB_HOST=${DB_HOST:-"localhost:3306"} \ DB_NAME=${DB_NAME:-"gitea"} \ @@ -44,8 +44,8 @@ if [ ! -f ${GITEA_APP_INI} ]; then DISABLE_REGISTRATION=${DISABLE_REGISTRATION:-"false"} \ REQUIRE_SIGNIN_VIEW=${REQUIRE_SIGNIN_VIEW:-"false"} \ SECRET_KEY=${SECRET_KEY:-""} \ - envsubst < /etc/templates/app.ini > ${GITEA_APP_INI} + envsubst < /etc/templates/app.ini > "${GITEA_APP_INI}" fi # Replace app.ini settings with env variables in the form GITEA__SECTION_NAME__KEY_NAME -environment-to-ini --config ${GITEA_APP_INI} +environment-to-ini --config "${GITEA_APP_INI}" diff --git a/docs/community-governance.md b/docs/community-governance.md index dbf24813295..e37e9def64e 100644 --- a/docs/community-governance.md +++ b/docs/community-governance.md @@ -48,7 +48,7 @@ If a PR has `lgtm/done`, no open discussions, and no merge conflicts, any mainta -Gitea uses its own tool, , to automate parts of the review process. The backporter: +Gitea uses its own tool, , to automate parts of the review process. The backporter: - Creates a backport PR when needed after the initial PR merges. - Removes the PR from the merge queue after it merges. diff --git a/docs/guideline-backend.md b/docs/guideline-backend.md index bc3e71113f2..29fa92288cd 100644 --- a/docs/guideline-backend.md +++ b/docs/guideline-backend.md @@ -56,3 +56,8 @@ Endpoints returning lists must - support pagination (`page` & `limit` options in query) - set `X-Total-Count` header via **SetTotalCountHeader** ([example](https://github.com/go-gitea/gitea/blob/7aae98cc5d4113f1e9918b7ee7dd09f67c189e3e/routers/api/v1/repo/issue.go#L444)) + +### Knowledge + +- Partially database table migration must use `SyncWithOptions(IgnoreDrop...)` +- Template variables with "camelCase" or "snake_case" are used for restoring the form values from a submitted form diff --git a/eslint.config.ts b/eslint.config.ts index 29016ed808b..91adc06e193 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -570,8 +570,6 @@ export default defineConfig([ 'no-redeclare': [0], // must be disabled for typescript overloads 'no-regex-spaces': [2], 'no-restricted-exports': [0], - 'no-restricted-globals': [2, ...restrictedGlobals], - 'no-restricted-properties': [2, ...restrictedProperties], 'no-restricted-imports': [2, {paths: [ {name: 'jquery', message: 'Use the global $ instead', allowTypeImports: true}, ]}], @@ -1022,5 +1020,9 @@ export default defineConfig([ { files: ['web_src/**/*'], languageOptions: {globals: {...globals.browser, ...globals.jquery}}, + rules: { + 'no-restricted-globals': [2, ...restrictedGlobals], + 'no-restricted-properties': [2, ...restrictedProperties], + }, }, ]); diff --git a/eslint.json.config.ts b/eslint.json.config.ts index 45696fb79cb..aa6ed0e4c62 100644 --- a/eslint.json.config.ts +++ b/eslint.json.config.ts @@ -13,12 +13,18 @@ export default defineConfig([ language: 'json/json', extends: ['json/recommended'], }, + { + files: ['**/*.json5'], + plugins: {json}, + language: 'json/json5', + extends: ['json/recommended'], + }, { files: [ 'tsconfig.json', '.devcontainer/*.json', '.vscode/*.json', - 'contrib/ide/vscode/*.json', + 'contrib/development/vscode/*.json', ], plugins: {json}, language: 'json/jsonc', diff --git a/flake.nix b/flake.nix index 7b9fbb193c3..ca88b581a22 100644 --- a/flake.nix +++ b/flake.nix @@ -83,7 +83,7 @@ GO = "${go}/bin/go"; GOROOT = "${go}/share/go"; - TAGS = "sqlite sqlite_unlock_notify"; + TAGS = ""; STATIC = "true"; } // linuxOnlyEnv; diff --git a/go.mod b/go.mod index 156abf4afb8..ead88bf5fb7 100644 --- a/go.mod +++ b/go.mod @@ -1,43 +1,39 @@ -module code.gitea.io/gitea +module gitea.dev -go 1.26.2 - -// rfc5280 said: "The serial number is an integer assigned by the CA to each certificate." -// But some CAs use negative serial number, just relax the check. related: -// Default TLS cert uses negative serial number #895 https://github.com/microsoft/mssql-docker/issues/895 -godebug x509negativeserial=1 +go 1.26.3 require ( - code.gitea.io/actions-proto-go v0.4.1 - code.gitea.io/sdk/gitea v0.24.1 codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570 - connectrpc.com/connect v1.19.1 + connectrpc.com/connect v1.20.0 + gitea.com/gitea/runner v1.0.5 gitea.com/go-chi/binding v0.0.0-20260414111559-654cea7ac60a gitea.com/go-chi/cache v0.2.1 gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098 gitea.com/go-chi/session v0.0.0-20251124165456-68e0254e989e gitea.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96 gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4 + gitea.dev/actions-proto-go v0.5.0 + gitea.dev/sdk v1.0.1 github.com/42wim/httpsig v1.2.4 github.com/42wim/sshsig v0.0.0-20260317195500-b9f38cf0d432 - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.0 - github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.2 - github.com/Azure/go-ntlmssp v0.1.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 + github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.3 + github.com/Azure/go-ntlmssp v0.1.1 + github.com/Necoro/html2text v0.0.0-20250804200300-7bf1ce1c7347 github.com/ProtonMail/go-crypto v1.4.1 github.com/PuerkitoBio/goquery v1.12.0 - github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.8.0 - github.com/alecthomas/chroma/v2 v2.23.1 - github.com/aws/aws-sdk-go-v2/credentials v1.19.15 - github.com/aws/aws-sdk-go-v2/service/codecommit v1.33.13 + github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.8.3 + github.com/alecthomas/chroma/v2 v2.25.0 + github.com/aws/aws-sdk-go-v2/credentials v1.19.16 + github.com/aws/aws-sdk-go-v2/service/codecommit v1.33.14 github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb - github.com/blevesearch/bleve/v2 v2.5.7 + github.com/blevesearch/bleve/v2 v2.6.0 github.com/bohde/codel v0.2.0 github.com/buildkite/terminal-to-html/v3 v3.16.8 - github.com/caddyserver/certmagic v0.25.2 - github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20251013092601-6327009efd21 + github.com/caddyserver/certmagic v0.25.3 + github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20260309112543-12416315a635 github.com/chi-middleware/proxy v1.1.1 - github.com/dimiro1/reply v0.0.0-20200315094148-d0136a4c9e21 - github.com/dlclark/regexp2 v1.12.0 + github.com/dlclark/regexp2/v2 v2.1.0 github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 github.com/dustin/go-humanize v1.0.1 github.com/editorconfig/editorconfig-core-go/v2 v2.6.4 @@ -45,54 +41,52 @@ require ( github.com/emirpasic/gods v1.18.1 github.com/ethantkoenig/rupture v1.0.1 github.com/felixge/fgprof v0.9.5 - github.com/fsnotify/fsnotify v1.9.0 - github.com/getkin/kin-openapi v0.134.0 + github.com/fsnotify/fsnotify v1.10.1 + github.com/getkin/kin-openapi v0.138.0 github.com/gliderlabs/ssh v0.3.8 github.com/go-chi/chi/v5 v5.2.5 github.com/go-chi/cors v1.2.2 - github.com/go-co-op/gocron/v2 v2.21.0 + github.com/go-co-op/gocron/v2 v2.21.2 github.com/go-enry/go-enry/v2 v2.9.6 - github.com/go-git/go-billy/v5 v5.8.0 - github.com/go-git/go-git/v5 v5.18.0 + github.com/go-git/go-billy/v5 v5.9.0 + github.com/go-git/go-git/v5 v5.19.1 github.com/go-ldap/ldap/v3 v3.4.13 github.com/go-redsync/redsync/v4 v4.16.0 - github.com/go-sql-driver/mysql v1.9.3 - github.com/go-webauthn/webauthn v0.16.5 + github.com/go-sql-driver/mysql v1.10.0 + github.com/go-webauthn/webauthn v0.17.3 github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85 github.com/golang-jwt/jwt/v5 v5.3.1 - github.com/google/go-github/v84 v84.0.0 + github.com/google/go-github/v88 v88.0.0 github.com/google/licenseclassifier/v2 v2.0.0 - github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 + github.com/google/pprof v0.0.0-20260507013755-92041b743c96 github.com/google/uuid v1.6.0 github.com/gorilla/feeds v1.2.0 github.com/gorilla/sessions v1.4.0 github.com/hashicorp/go-version v1.9.0 github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/huandu/xstrings v1.5.0 - github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 - github.com/jhillyerd/enmime/v2 v2.3.0 + github.com/jhillyerd/enmime/v2 v2.4.0 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 - github.com/klauspost/compress v1.18.5 + github.com/klauspost/compress v1.18.6 github.com/klauspost/cpuid/v2 v2.3.0 github.com/lib/pq v1.12.3 github.com/markbates/goth v1.82.0 - github.com/mattn/go-isatty v0.0.21 - github.com/mattn/go-sqlite3 v1.14.42 + github.com/mattn/go-isatty v0.0.22 + github.com/mattn/go-sqlite3 v1.14.44 github.com/meilisearch/meilisearch-go v0.36.2 github.com/mholt/archives v0.1.5 github.com/microcosm-cc/bluemonday v1.0.27 - github.com/microsoft/go-mssqldb v1.9.6 - github.com/minio/minio-go/v7 v7.0.100 + github.com/microsoft/go-mssqldb v1.9.7 + github.com/minio/minio-go/v7 v7.1.0 github.com/msteinert/pam/v2 v2.1.0 - github.com/nektos/act v0.2.63 github.com/niklasfasching/go-org v1.9.1 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.1 github.com/pquerna/otp v1.5.0 github.com/prometheus/client_golang v1.23.2 github.com/quasoft/websspi v1.1.2 - github.com/redis/go-redis/v9 v9.18.0 + github.com/redis/go-redis/v9 v9.19.0 github.com/robfig/cron/v3 v3.0.1 github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 github.com/sassoftware/go-rpmutils v0.4.0 @@ -102,25 +96,24 @@ require ( github.com/tstranex/u2f v1.0.0 github.com/ulikunitz/xz v0.5.15 github.com/urfave/cli-docs/v3 v3.1.0 - github.com/urfave/cli/v3 v3.4.1 - github.com/wneessen/go-mail v0.7.2 - github.com/xeipuuv/gojsonschema v1.2.0 + github.com/urfave/cli/v3 v3.9.0 + github.com/wneessen/go-mail v0.7.3 github.com/yohcop/openid-go v1.0.1 github.com/yuin/goldmark v1.8.2 github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc - gitlab.com/gitlab-org/api/client-go v1.46.0 + gitlab.com/gitlab-org/api/client-go/v2 v2.30.0 go.yaml.in/yaml/v4 v4.0.0-rc.3 - golang.org/x/crypto v0.50.0 - golang.org/x/image v0.39.0 - golang.org/x/net v0.53.0 + golang.org/x/crypto v0.52.0 + golang.org/x/image v0.41.0 + golang.org/x/net v0.55.0 golang.org/x/oauth2 v0.36.0 golang.org/x/sync v0.20.0 - golang.org/x/sys v0.43.0 - golang.org/x/text v0.36.0 - google.golang.org/grpc v1.80.0 + golang.org/x/sys v0.45.0 + golang.org/x/text v0.37.0 + google.golang.org/grpc v1.81.1 google.golang.org/protobuf v1.36.11 - gopkg.in/ini.v1 v1.67.1 - gopkg.in/yaml.v3 v3.0.1 + gopkg.in/ini.v1 v1.67.2 + modernc.org/sqlite v1.50.1 mvdan.cc/xurls/v2 v2.6.0 strk.kbt.io/projects/go/libravatar v0.0.0-20260301104140-add494e31dab xorm.io/builder v0.3.13 @@ -139,20 +132,20 @@ require ( github.com/andybalholm/brotli v1.2.1 // indirect github.com/andybalholm/cascadia v1.3.3 // indirect github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect - github.com/aws/aws-sdk-go-v2 v1.41.6 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.22 // indirect - github.com/aws/smithy-go v1.25.0 // indirect + github.com/aws/aws-sdk-go-v2 v1.41.7 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23 // indirect + github.com/aws/smithy-go v1.25.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.24.4 // indirect - github.com/blevesearch/bleve_index_api v1.3.7 // indirect + github.com/blevesearch/bleve_index_api v1.3.11 // indirect github.com/blevesearch/geo v0.2.5 // indirect - github.com/blevesearch/go-faiss v1.0.30 // indirect + github.com/blevesearch/go-faiss v1.1.0 // indirect github.com/blevesearch/go-porterstemmer v1.0.3 // indirect github.com/blevesearch/gtreap v0.1.1 // indirect github.com/blevesearch/mmap-go v1.2.0 // indirect - github.com/blevesearch/scorch_segment_api/v2 v2.4.5 // indirect + github.com/blevesearch/scorch_segment_api/v2 v2.4.7 // indirect github.com/blevesearch/segment v0.9.1 // indirect github.com/blevesearch/snowballstem v0.9.0 // indirect github.com/blevesearch/upsidedown_store_api v1.0.2 // indirect @@ -162,7 +155,8 @@ require ( github.com/blevesearch/zapx/v13 v13.4.3 // indirect github.com/blevesearch/zapx/v14 v14.4.3 // indirect github.com/blevesearch/zapx/v15 v15.4.3 // indirect - github.com/blevesearch/zapx/v16 v16.3.2 // indirect + github.com/blevesearch/zapx/v16 v16.3.4 // indirect + github.com/blevesearch/zapx/v17 v17.1.2 // indirect github.com/bmatcuk/doublestar/v4 v4.10.0 // indirect github.com/bodgit/plumbing v1.3.0 // indirect github.com/bodgit/sevenzip v1.6.1 // indirect @@ -182,10 +176,10 @@ require ( github.com/cyphar/filepath-securejoin v0.6.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/davidmz/go-pageant v1.0.2 // indirect - github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect + github.com/dlclark/regexp2 v1.12.0 // indirect github.com/emersion/go-sasl v0.0.0-20241020182733-b788ff22d5a6 // indirect github.com/fatih/color v1.19.0 // indirect - github.com/fxamacker/cbor/v2 v2.9.1 // indirect + github.com/fxamacker/cbor/v2 v2.9.2 // indirect github.com/git-lfs/pktline v0.0.0-20230103162542-ca444d533ef1 // indirect github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 // indirect github.com/go-enry/go-oniguruma v1.2.1 // indirect @@ -195,7 +189,7 @@ require ( github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect github.com/go-viper/mapstructure/v2 v2.5.0 // indirect - github.com/go-webauthn/x v0.2.3 // indirect + github.com/go-webauthn/x v0.2.5 // indirect github.com/goccy/go-json v0.10.6 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect @@ -224,7 +218,7 @@ require ( github.com/mailru/easyjson v0.7.7 // indirect github.com/markbates/going v1.0.3 // indirect github.com/mattn/go-colorable v0.1.14 // indirect - github.com/mattn/go-runewidth v0.0.21 // indirect + github.com/mattn/go-runewidth v0.0.23 // indirect github.com/mattn/go-shellwords v1.0.12 // indirect github.com/mholt/acmez/v3 v3.1.6 // indirect github.com/miekg/dns v1.1.72 // indirect @@ -238,23 +232,25 @@ require ( github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 // indirect github.com/mschoch/smat v0.2.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/ncruces/go-strftime v1.0.0 // indirect github.com/nwaples/rardecode/v2 v2.2.2 // indirect - github.com/oasdiff/yaml v0.0.0-20260313112342-a3ea61cb4d4c // indirect - github.com/oasdiff/yaml3 v0.0.0-20260224194419-61cd415a242b // indirect + github.com/oasdiff/yaml v0.0.9 // indirect + github.com/oasdiff/yaml3 v0.0.12 // indirect github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect - github.com/olekukonko/errors v1.2.0 // indirect + github.com/olekukonko/errors v1.3.0 // indirect github.com/olekukonko/ll v0.1.8 // indirect github.com/olekukonko/tablewriter v1.1.4 // indirect github.com/onsi/ginkgo v1.16.5 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/pierrec/lz4/v4 v4.1.26 // indirect - github.com/pjbgf/sha1cd v0.5.0 // indirect + github.com/pjbgf/sha1cd v0.6.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 // indirect github.com/prometheus/procfs v0.20.1 // indirect + github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rhysd/actionlint v1.7.12 // indirect github.com/rs/xid v1.6.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect @@ -269,11 +265,9 @@ require ( github.com/woodsbury/decimal128 v1.3.0 // indirect github.com/x448/float16 v0.8.4 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect - github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect - github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect - github.com/zeebo/assert v1.3.0 // indirect github.com/zeebo/blake3 v0.2.4 // indirect + github.com/zeebo/xxh3 v1.1.0 // indirect go.etcd.io/bbolt v1.4.3 // indirect go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect @@ -282,12 +276,15 @@ require ( go.yaml.in/yaml/v2 v2.4.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect go4.org v0.0.0-20260112195520-a5071408f32f // indirect - golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b // indirect - golang.org/x/mod v0.34.0 // indirect + golang.org/x/mod v0.35.0 // indirect golang.org/x/time v0.15.0 // indirect - golang.org/x/tools v0.43.0 // indirect + golang.org/x/tools v0.44.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260401020348-3a24fdc17823 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + modernc.org/libc v1.72.3 // indirect + modernc.org/mathutil v1.7.1 // indirect + modernc.org/memory v1.11.0 // indirect ) ignore ( @@ -299,12 +296,6 @@ ignore ( // But not all latest versions of dependencies are compatible with other packages or our codebase, so we need to pin some dependencies to specific versions // Need to regularly maintain this list to try to update them to latest versions, especially the TODO ones -replace github.com/jaytaylor/html2text => github.com/Necoro/html2text v0.0.0-20250804200300-7bf1ce1c7347 // jaytaylor/html2text is unmaintained - -replace github.com/nektos/act => gitea.com/gitea/act v0.261.10 // gitea maintains its own package - -replace github.com/urfave/cli/v3 => github.com/urfave/cli/v3 v3.4.1 // v3.6.2 breaks -c flag parsing in help commands - replace go.yaml.in/yaml/v4 => go.yaml.in/yaml/v4 v4.0.0-rc.3 // rc.4 changes block scalar serialization, wait for stable release replace github.com/Azure/azure-sdk-for-go/sdk/azcore => github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.0 // v1.21.0+ uses API version unsupported by Azurite in CI diff --git a/go.sum b/go.sum index b8ff05bb0a5..521779a0278 100644 --- a/go.sum +++ b/go.sum @@ -1,21 +1,17 @@ cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= -code.gitea.io/actions-proto-go v0.4.1 h1:l0EYhjsgpUe/1VABo2eK7zcoNX2W44WOnb0MSLrKfls= -code.gitea.io/actions-proto-go v0.4.1/go.mod h1:mn7Wkqz6JbnTOHQpot3yDeHx+O5C9EGhMEE+htvHBas= -code.gitea.io/sdk/gitea v0.24.1 h1:hpaqcdGcBmfMpV7JSbBJVwE99qo+WqGreJYKrDKEyW8= -code.gitea.io/sdk/gitea v0.24.1/go.mod h1:5/77BL3sHneCMEiZaMT9lfTvnnibsYxyO48mceCF3qA= code.pfad.fr/check v1.1.0 h1:GWvjdzhSEgHvEHe2uJujDcpmZoySKuHQNrZMfzfO0bE= code.pfad.fr/check v1.1.0/go.mod h1:NiUH13DtYsb7xp5wll0U4SXx7KhXQVCtRgdC96IPfoM= codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570 h1:TXbikPqa7YRtfU9vS6QJBg77pUvbEb6StRdZO8t1bEY= codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570/go.mod h1:IIAjsijsd8q1isWX8MACefDEgTQslQ4stk2AeeTt3kM= -connectrpc.com/connect v1.19.1 h1:R5M57z05+90EfEvCY1b7hBxDVOUl45PrtXtAV2fOC14= -connectrpc.com/connect v1.19.1/go.mod h1:tN20fjdGlewnSFeZxLKb0xwIZ6ozc3OQs2hTXy4du9w= +connectrpc.com/connect v1.20.0 h1:6TNDAB+WeNd2uolWNlYczB5E0KNNaVMNUEx8JEUsPmQ= +connectrpc.com/connect v1.20.0/go.mod h1:A2ygJrukXwWy32vkCAAHNVguZrqZ+jeZ9rGRnGR4dN4= dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= dario.cat/mergo v1.0.2/go.mod h1:E/hbnu0NxMFBjpMIE34DRGLWqDy0g5FuKDhCb31ngxA= filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo= filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc= -gitea.com/gitea/act v0.261.10 h1:ndwbtuMXXz1dpYF2iwY1/PkgKNETo4jmPXfinTZt8cs= -gitea.com/gitea/act v0.261.10/go.mod h1:oIkqQHvU0lfuIWwcpqa4FmU+t3prA89tgkuHUTsrI2c= +gitea.com/gitea/runner v1.0.5 h1:9Idm8XXxXp4aHoLp0Ba0AEwv87YUblp9gk4qbih+DlE= +gitea.com/gitea/runner v1.0.5/go.mod h1:ff8SKVat/6FywBGpN4dKi2x3AlHZUfLOA/vVWHf7+Cw= gitea.com/go-chi/binding v0.0.0-20260414111559-654cea7ac60a h1:JHoBrfuTSF9Ke9aNfSYj1XRPBHjKPgCApVprnt2Am0M= gitea.com/go-chi/binding v0.0.0-20260414111559-654cea7ac60a/go.mod h1:FOsLJIMdpiHzBp3Vby6Wfkdw2ppGscrjgU1IC7E4/zQ= gitea.com/go-chi/cache v0.2.1 h1:bfAPkvXlbcZxPCpcmDVCWoHgiBSBmZN/QosnZvEC0+g= @@ -30,6 +26,10 @@ gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4 h1:IFT+hup2xejHq gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4/go.mod h1:HBqmLbz56JWpfEGG0prskAV97ATNRoj5LDmPicD22hU= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= +gitea.dev/actions-proto-go v0.5.0 h1:Fc3DI4Fm3B3JBRXFUjegql+usoNAjjAw1cxMansfA2I= +gitea.dev/actions-proto-go v0.5.0/go.mod h1:p4RX+D9oqiEEzzkPMXscw2CmaGuYFPWFc6xIOmDNDqs= +gitea.dev/sdk v1.0.1 h1:CWXQUQvp2I6YKOWkhYo1Flx2sRNfMK1X9Op4oR2awXs= +gitea.dev/sdk v1.0.1/go.mod h1:jCf5Uzz0Jkb61jxNgMxLOCWwle1J1B2nKdcRtxuK9rY= github.com/42wim/httpsig v1.2.4 h1:mI5bH0nm4xn7K18fo1K3okNDRq8CCJ0KbBYWyA6r8lU= github.com/42wim/httpsig v1.2.4/go.mod h1:yKsYfSyTBEohkPik224QPFylmzEBtda/kjyIAJjh3ps= github.com/42wim/sshsig v0.0.0-20260317195500-b9f38cf0d432 h1:3Fcz1QzlS7Jv4FT2KI3cHNSZL+KPN3dXxurn9f3YL/Y= @@ -48,8 +48,8 @@ github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.1.1 h1:bFWuo github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.1.1/go.mod h1:Vih/3yc6yac2JzU4hzpaDupBJP0Flaia9rXXrU8xyww= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.2 h1:FwladfywkNirM+FZYLBR2kBz5C8Tg0fw5w5Y7meRXWI= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.2/go.mod h1:vv5Ad0RrIoT1lJFdWBZwt4mB1+j+V8DUroixmKDTCdk= -github.com/Azure/go-ntlmssp v0.1.0 h1:DjFo6YtWzNqNvQdrwEyr/e4nhU3vRiwenz5QX7sFz+A= -github.com/Azure/go-ntlmssp v0.1.0/go.mod h1:NYqdhxd/8aAct/s4qSYZEerdPuH1liG2/X9DiVTbhpk= +github.com/Azure/go-ntlmssp v0.1.1 h1:l+FM/EEMb0U9QZE7mKNEDw5Mu3mFiaa2GKOoTSsNDPw= +github.com/Azure/go-ntlmssp v0.1.1/go.mod h1:NYqdhxd/8aAct/s4qSYZEerdPuH1liG2/X9DiVTbhpk= github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -71,13 +71,13 @@ github.com/RoaringBitmap/roaring/v2 v2.16.0 h1:Kys1UNf49d5W8Tq3bpuAhIr/Z8/yPB+59 github.com/RoaringBitmap/roaring/v2 v2.16.0/go.mod h1:eq4wdNXxtJIS/oikeCzdX1rBzek7ANzbth041hrU8Q4= github.com/STARRY-S/zip v0.2.3 h1:luE4dMvRPDOWQdeDdUxUoZkzUIpTccdKdhHHsQJ1fm4= github.com/STARRY-S/zip v0.2.3/go.mod h1:lqJ9JdeRipyOQJrYSOtpNAiaesFO6zVDsE8GIGFaoSk= -github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.8.0 h1:tgjwQrDH5m6jIYB7kac5IQZmfUzQNseac/e3H4VoCNE= -github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.8.0/go.mod h1:1HmmMEVsr+0R1QWahSeMJkjSkq6CYAZu1aIbYSpfJ4o= +github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.8.3 h1:ikrUPushSxbpr9mmDhSgz1KyUTChjwkDrxY/jzv2OTQ= +github.com/SaveTheRbtz/zstd-seekable-format-go/pkg v0.8.3/go.mod h1:bnXbvnI9Mfqdj4L3Y9aCsB1A/ztuYLNRzgVKsJFgR/U= github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0= github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= github.com/alecthomas/chroma/v2 v2.2.0/go.mod h1:vf4zrexSH54oEjJ7EdB65tGNHmH3pGZmVkgTP5RHvAs= -github.com/alecthomas/chroma/v2 v2.23.1 h1:nv2AVZdTyClGbVQkIzlDm/rnhk1E9bU9nXwmZ/Vk/iY= -github.com/alecthomas/chroma/v2 v2.23.1/go.mod h1:NqVhfBR0lte5Ouh3DcthuUCTUpDC9cxBOfyMbMQPs3o= +github.com/alecthomas/chroma/v2 v2.25.0 h1:DWkVlxrNpxPf+Qcfe04LBqUArxUiybK8ZQ9T7OFu68E= +github.com/alecthomas/chroma/v2 v2.25.0/go.mod h1:+95AZrRWlpW9g6qXD7S7UdHviopsGP/kCIrtJcU3QoQ= github.com/alecthomas/repr v0.0.0-20220113201626-b1b626ac65ae/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8= github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs= github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= @@ -92,18 +92,18 @@ github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuW github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/aws/aws-sdk-go-v2 v1.41.6 h1:1AX0AthnBQzMx1vbmir3Y4WsnJgiydmnJjiLu+LvXOg= -github.com/aws/aws-sdk-go-v2 v1.41.6/go.mod h1:dy0UzBIfwSeot4grGvY1AqFWN5zgziMmWGzysDnHFcQ= -github.com/aws/aws-sdk-go-v2/credentials v1.19.15 h1:fyvgWTszojq8hEnMi8PPBTvZdTtEVmAVyo+NFLHBhH4= -github.com/aws/aws-sdk-go-v2/credentials v1.19.15/go.mod h1:gJiYyMOjNg8OEdRWOf3CrFQxM2a98qmrtjx1zuiQfB8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22 h1:GmLa5Kw1ESqtFpXsx5MmC84QWa/ZrLZvlJGa2y+4kcQ= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.22/go.mod h1:6sW9iWm9DK9YRpRGga/qzrzNLgKpT2cIxb7Vo2eNOp0= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.22 h1:dY4kWZiSaXIzxnKlj17nHnBcXXBfac6UlsAx2qL6XrU= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.22/go.mod h1:KIpEUx0JuRZLO7U6cbV204cWAEco2iC3l061IxlwLtI= -github.com/aws/aws-sdk-go-v2/service/codecommit v1.33.13 h1:IIW5QmNI9PrnDTBCPa75HcD0g+hoD/a+d388dbIAkEM= -github.com/aws/aws-sdk-go-v2/service/codecommit v1.33.13/go.mod h1:B1FUSufCQp3d8VUzob1EY+AdSo2OuEWNEY6GQff7EHA= -github.com/aws/smithy-go v1.25.0 h1:Sz/XJ64rwuiKtB6j98nDIPyYrV1nVNJ4YU74gttcl5U= -github.com/aws/smithy-go v1.25.0/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aws/aws-sdk-go-v2 v1.41.7 h1:DWpAJt66FmnnaRIOT/8ASTucrvuDPZASqhhLey6tLY8= +github.com/aws/aws-sdk-go-v2 v1.41.7/go.mod h1:4LAfZOPHNVNQEckOACQx60Y8pSRjIkNZQz1w92xpMJc= +github.com/aws/aws-sdk-go-v2/credentials v1.19.16 h1:r3RJBuU7X9ibt8RHbMjWE6y60QbKBiII6wSrXnapxSU= +github.com/aws/aws-sdk-go-v2/credentials v1.19.16/go.mod h1:6cx7zqDENJDbBIIWX6P8s0h6hqHC8Avbjh9Dseo27ug= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23 h1:GpT/TrnBYuE5gan2cZbTtvP+JlHsutdmlV2YfEyNde0= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.23/go.mod h1:xYWD6BS9ywC5bS3sz9Xh04whO/hzK2plt2Zkyrp4JuA= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23 h1:bpd8vxhlQi2r1hiueOw02f/duEPTMK59Q4QMAoTTtTo= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.23/go.mod h1:15DfR2nw+CRHIk0tqNyifu3G1YdAOy68RftkhMDDwYk= +github.com/aws/aws-sdk-go-v2/service/codecommit v1.33.14 h1:3N664oayz66ttIkc8B9/OLntMWhoGhKqPudRRfsZQ20= +github.com/aws/aws-sdk-go-v2/service/codecommit v1.33.14/go.mod h1:M+6j5lOmtDMjLlFMO8lfTs0gI3qBsSjM8L7F1cQF5Ng= +github.com/aws/smithy-go v1.25.1 h1:J8ERsGSU7d+aCmdQur5Txg6bVoYelvQJgtZehD12GkI= +github.com/aws/smithy-go v1.25.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -115,15 +115,15 @@ github.com/bits-and-blooms/bitset v1.24.4/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6 github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb h1:m935MPodAbYS46DG4pJSv7WO+VECIWUQ7OJYSoTrMh4= github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI= github.com/blevesearch/bleve/v2 v2.0.5/go.mod h1:ZjWibgnbRX33c+vBRgla9QhPb4QOjD6fdVJ+R1Bk8LM= -github.com/blevesearch/bleve/v2 v2.5.7 h1:2d9YrL5zrX5EBBW++GOaEKjE+NPWeZGaX77IM26m1Z8= -github.com/blevesearch/bleve/v2 v2.5.7/go.mod h1:yj0NlS7ocGC4VOSAedqDDMktdh2935v2CSWOCDMHdSA= +github.com/blevesearch/bleve/v2 v2.6.0 h1:Cyd3dd4q5tCbOV8MnKUVRUDYMHOir9xn12NZzXVSEd4= +github.com/blevesearch/bleve/v2 v2.6.0/go.mod h1:gLmI8lWgHgrIYf7UpUX7JISI1CaqC6VScu46mHThuAY= github.com/blevesearch/bleve_index_api v1.0.0/go.mod h1:fiwKS0xLEm+gBRgv5mumf0dhgFr2mDgZah1pqv1c1M4= -github.com/blevesearch/bleve_index_api v1.3.7 h1:x3C4pl6o3MlSJ3rNKLQpZMRF0uR9+BDvmF3t8LYCOpk= -github.com/blevesearch/bleve_index_api v1.3.7/go.mod h1:xvd48t5XMeeioWQ5/jZvgLrV98flT2rdvEJ3l/ki4Ko= +github.com/blevesearch/bleve_index_api v1.3.11 h1:x29vbV8OjWfLcrDVd7Lr1q+BkLNS0JWNEig0MCVnKH4= +github.com/blevesearch/bleve_index_api v1.3.11/go.mod h1:xvd48t5XMeeioWQ5/jZvgLrV98flT2rdvEJ3l/ki4Ko= github.com/blevesearch/geo v0.2.5 h1:yJg9FX1oRwLnjXSXF+ECHfXFTF4diF02Ca/qUGVjJhE= github.com/blevesearch/geo v0.2.5/go.mod h1:Jhq7WE2K6mJTx1xS44M2pUO6Io+wjCSHh1+co3YOgH4= -github.com/blevesearch/go-faiss v1.0.30 h1:pWX3/Si4Z7GlwsD2eRXoF3SfVaDkg8plBlPdUKuhGts= -github.com/blevesearch/go-faiss v1.0.30/go.mod h1:OMGQwOaRRYxrmeNdMrXJPvVx8gBnvE5RYrr0BahNnkk= +github.com/blevesearch/go-faiss v1.1.0 h1:xM7Jc0ZUCv5lssG9Ohj3Jv0SdTpxcUABU1dDt9XVsc4= +github.com/blevesearch/go-faiss v1.1.0/go.mod h1:OMGQwOaRRYxrmeNdMrXJPvVx8gBnvE5RYrr0BahNnkk= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= github.com/blevesearch/gtreap v0.1.1 h1:2JWigFrzDMR+42WGIN/V2p0cUvn4UP3C4Q5nmaZGW8Y= @@ -132,8 +132,8 @@ github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+ github.com/blevesearch/mmap-go v1.2.0 h1:l33nNKPFcBjJUMwem6sAYJPUzhUCABoK9FxZDGiFNBI= github.com/blevesearch/mmap-go v1.2.0/go.mod h1:Vd6+20GBhEdwJnU1Xohgt88XCD/CTWcqbCNxkZpyBo0= github.com/blevesearch/scorch_segment_api/v2 v2.0.1/go.mod h1:lq7yK2jQy1yQjtjTfU931aVqz7pYxEudHaDwOt1tXfU= -github.com/blevesearch/scorch_segment_api/v2 v2.4.5 h1:Q7Bzpyk86xS22TgTd4VQfSvzZAybDEJ90hNOGqyNqlI= -github.com/blevesearch/scorch_segment_api/v2 v2.4.5/go.mod h1:xWYn3EwRM7zBFAPt/J136OugUNzftpYLvPBBx31IpCw= +github.com/blevesearch/scorch_segment_api/v2 v2.4.7 h1:GlMzW08hcsM3DnLUxhyF/1PcDal1qtvvIuytuph5djw= +github.com/blevesearch/scorch_segment_api/v2 v2.4.7/go.mod h1://IJ7tG3QCf0cWW/aVSXqy77tc1AvLu3fcJLYEvOAFs= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= github.com/blevesearch/segment v0.9.1 h1:+dThDy+Lvgj5JMxhmOVlgFfkUtZV2kw49xax4+jTfSU= github.com/blevesearch/segment v0.9.1/go.mod h1:zN21iLm7+GnBHWTao9I+Au/7MBiL8pPFtJBJTsk6kQw= @@ -161,8 +161,10 @@ github.com/blevesearch/zapx/v14 v14.4.3/go.mod h1:rz0XNb/OZSMjNorufDGSpFpjoFKhXm github.com/blevesearch/zapx/v15 v15.2.0/go.mod h1:MmQceLpWfME4n1WrBFIwplhWmaQbQqLQARpaKUEOs/A= github.com/blevesearch/zapx/v15 v15.4.3 h1:iJiMJOHrz216jyO6lS0m9RTCEkprUnzvqAI2lc/0/CU= github.com/blevesearch/zapx/v15 v15.4.3/go.mod h1:1pssev/59FsuWcgSnTa0OeEpOzmhtmr/0/11H0Z8+Nw= -github.com/blevesearch/zapx/v16 v16.3.2 h1:R8alnAeYxzKO4JjQY4FBqJduJwcPE3YjcgevWgI+XT0= -github.com/blevesearch/zapx/v16 v16.3.2/go.mod h1:zCFjv7McXWm1C8rROL+3mUoD5WYe2RKsZP3ufqcYpLY= +github.com/blevesearch/zapx/v16 v16.3.4 h1:hDAqA8qusZTNbPEL7//w5P65UZ2de6yhSeUaTbp0Po0= +github.com/blevesearch/zapx/v16 v16.3.4/go.mod h1:zqkPPqs9GS9FzVWzCO3Wf1X044yWAV17+4zb+FTiEHg= +github.com/blevesearch/zapx/v17 v17.1.2 h1:avbOk2igaASNoiy0BE/jPgcxAnRI2PGeydeP4hg7Ikk= +github.com/blevesearch/zapx/v17 v17.1.2/go.mod h1:WQObxKrqUX7cd0G1GMvDfc/bmZzQvoy7APOPimx7DiI= github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs= github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b/go.mod h1:ac9efd0D1fsDb3EJvhqgXRbFx7bs2wqZ10HQPeU8U/Q= @@ -185,16 +187,16 @@ github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/buildkite/terminal-to-html/v3 v3.16.8 h1:QN/daUob6cmK8GcdKnwn9+YTlPr1vNj+oeAIiJK6fPc= github.com/buildkite/terminal-to-html/v3 v3.16.8/go.mod h1:+k1KVKROZocrTLsEQ9PEf9A+8+X8uaVV5iO1ZIOwKYM= -github.com/caddyserver/certmagic v0.25.2 h1:D7xcS7ggX/WEY54x0czj7ioTkmDWKIgxtIi2OcQclUc= -github.com/caddyserver/certmagic v0.25.2/go.mod h1:llW/CvsNmza8S6hmsuggsZeiX+uS27dkqY27wDIuBWg= +github.com/caddyserver/certmagic v0.25.3 h1:mGf5ba8F7xA4c5jfDZZbK2buY1VEkbnwpMDixaju94A= +github.com/caddyserver/certmagic v0.25.3/go.mod h1:YVs43D5+H/Dckt4bTga1KSO/xYfFBfVZainGDywYPAA= github.com/caddyserver/zerossl v0.1.5 h1:dkvOjBAEEtY6LIGAHei7sw2UgqSD6TrWweXpV7lvEvE= github.com/caddyserver/zerossl v0.1.5/go.mod h1:CxA0acn7oEGO6//4rtrRjYgEoa4MFw/XofZnrYwGqG4= github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a h1:MISbI8sU/PSK/ztvmWKFcI7UGb5/HQT7B+i3a2myKgI= github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a/go.mod h1:2GxOXOlEPAMFPfp014mK1SWq8G8BN8o7/dfYqJrVGn8= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20251013092601-6327009efd21 h1:2d64+4Jek9vjYwhY93AjbleiVH+AeWvPwPmDi1mfKFQ= -github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20251013092601-6327009efd21/go.mod h1:fNlYtCHWTRC8MofQERZkVUNUWaOvZeTBqHn/amSbKZI= +github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20260309112543-12416315a635 h1:RwCfD5XyO8jAermEy6pauh5Q5o6mCvbeNcCPOZlIA5o= +github.com/charmbracelet/git-lfs-transfer v0.1.1-0.20260309112543-12416315a635/go.mod h1:R+SetERD4+IL7QH0WHp9MLifvITvh9gL3g8vX1j2Fcs= github.com/chi-middleware/proxy v1.1.1 h1:4HaXUp8o2+bhHr1OhVy+VjN0+L7/07JDcn6v7YrTjrQ= github.com/chi-middleware/proxy v1.1.1/go.mod h1:jQwMEJct2tz9VmtCELxvnXoMfa+SOdikvbVJVHv/M+0= github.com/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs= @@ -234,13 +236,12 @@ github.com/davidmz/go-pageant v1.0.2 h1:bPblRCh5jGU+Uptpz6LgMZGD5hJoOt7otgT454Wv github.com/davidmz/go-pageant v1.0.2/go.mod h1:P2EDDnMqIwG5Rrp05dTRITj9z2zpGcD9efWSkTNKLIE= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/dimiro1/reply v0.0.0-20200315094148-d0136a4c9e21 h1:PdsjTl0Cg+ZJgOx/CFV5NNgO1ThTreqdgKYiDCMHJwA= -github.com/dimiro1/reply v0.0.0-20200315094148-d0136a4c9e21/go.mod h1:xJvkyD6Y2rZapGvPJLYo9dyx1s5dxBEDPa8T3YTuOk0= -github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dlclark/regexp2 v1.12.0 h1:0j4c5qQmnC6XOWNjP3PIXURXN2gWx76rd3KvgdPkCz8= github.com/dlclark/regexp2 v1.12.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dlclark/regexp2/v2 v2.1.0 h1:jHXRmHRZGbuQzDZjMlCAXOvQb75iv3HyLDzXGj5H1AY= +github.com/dlclark/regexp2/v2 v2.1.0/go.mod h1:Bz5TMy5d8fPK0ximH0Yi9KvsRHNnvXqUx9XG6a4wB+I= github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 h1:2tV76y6Q9BB+NEBasnqvs7e49aEBFI8ejC89PSnWH+4= github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s= github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= @@ -269,12 +270,12 @@ github.com/felixge/fgprof v0.9.5 h1:8+vR6yu2vvSKn08urWyEuxx75NWPEvybbkBirEpsbVY= github.com/felixge/fgprof v0.9.5/go.mod h1:yKl+ERSa++RYOs32d8K6WEXCB4uXdLls4ZaZPpayhMM= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= -github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= -github.com/fxamacker/cbor/v2 v2.9.1 h1:2rWm8B193Ll4VdjsJY28jxs70IdDsHRWgQYAI80+rMQ= -github.com/fxamacker/cbor/v2 v2.9.1/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= -github.com/getkin/kin-openapi v0.134.0 h1:/L5+1+kfe6dXh8Ot/wqiTgUkjOIEJiC0bbYVziHB8rU= -github.com/getkin/kin-openapi v0.134.0/go.mod h1:wK6ZLG/VgoETO9pcLJ/VmAtIcl/DNlMayNTb716EUxE= +github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho= +github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo= +github.com/fxamacker/cbor/v2 v2.9.2 h1:X4Ksno9+x3cz0TZv69ec1hxP/+tymuR8PXQJyDwfh78= +github.com/fxamacker/cbor/v2 v2.9.2/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/getkin/kin-openapi v0.138.0 h1:ebfE0JAmF6AqHrNBy1KO3Fs68K9tPs48HalvLPo7Rv4= +github.com/getkin/kin-openapi v0.138.0/go.mod h1:vUYWaKyMqj7PfTybelXtLuLN9tReS12vxnzMRK+z2GY= github.com/git-lfs/pktline v0.0.0-20230103162542-ca444d533ef1 h1:mtDjlmloH7ytdblogrMz1/8Hqua1y8B4ID+bh3rvod0= github.com/git-lfs/pktline v0.0.0-20230103162542-ca444d533ef1/go.mod h1:fenKRzpXDjNpsIBhuhUzvjCKlDjKam0boRAenTE0Q6A= github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c= @@ -288,8 +289,8 @@ github.com/go-chi/chi/v5 v5.2.5 h1:Eg4myHZBjyvJmAFjFvWgrqDTXFyOzjj7YIm3L3mu6Ug= github.com/go-chi/chi/v5 v5.2.5/go.mod h1:X7Gx4mteadT3eDOMTsXzmI4/rwUpOwBHLpAfupzFJP0= github.com/go-chi/cors v1.2.2 h1:Jmey33TE+b+rB7fT8MUy1u0I4L+NARQlK6LhzKPSyQE= github.com/go-chi/cors v1.2.2/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= -github.com/go-co-op/gocron/v2 v2.21.0 h1:e1nt9AEFglarRH9/9y9q0V5sblwxlknpHPjttEajrwQ= -github.com/go-co-op/gocron/v2 v2.21.0/go.mod h1:5lEiCKk1oVJV39Zg7/YG10OnaVrDAV5GGR6O0663k6U= +github.com/go-co-op/gocron/v2 v2.21.2 h1:bD8/YwkojYHgXFr3iEulL148KBdTbKVxUZzFKpXcdbY= +github.com/go-co-op/gocron/v2 v2.21.2/go.mod h1:5lEiCKk1oVJV39Zg7/YG10OnaVrDAV5GGR6O0663k6U= github.com/go-enry/go-enry/v2 v2.9.6 h1:np63eOtMV56zfYDHnFVgpEVOk8fr2kmylcMnAZUDbSs= github.com/go-enry/go-enry/v2 v2.9.6/go.mod h1:9yrj4ES1YrbNb1Wb7/PWYr2bpaCXUGRt0uafN0ISyG8= github.com/go-enry/go-oniguruma v1.2.1 h1:k8aAMuJfMrqm/56SG2lV9Cfti6tC4x8673aHCcBk+eo= @@ -298,16 +299,16 @@ github.com/go-fed/httpsig v1.1.1-0.20201223112313-55836744818e h1:oRq/fiirun5Hql github.com/go-fed/httpsig v1.1.1-0.20201223112313-55836744818e/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.8.0 h1:I8hjc3LbBlXTtVuFNJuwYuMiHvQJDq1AT6u4DwDzZG0= -github.com/go-git/go-billy/v5 v5.8.0/go.mod h1:RpvI/rw4Vr5QA+Z60c6d6LXH0rYJo0uD5SqfmrrheCY= +github.com/go-git/go-billy/v5 v5.9.0 h1:jItGXszUDRtR/AlferWPTMN4j38BQ88XnXKbilmmBPA= +github.com/go-git/go-billy/v5 v5.9.0/go.mod h1:jCnQMLj9eUgGU7+ludSTYoZL/GGmii14RxKFj7ROgHw= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= -github.com/go-git/go-git/v5 v5.18.0 h1:O831KI+0PR51hM2kep6T8k+w0/LIAD490gvqMCvL5hM= -github.com/go-git/go-git/v5 v5.18.0/go.mod h1:pW/VmeqkanRFqR6AljLcs7EA7FbZaN5MQqO7oZADXpo= +github.com/go-git/go-git/v5 v5.19.1 h1:nX27AnaU43/K5bKktKwgBmR9lawoYVe1Ckg0rgzzN00= +github.com/go-git/go-git/v5 v5.19.1/go.mod h1:Pb1v0c7/g8aGQJwx9Us09W85yGoyvSwuhEGMH7zjDKQ= github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-jose/go-jose/v4 v4.1.3 h1:CVLmWDhDVRa6Mi/IgCgaopNosCaHz7zrMeF9MlZRkrs= -github.com/go-jose/go-jose/v4 v4.1.3/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA= +github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-ldap/ldap/v3 v3.4.13 h1:+x1nG9h+MZN7h/lUi5Q3UZ0fJ1GyDQYbPvbuH38baDQ= github.com/go-ldap/ldap/v3 v3.4.13/go.mod h1:LxsGZV6vbaK0sIvYfsv47rfh4ca0JXokCoKjZxsszv0= github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= @@ -322,17 +323,17 @@ github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-redsync/redsync/v4 v4.16.0 h1:bNcOzeHH9d3s6pghU9NJFMPrQa41f5Nx3L4YKr3BdEU= github.com/go-redsync/redsync/v4 v4.16.0/go.mod h1:V4gagqgyASWBZuwx4xGzu72aZNb/6Mo05byUa3mVmKQ= -github.com/go-sql-driver/mysql v1.9.3 h1:U/N249h2WzJ3Ukj8SowVFjdtZKfu9vlLZxjPXV1aweo= -github.com/go-sql-driver/mysql v1.9.3/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= +github.com/go-sql-driver/mysql v1.10.0 h1:Q+1LV8DkHJvSYAdR83XzuhDaTykuDx0l6fkXxoWCWfw= +github.com/go-sql-driver/mysql v1.10.0/go.mod h1:M+cqaI7+xxXGG9swrdeUIoPG3Y3KCkF0pZej+SK+nWk= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/go-webauthn/webauthn v0.16.5 h1:x+vADHlaiIjta23kGhtwyCIlB5mayKx6SBlpwQ5NF9A= -github.com/go-webauthn/webauthn v0.16.5/go.mod h1:mQC6L0lZ5Kiu35G70zeB2WnrW4+vbHjR8Koq4HdVaMg= -github.com/go-webauthn/x v0.2.3 h1:8oArS+Rc1SWFLXhE17KZNx258Z4kUSyaDgsSncCO5RA= -github.com/go-webauthn/x v0.2.3/go.mod h1:tM04GF3V6VYq79AZMl7vbj4q6pz9r7L2criWRzbWhPk= +github.com/go-webauthn/webauthn v0.17.3 h1:XHZ0TXV7k8vChcE4TFgPitOPJ5cb7h1dpAeFDS0cjCo= +github.com/go-webauthn/webauthn v0.17.3/go.mod h1:PlkMgmuL9McCT7dvgBj/Sz/fgs3V6ZID6/KnFkEcPvQ= +github.com/go-webauthn/x v0.2.5 h1:wEVTfU04XFyPTXGQbKOQwMKhcDWfDAkdsDDBsDaG9yY= +github.com/go-webauthn/x v0.2.5/go.mod h1:Qna/yJz9rV6lRzwl5BfYbmTJpVGxcBIds3gJtw2tlGg= github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= @@ -379,8 +380,8 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/go-github/v84 v84.0.0 h1:I/0Xn5IuChMe8TdmI2bbim5nyhaRFJ7DEdzmD2w+yVA= -github.com/google/go-github/v84 v84.0.0/go.mod h1:WwYL1z1ajRdlaPszjVu/47x1L0PXukJBn73xsiYrRRQ= +github.com/google/go-github/v88 v88.0.0 h1:dZA9IKkPK1eXZj4ypngnpRj5FwdpTv4whix2PrQMP7M= +github.com/google/go-github/v88 v88.0.0/go.mod h1:rufTDgn2N45wjhukLTyxmvc9nilSp3mr3Rgtt6b1MPw= github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0= github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU= github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo= @@ -393,8 +394,8 @@ github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/licenseclassifier/v2 v2.0.0 h1:1Y57HHILNf4m0ABuMVb6xk4vAJYEUO0gDxNpog0pyeA= github.com/google/licenseclassifier/v2 v2.0.0/go.mod h1:cOjbdH0kyC9R22sdQbYsFkto4NGCAc+ZSwbeThazEtM= github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= -github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 h1:EwtI+Al+DeppwYX2oXJCETMO23COyaKGP6fHVpkpWpg= -github.com/google/pprof v0.0.0-20260402051712-545e8a4df936/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= +github.com/google/pprof v0.0.0-20260507013755-92041b743c96 h1:YDDnaZ9afWajDboPMt9Vikqca/yWAX7KAxVzb4lJU1M= +github.com/google/pprof v0.0.0-20260507013755-92041b743c96/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -459,8 +460,8 @@ github.com/jcmturner/gokrb5/v8 v8.4.4 h1:x1Sv4HaTpepFkXbt2IkL29DXRf8sOfZXo8eRKh6 github.com/jcmturner/gokrb5/v8 v8.4.4/go.mod h1:1btQEpgT6k+unzCwX1KdWMEwPPkkgBtP+F6aCACiMrs= github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY= github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc= -github.com/jhillyerd/enmime/v2 v2.3.0 h1:Y/pzQanyU8nkSgB2npXX8Dha5OItJE/QwbDJM4sf/kU= -github.com/jhillyerd/enmime/v2 v2.3.0/go.mod h1:mGKXAP45l6pF6HZiaLhgSYsgteJskaSIYmEZXpw6ZpI= +github.com/jhillyerd/enmime/v2 v2.4.0 h1:6bPyyg2OPXEK1fKsLT89DntZf05LqaL2cIx+cvkEXTo= +github.com/jhillyerd/enmime/v2 v2.4.0/go.mod h1:TLpvqImPiumRecsJK5TYseRw2bPg3g0EtWc+SfU7cMs= github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I= github.com/jonboulle/clockwork v0.5.0/go.mod h1:3mZlmanh0g2NDKO5TWZVJAfofYk64M7XN3SzBPjZF60= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -475,8 +476,8 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:C github.com/kevinburke/ssh_config v1.6.0 h1:J1FBfmuVosPHf5GRdltRLhPJtJpTlMdKTBjRgTaQBFY= github.com/kevinburke/ssh_config v1.6.0/go.mod h1:q2RIzfka+BXARoNexmF9gkxEX7DmvbW9P4hIVx2Kg4M= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= -github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= +github.com/klauspost/compress v1.18.6 h1:2jupLlAwFm95+YDR+NwD2MEfFO9d4z4Prjl1XXDjuao= +github.com/klauspost/compress v1.18.6/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= @@ -513,14 +514,14 @@ github.com/markbates/goth v1.82.0 h1:8j/c34AjBSTNzO7zTsOyP5IYCQCMBTRBHAbBt/PI0bQ github.com/markbates/goth v1.82.0/go.mod h1:/DRlcq0pyqkKToyZjsL2KgiA1zbF1HIjE7u2uC79rUk= github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= -github.com/mattn/go-isatty v0.0.21 h1:xYae+lCNBP7QuW4PUnNG61ffM4hVIfm+zUzDuSzYLGs= -github.com/mattn/go-isatty v0.0.21/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= -github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEjdM8w= -github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= +github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4= +github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4= +github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw= +github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk= github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= -github.com/mattn/go-sqlite3 v1.14.42 h1:MigqEP4ZmHw3aIdIT7T+9TLa90Z6smwcthx+Azv4Cgo= -github.com/mattn/go-sqlite3 v1.14.42/go.mod h1:pjEuOr8IwzLJP2MfGeTb0A35jauH+C2kbHKBr7yXKVQ= +github.com/mattn/go-sqlite3 v1.14.44 h1:3VSe+xafpbzsLbdr2AWlAZk9yRHiBhTBakioXaCKTF8= +github.com/mattn/go-sqlite3 v1.14.44/go.mod h1:pjEuOr8IwzLJP2MfGeTb0A35jauH+C2kbHKBr7yXKVQ= github.com/meilisearch/meilisearch-go v0.36.2 h1:MYaMPCpdLh2aYPt+zK+19mLoA4dfBY3S1L7T0FADCjU= github.com/meilisearch/meilisearch-go v0.36.2/go.mod h1:hWcR0MuWLSzHfbz9GGzIr3s9rnXLm1jqkmHkJPbUSvM= github.com/mholt/acmez/v3 v3.1.6 h1:eGVQNObP0pBN4sxqrXeg7MYqTOWyoiYpQqITVWlrevk= @@ -539,8 +540,8 @@ github.com/minio/crc64nvme v1.1.1 h1:8dwx/Pz49suywbO+auHCBpCtlW1OfpcLN7wYgVR6wAI github.com/minio/crc64nvme v1.1.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= -github.com/minio/minio-go/v7 v7.0.100 h1:ShkWi8Tyj9RtU57OQB2HIXKz4bFgtVib0bbT1sbtLI8= -github.com/minio/minio-go/v7 v7.0.100/go.mod h1:EtGNKtlX20iL2yaYnxEigaIvj0G0GwSDnifnG8ClIdw= +github.com/minio/minio-go/v7 v7.1.0 h1:QEt5IStDpxgGjEdtOgpiZ5QhmSl3ax7qy61vi2SwHO8= +github.com/minio/minio-go/v7 v7.1.0/go.mod h1:Dm7WS1AgLmBa0NcQD6SeJnJf+K/EUW3GR7Ks6olB3OA= github.com/minio/minlz v1.1.0 h1:rUOGu3EP4EqJC5k3qCsIwEnZiJULKqtRyDdqbhlvMmQ= github.com/minio/minlz v1.1.0/go.mod h1:qT0aEB35q79LLornSzeDH75LBf3aH1MV+jB5w9Wasec= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -561,8 +562,8 @@ github.com/msteinert/pam/v2 v2.1.0 h1:er5F9TKV5nGFuTt12ubtqPHEUdeBwReP7vd3wovidG github.com/msteinert/pam/v2 v2.1.0/go.mod h1:KT28NNIcDFf3PcBmNI2mIGO4zZJ+9RSs/At2PB3IDVc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= -github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= +github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w= +github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/niklasfasching/go-org v1.9.1 h1:/3s4uTPOF06pImGa2Yvlp24yKXZoTYM+nsIlMzfpg/0= github.com/niklasfasching/go-org v1.9.1/go.mod h1:ZAGFFkWvUQcpazmi/8nHqwvARpr1xpb+Es67oUGX/48= github.com/nwaples/rardecode/v2 v2.2.2 h1:/5oL8dzYivRM/tqX9VcTSWfbpwcbwKG1QtSJr3b3KcU= @@ -570,14 +571,14 @@ github.com/nwaples/rardecode/v2 v2.2.2/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsR github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/oasdiff/yaml v0.0.0-20260313112342-a3ea61cb4d4c h1:7ACFcSaQsrWtrH4WHHfUqE1C+f8r2uv8KGaW0jTNjus= -github.com/oasdiff/yaml v0.0.0-20260313112342-a3ea61cb4d4c/go.mod h1:JKox4Gszkxt57kj27u7rvi7IFoIULvCZHUsBTUmQM/s= -github.com/oasdiff/yaml3 v0.0.0-20260224194419-61cd415a242b h1:vivRhVUAa9t1q0Db4ZmezBP8pWQWnXHFokZj0AOea2g= -github.com/oasdiff/yaml3 v0.0.0-20260224194419-61cd415a242b/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o= +github.com/oasdiff/yaml v0.0.9 h1:zQOvd2UKoozsSsAknnWoDJlSK4lC0mpmjfDsfqNwX48= +github.com/oasdiff/yaml v0.0.9/go.mod h1:8lvhgJG4xiKPj3HN5lDow4jZHPlx1i7dIwzkdAo6oAM= +github.com/oasdiff/yaml3 v0.0.12 h1:75urAtPeDg2/iDEWwzNrLOWxI9N/dCh81nTTJtokt2M= +github.com/oasdiff/yaml3 v0.0.12/go.mod h1:y5+oSEHCPT/DGrS++Wc/479ERge0zTFxaF8PbGKcg2o= github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 h1:zrbMGy9YXpIeTnGj4EljqMiZsIcE09mmF8XsD5AYOJc= github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6/go.mod h1:rEKTHC9roVVicUIfZK7DYrdIoM0EOr8mK1Hj5s3JjH0= -github.com/olekukonko/errors v1.2.0 h1:10Zcn4GeV59t/EGqJc8fUjtFT/FuUh5bTMzZ1XwmCRo= -github.com/olekukonko/errors v1.2.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= +github.com/olekukonko/errors v1.3.0 h1:teJvgLGUEqMzBUms+Dj3/3szNqCG/Jdw9iDbum8fR6U= +github.com/olekukonko/errors v1.3.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y= github.com/olekukonko/ll v0.1.8 h1:ysHCJRGHYKzmBSdz9w5AySztx7lG8SQY+naTGYUbsz8= github.com/olekukonko/ll v0.1.8/go.mod h1:RPRC6UcscfFZgjo1nulkfMH5IM0QAYim0LfnMvUuozw= github.com/olekukonko/tablewriter v1.1.4 h1:ORUMI3dXbMnRlRggJX3+q7OzQFDdvgbN9nVWj1drm6I= @@ -605,8 +606,8 @@ github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM= github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM= github.com/pierrec/lz4/v4 v4.1.26 h1:GrpZw1gZttORinvzBdXPUXATeqlJjqUG/D87TKMnhjY= github.com/pierrec/lz4/v4 v4.1.26/go.mod h1:EoQMVJgeeEOMsCqCzqFm2O0cJvljX2nGZjcRIPL34O4= -github.com/pjbgf/sha1cd v0.5.0 h1:a+UkboSi1znleCDUNT3M5YxjOnN1fz2FhN48FlwCxs0= -github.com/pjbgf/sha1cd v0.5.0/go.mod h1:lhpGlyHLpQZoxMv8HcgXvZEhcGs0PG/vsZnEJ7H0iCM= +github.com/pjbgf/sha1cd v0.6.0 h1:3WJ8Wz8gvDz29quX1OcEmkAlUg9diU4GxJHqs0/XiwU= +github.com/pjbgf/sha1cd v0.6.0/go.mod h1:lhpGlyHLpQZoxMv8HcgXvZEhcGs0PG/vsZnEJ7H0iCM= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -627,8 +628,8 @@ github.com/prometheus/procfs v0.20.1/go.mod h1:o9EMBZGRyvDrSPH1RqdxhojkuXstoe4Ul github.com/quasoft/websspi v1.1.2 h1:/mA4w0LxWlE3novvsoEL6BBA1WnjJATbjkh1kFrTidw= github.com/quasoft/websspi v1.1.2/go.mod h1:HmVdl939dQ0WIXZhyik+ARdI03M6bQzaSEKcgpFmewk= github.com/rcrowley/go-metrics v0.0.0-20190826022208-cac0b30c2563/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/redis/go-redis/v9 v9.18.0 h1:pMkxYPkEbMPwRdenAzUNyFNrDgHx9U+DrBabWNfSRQs= -github.com/redis/go-redis/v9 v9.18.0/go.mod h1:k3ufPphLU5YXwNTUcCRXGxUoF1fqxnhFQmscfkCoDA0= +github.com/redis/go-redis/v9 v9.19.0 h1:XPVaaPSnG6RhYf7p+rmSa9zZfeVAnWsH5h3lxthOm/k= +github.com/redis/go-redis/v9 v9.19.0/go.mod h1:v/M13XI1PVCDcm01VtPFOADfZtHf8YW3baQf57KlIkA= github.com/redis/rueidis v1.0.71 h1:pODtnAR5GAB7j4ekhldZ29HKOxe4Hph0GTDGk1ayEQY= github.com/redis/rueidis v1.0.71/go.mod h1:lfdcZzJ1oKGKL37vh9fO3ymwt+0TdjkkUCJxbgpmcgQ= github.com/redis/rueidis/rueidiscompat v1.0.71 h1:wNZ//kEjMZgBM0KCk7ncOX8KmAgROU2kDdDNpwheG4w= @@ -684,8 +685,9 @@ github.com/steveyen/gtreap v0.1.0/go.mod h1:kl/5J7XbrOmlIbYIXdRHDDE5QxHqpk0cmkT7 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/objx v0.5.3 h1:jmXUvGomnU1o3W/V5h2VEradbpJDwGrzugQQvL0POH4= +github.com/stretchr/objx v0.5.3/go.mod h1:rDQraq+vQZU7Fde9LOZLr8Tax6zZvy4kuNKF+QYS+U0= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -717,24 +719,17 @@ github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs= github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM= github.com/urfave/cli-docs/v3 v3.1.0 h1:Sa5xm19IpE5gpm6tZzXdfjdFxn67PnEsE4dpXF7vsKw= github.com/urfave/cli-docs/v3 v3.1.0/go.mod h1:59d+5Hz1h6GSGJ10cvcEkbIe3j233t4XDqI72UIx7to= -github.com/urfave/cli/v3 v3.4.1 h1:1M9UOCy5bLmGnuu1yn3t3CB4rG79Rtoxuv1sPhnm6qM= -github.com/urfave/cli/v3 v3.4.1/go.mod h1:FJSKtM/9AiiTOJL4fJ6TbMUkxBXn7GO9guZqoZtpYpo= +github.com/urfave/cli/v3 v3.9.0 h1:AV9lIiPv3ukYnxunaCUsHnEozptYmDN2F0+yWqLMn/c= +github.com/urfave/cli/v3 v3.9.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso= github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= -github.com/wneessen/go-mail v0.7.2 h1:xxPnhZ6IZLSgxShebmZ6DPKh1b6OJcoHfzy7UjOkzS8= -github.com/wneessen/go-mail v0.7.2/go.mod h1:+TkW6QP3EVkgTEqHtVmnAE/1MRhmzb8Y9/W3pweuS+k= +github.com/wneessen/go-mail v0.7.3 h1:g3DravXC5SMlVdboFrQA8Jx95A8sOzoBeS5F+vzNRK0= +github.com/wneessen/go-mail v0.7.3/go.mod h1:QGhBX0yNbc1J+Mkjcu7z2rpj4B4l+BmDY8gYznPC9sk= github.com/woodsbury/decimal128 v1.3.0 h1:8pffMNWIlC0O5vbyHWFZAt5yWvWcrHA+3ovIIjVWss0= github.com/woodsbury/decimal128 v1.3.0/go.mod h1:C5UTmyTjW3JftjUFzOVhC20BEQa2a4ZKOB5I6Zjb+ds= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= @@ -755,10 +750,10 @@ github.com/zeebo/blake3 v0.2.4 h1:KYQPkhpRtcqh0ssGYcKLG1JYvddkEA8QwCM/yBqhaZI= github.com/zeebo/blake3 v0.2.4/go.mod h1:7eeQ6d2iXWRGF6npfaxl2CU+xy2Fjo2gxeyZGCRUjcE= github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo= github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= -github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0= -github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA= -gitlab.com/gitlab-org/api/client-go v1.46.0 h1:YxBWFZIFYKcGESCb9fpkwzouo+apyB9pr/XTWzNoL24= -gitlab.com/gitlab-org/api/client-go v1.46.0/go.mod h1:FtgyU6g2HS5+fMhw6nLK96GBEEBx5MzntOiJWfIaiN8= +github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs= +github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s= +gitlab.com/gitlab-org/api/client-go/v2 v2.30.0 h1:guXC+uOA325P1FIwUVesPoDcnogHnbPrhV8c+wMHZPE= +gitlab.com/gitlab-org/api/client-go/v2 v2.30.0/go.mod h1:0upZTKi9YMMvhavTlKJ3YgQUZE/GJkcLmXT/+6knTXU= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo= go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E= @@ -794,12 +789,12 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= -golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= -golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= -golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11UATqWDmWuS99x26cD0= -golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4= -golang.org/x/image v0.39.0 h1:skVYidAEVKgn8lZ602XO75asgXBgLj9G/FE3RbuPFww= -golang.org/x/image v0.39.0/go.mod h1:sIbmppfU+xFLPIG0FoVUTvyBMmgng1/XAMhQ2ft0hpA= +golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988= +golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc= +golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM= +golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80= +golang.org/x/image v0.41.0 h1:8wS72eGJMJaBxK6okTzd4WaXumUlTVlb753MlsSvTCo= +golang.org/x/image v0.41.0/go.mod h1:uIc348UZMSvS5Z65CVZ7iDPaNobNFEPeJ4kbqTOszmA= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -808,8 +803,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI= -golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY= +golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= +golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -826,8 +821,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= -golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= -golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= +golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8= +golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww= golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs= golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -874,8 +869,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= -golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY= +golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -886,8 +881,8 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= -golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= -golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= +golang.org/x/term v0.43.0 h1:S4RLU2sB31O/NCl+zFN9Aru9A/Cq2aqKpTZJ6B+DwT4= +golang.org/x/term v0.43.0/go.mod h1:lrhlHNdQJHO+1qVYiHfFKVuVioJIheAc3fBSMFYEIsk= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -898,8 +893,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc= +golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38= golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U= golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -911,16 +906,16 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= -golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= +golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c= +golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20260401020348-3a24fdc17823 h1:YedBIttDguBl/zy2wJauEUm+DZZg4UXseWj0g/3N+yo= google.golang.org/genproto/googleapis/rpc v0.0.0-20260401020348-3a24fdc17823/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8= -google.golang.org/grpc v1.80.0 h1:Xr6m2WmWZLETvUNvIUmeD5OAagMw3FiKmMlTdViWsHM= -google.golang.org/grpc v1.80.0/go.mod h1:ho/dLnxwi3EDJA4Zghp7k2Ec1+c2jqup0bFkw07bwF4= +google.golang.org/grpc v1.81.1 h1:VnnIIZ88UzOOKLukQi+ImGz8O1Wdp8nAGGnvOfEIWQQ= +google.golang.org/grpc v1.81.1/go.mod h1:xGH9GfzOyMTGIOXBJmXt+BX/V0kcdQbdcuwQ/zNw42I= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -934,8 +929,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/ini.v1 v1.67.1 h1:tVBILHy0R6e4wkYOn3XmiITt/hEVH4TFMYvAX2Ytz6k= -gopkg.in/ini.v1 v1.67.1/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= +gopkg.in/ini.v1 v1.67.2 h1:JtOSMb9OuaCZKr7h5D/h6iii14sK0hLbplTc6frx4Ss= +gopkg.in/ini.v1 v1.67.2/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= @@ -949,24 +944,32 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI= -lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc/v3 v3.40.0 h1:P3g79IUS/93SYhtoeaHW+kRCIrYaxJ27MFPv+7kaTOw= -modernc.org/cc/v3 v3.40.0/go.mod h1:/bTg4dnWkSXowUO6ssQKnOV0yMVxDYNIsIrzqTFDGH0= -modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw= -modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY= -modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U= -modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w= -modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= -modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= -modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= -modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU= -modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= -modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.20.4 h1:J8+m2trkN+KKoE7jglyHYYYiaq5xmz2HoHJIiBlRzbE= -modernc.org/sqlite v1.20.4/go.mod h1:zKcGyrICaxNTMEHSr1HQ2GUraP0j+845GYw37+EyT6A= -modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA= -modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0= +modernc.org/cc/v4 v4.28.2 h1:3tQ0lf2ADtoby2EtSP+J7IE2SHwEJdP8ioR59wx7XpY= +modernc.org/cc/v4 v4.28.2/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI= +modernc.org/ccgo/v4 v4.34.0 h1:yRLPFZieg532OT4rp4JFNIVcquwalMX26G95WQDqwCQ= +modernc.org/ccgo/v4 v4.34.0/go.mod h1:AS5WYMyBakQ+fhsHhtP8mWB82KTGPkNNJDGfGQCe0/A= +modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM= +modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU= +modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= +modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= +modernc.org/gc/v3 v3.1.2 h1:ZtDCnhonXSZexk/AYsegNRV1lJGgaNZJuKjJSWKyEqo= +modernc.org/gc/v3 v3.1.2/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY= +modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks= +modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI= +modernc.org/libc v1.72.3 h1:ZnDF4tXn4NBXFutMMQC4vtbTFSXhhKzR73fv0beZEAU= +modernc.org/libc v1.72.3/go.mod h1:dn0dZNnnn1clLyvRxLxYExxiKRZIRENOfqQ8XEeg4Qs= +modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= +modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= +modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI= +modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= +modernc.org/opt v0.2.0 h1:tGyef5ApycA7FSEOMraay9SaTk5zmbx7Tu+cJs4QKZg= +modernc.org/opt v0.2.0/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns= +modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w= +modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE= +modernc.org/sqlite v1.50.1 h1:l+cQvn0sd0zJJtfygGHuQJ5AjlrwXmWPw4KP3ZMwr9w= +modernc.org/sqlite v1.50.1/go.mod h1:tcNzv5p84E0skkmJn038y+hWJbLQXQqEnQfeh5r2JLM= +modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0= +modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= mvdan.cc/xurls/v2 v2.6.0 h1:3NTZpeTxYVWNSokW3MKeyVkz/j7uYXYiMtXRUfmjbgI= diff --git a/main.go b/main.go index fcfbb733715..bdb962f4fc1 100644 --- a/main.go +++ b/main.go @@ -10,16 +10,16 @@ import ( "strings" "time" - "code.gitea.io/gitea/cmd" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/cmd" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" // register supported doc types - _ "code.gitea.io/gitea/modules/markup/asciicast" - _ "code.gitea.io/gitea/modules/markup/console" - _ "code.gitea.io/gitea/modules/markup/csv" - _ "code.gitea.io/gitea/modules/markup/markdown" - _ "code.gitea.io/gitea/modules/markup/orgmode" + _ "gitea.dev/modules/markup/asciicast" + _ "gitea.dev/modules/markup/console" + _ "gitea.dev/modules/markup/csv" + _ "gitea.dev/modules/markup/markdown" + _ "gitea.dev/modules/markup/orgmode" "github.com/urfave/cli/v3" ) diff --git a/models/actions/artifact.go b/models/actions/artifact.go index f0effdeecaf..8a50c09179e 100644 --- a/models/actions/artifact.go +++ b/models/actions/artifact.go @@ -1,7 +1,7 @@ // Copyright 2023 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT -// This artifact server is inspired by https://github.com/nektos/act/blob/master/pkg/artifacts/server.go. +// This artifact server is inspired by the Gitea runner artifact server implementation. // It updates url setting and uses ObjectStore to handle artifacts persistence. package actions @@ -11,10 +11,10 @@ import ( "errors" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/optional" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/actions/config.go b/models/actions/config.go index 4f5357c5605..f4d99b8f7ab 100644 --- a/models/actions/config.go +++ b/models/actions/config.go @@ -6,11 +6,11 @@ package actions import ( "context" - "code.gitea.io/gitea/models/perm" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/perm" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/json" + "gitea.dev/modules/util" "xorm.io/xorm/convert" ) diff --git a/models/actions/main_test.go b/models/actions/main_test.go index 4af483813ab..c3ae15d769b 100644 --- a/models/actions/main_test.go +++ b/models/actions/main_test.go @@ -6,7 +6,7 @@ package actions import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" ) func TestMain(m *testing.M) { @@ -15,6 +15,7 @@ func TestMain(m *testing.M) { "action_runner_token.yml", "action_run.yml", "repository.yml", + "user.yml", }, }) } diff --git a/models/actions/run.go b/models/actions/run.go index a44b0ff343e..bba6b4c34eb 100644 --- a/models/actions/run.go +++ b/models/actions/run.go @@ -7,23 +7,20 @@ import ( "context" "errors" "fmt" - "slices" "strings" "time" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - api "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" - webhook_module "code.gitea.io/gitea/modules/webhook" - - "xorm.io/builder" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/git" + "gitea.dev/modules/json" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + api "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" + webhook_module "gitea.dev/modules/webhook" ) // ActionRun represents a run of a workflow file @@ -224,120 +221,34 @@ func (run *ActionRun) IsSchedule() bool { } // UpdateRepoRunsNumbers updates the number of runs and closed runs of a repository. -func UpdateRepoRunsNumbers(ctx context.Context, repo *repo_model.Repository) error { - _, err := db.GetEngine(ctx).ID(repo.ID). - NoAutoTime(). - Cols("num_action_runs", "num_closed_action_runs"). - SetExpr("num_action_runs", - builder.Select("count(*)").From("action_run"). - Where(builder.Eq{"repo_id": repo.ID}), - ). - SetExpr("num_closed_action_runs", - builder.Select("count(*)").From("action_run"). - Where(builder.Eq{ - "repo_id": repo.ID, - }.And( - builder.In("status", - StatusSuccess, - StatusFailure, - StatusCancelled, - StatusSkipped, - ), - ), - ), - ). - Update(repo) - return err -} +// Callers MUST invoke this from outside any transaction that has X-locked action_run rows for the same repo, otherwise, transaction deadlock +func UpdateRepoRunsNumbers(ctx context.Context, repoID int64) { + if db.InTransaction(ctx) { + setting.PanicInDevOrTesting("UpdateRepoRunsNumbers must not be called inside a transaction") + } -// CancelPreviousJobs cancels all previous jobs of the same repository, reference, workflow, and event. -// It's useful when a new run is triggered, and all previous runs needn't be continued anymore. -func CancelPreviousJobs(ctx context.Context, repoID int64, ref, workflowID string, event webhook_module.HookEventType) ([]*ActionRunJob, error) { - // Find all runs in the specified repository, reference, and workflow with non-final status - runs, total, err := db.FindAndCount[ActionRun](ctx, FindRunOptions{ - RepoID: repoID, - Ref: ref, - WorkflowID: workflowID, - TriggerEvent: event, - Status: []Status{StatusRunning, StatusWaiting, StatusBlocked}, - }) + e := db.GetEngine(ctx) + + numActionRuns, err := e.Where("repo_id = ?", repoID).Count(new(ActionRun)) if err != nil { - return nil, err + log.Error("UpdateRepoRunsNumbers count num_action_runs for repo %d: %v", repoID, err) + return } - // If there are no runs found, there's no need to proceed with cancellation, so return nil. - if total == 0 { - return nil, nil + numClosedActionRuns, err := e.Where("repo_id = ?", repoID). + In("status", StatusSuccess, StatusFailure, StatusCancelled, StatusSkipped). + Count(new(ActionRun)) + if err != nil { + log.Error("UpdateRepoRunsNumbers count num_closed_action_runs for repo %d: %v", repoID, err) + return } - cancelledJobs := make([]*ActionRunJob, 0, total) - - // Iterate over each found run and cancel its associated jobs. - for _, run := range runs { - // Find all jobs associated with the current run. - jobs, err := db.Find[ActionRunJob](ctx, FindRunJobOptions{ - RunID: run.ID, - }) - if err != nil { - return cancelledJobs, err - } - - cjs, err := CancelJobs(ctx, jobs) - if err != nil { - return cancelledJobs, err - } - cancelledJobs = append(cancelledJobs, cjs...) + if _, err := e.ID(repoID).Cols("num_action_runs", "num_closed_action_runs").NoAutoTime().Update(&repo_model.Repository{ + NumActionRuns: int(numActionRuns), + NumClosedActionRuns: int(numClosedActionRuns), + }); err != nil { + log.Error("UpdateRepoRunsNumbers update repo %d: %v", repoID, err) } - - // Return nil to indicate successful cancellation of all running and waiting jobs. - return cancelledJobs, nil -} - -func CancelJobs(ctx context.Context, jobs []*ActionRunJob) ([]*ActionRunJob, error) { - cancelledJobs := make([]*ActionRunJob, 0, len(jobs)) - // Iterate over each job and attempt to cancel it. - for _, job := range jobs { - // Skip jobs that are already in a terminal state (completed, cancelled, etc.). - status := job.Status - if status.IsDone() { - continue - } - - // If the job has no associated task (probably an error), set its status to 'Cancelled' and stop it. - if job.TaskID == 0 { - job.Status = StatusCancelled - job.Stopped = timeutil.TimeStampNow() - - // Update the job's status and stopped time in the database. - n, err := UpdateRunJob(ctx, job, builder.Eq{"task_id": 0}, "status", "stopped") - if err != nil { - return cancelledJobs, err - } - - // If the update affected 0 rows, it means the job has changed in the meantime - if n == 0 { - log.Error("Failed to cancel job %d because it has changed", job.ID) - continue - } - - cancelledJobs = append(cancelledJobs, job) - // Continue with the next job. - continue - } - - // If the job has an associated task, try to stop the task, effectively cancelling the job. - if err := StopTask(ctx, job.TaskID, StatusCancelled); err != nil { - return cancelledJobs, err - } - updatedJob, err := GetRunJobByRunAndID(ctx, job.RunID, job.ID) - if err != nil { - return cancelledJobs, fmt.Errorf("get job: %w", err) - } - cancelledJobs = append(cancelledJobs, updatedJob) - } - - // Return nil to indicate successful cancellation of all running and waiting jobs. - return cancelledJobs, nil } func GetRunByRepoAndID(ctx context.Context, repoID, runID int64) (*ActionRun, error) { @@ -415,18 +326,6 @@ func UpdateRun(ctx context.Context, run *ActionRun, cols ...string) error { // It's impossible that the run is not found, since Gitea never deletes runs. } - if run.Status != 0 || slices.Contains(cols, "status") { - if run.RepoID == 0 { - setting.PanicInDevOrTesting("RepoID should not be 0") - } - if err = run.LoadRepo(ctx); err != nil { - return err - } - if err := UpdateRepoRunsNumbers(ctx, run.Repo); err != nil { - return err - } - } - return nil } @@ -461,6 +360,7 @@ func CancelPreviousJobsByRunConcurrency(ctx context.Context, attempt *ActionRunA statusFindOption := []Status{StatusWaiting, StatusBlocked} if attempt.ConcurrencyCancel { statusFindOption = append(statusFindOption, StatusRunning) + statusFindOption = append(statusFindOption, StatusCancelling) } attempts, jobs, err := GetConcurrentRunAttemptsAndJobs(ctx, attempt.RepoID, attempt.ConcurrencyGroup, statusFindOption) if err != nil { diff --git a/models/actions/run_attempt.go b/models/actions/run_attempt.go index 857247b0689..778b153cb4d 100644 --- a/models/actions/run_attempt.go +++ b/models/actions/run_attempt.go @@ -9,11 +9,11 @@ import ( "slices" "time" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" ) // ActionRunAttempt represents a single execution attempt of an ActionRun. diff --git a/models/actions/run_attempt_list.go b/models/actions/run_attempt_list.go index 77a5b8f15c9..9c125d559e0 100644 --- a/models/actions/run_attempt_list.go +++ b/models/actions/run_attempt_list.go @@ -6,9 +6,9 @@ package actions import ( "context" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" ) type ActionRunAttemptList []*ActionRunAttempt diff --git a/models/actions/run_job.go b/models/actions/run_job.go index f0d41ef4b47..caf66ca451c 100644 --- a/models/actions/run_job.go +++ b/models/actions/run_job.go @@ -9,11 +9,13 @@ import ( "slices" "time" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/actions/jobparser" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/actions/jobparser" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" + webhook_module "gitea.dev/modules/webhook" "xorm.io/builder" ) @@ -75,14 +77,55 @@ type ActionRunJob struct { // A value of 0 indicates a legacy job created before ActionRunAttempt existed. AttemptJobID int64 `xorm:"index NOT NULL DEFAULT 0"` + // WorkflowSourceRepoID + WorkflowSourceCommitSHA record the (repo, commit) this job's containing workflow file came from. + WorkflowSourceRepoID int64 `xorm:"NOT NULL DEFAULT 0"` + WorkflowSourceCommitSHA string `xorm:"VARCHAR(64) NOT NULL DEFAULT ''"` + + // IsReusableCaller marks this job as a reusable workflow caller. + // Caller jobs do not run on a runner; their status is derived from their child jobs. + IsReusableCaller bool `xorm:"index NOT NULL DEFAULT FALSE"` + // IsExpanded reports whether this job's lazy expansion (children-row insertion) is complete. + // For a reusable workflow caller, true means children rows exist and CallPayload is populated. + IsExpanded bool `xorm:"NOT NULL DEFAULT FALSE"` + // CallUses stores the raw "uses:" string of a reusable workflow caller job. + // Only set when IsReusableCaller is true. + CallUses string `xorm:"VARCHAR(512) NOT NULL DEFAULT ''"` + // ReusableWorkflowContent is the content of the reusable workflow specified by "uses:". + // Only set when IsReusableCaller is true. + ReusableWorkflowContent []byte `xorm:"LONGBLOB"` + // CallSecrets encodes the reusable workflow caller's "secrets:" section: + // - "" : no "secrets:" section (children only see auto-generated tokens). + // - "inherit" : the caller wrote "secrets: inherit". + // - JSON object : explicit mapping {alias: source_name}; names only, no values. + // Only set when IsReusableCaller is true. + CallSecrets string `xorm:"LONGTEXT"` + // CallPayload is the JSON-encoded WorkflowCallPayload exposed to children as gitea.event. + // Populated atomically with IsExpanded at the end of expandReusableWorkflowCaller. + // Only set when IsReusableCaller is true. + CallPayload string `xorm:"LONGTEXT"` + + // ParentJobID scopes `Needs` resolution: name lookups happen only among rows sharing the same ParentJobID. 0 for top-level rows. + ParentJobID int64 `xorm:"index NOT NULL DEFAULT 0"` + Started timeutil.TimeStamp Stopped timeutil.TimeStamp Created timeutil.TimeStamp `xorm:"created"` Updated timeutil.TimeStamp `xorm:"updated index"` } +// ActionRunAttemptJobIDIndex backs the run-wide AttemptJobID counter, keyed by ActionRun.ID. +// Use GetNextAttemptJobID to allocate the next ID for a run. +type ActionRunAttemptJobIDIndex db.ResourceIndex + +// GetNextAttemptJobID atomically allocates the next AttemptJobID for a job in the given run. +// AttemptJobIDs are unique within a single attempt and stable across attempts for the same logical job +func GetNextAttemptJobID(ctx context.Context, runID int64) (int64, error) { + return db.GetNextResourceIndex(ctx, "action_run_attempt_job_id_index", runID) +} + func init() { db.RegisterModel(new(ActionRunJob)) + db.RegisterModel(new(ActionRunAttemptJobIDIndex)) } func (job *ActionRunJob) Duration() time.Duration { @@ -218,6 +261,101 @@ func GetRunJobsByRunAndAttemptID(ctx context.Context, runID, runAttemptID int64) return jobs, nil } +// GetPriorAttemptChildrenByParent returns the children of the most recent prior attempt where +// the parent (identified by parentAttemptJobID) actually had children, indexed by child JobID then child Name. +// Returns (nil, nil) when no such attempt exists. +// The (JobID, Name) key disambiguates both reusable-workflow subtrees and matrix-expanded instances (whose Name carries the matrix suffix). +func GetPriorAttemptChildrenByParent(ctx context.Context, runID, currentAttemptID, parentAttemptJobID int64) (map[string]map[string]*ActionRunJob, error) { + // query every prior caller row sharing this AttemptJobID, newest first. + var priorCallers []*ActionRunJob + if err := db.GetEngine(ctx). + Where("run_id = ? AND attempt_job_id = ? AND run_attempt_id < ?", runID, parentAttemptJobID, currentAttemptID). + Desc("run_attempt_id"). + Find(&priorCallers); err != nil { + return nil, fmt.Errorf("find prior callers: %w", err) + } + if len(priorCallers) == 0 { + return nil, nil //nolint:nilnil // caller is brand new in this attempt + } + + // query for every child of every prior caller + callerIDs := make([]int64, len(priorCallers)) + for i, c := range priorCallers { + callerIDs[i] = c.ID + } + var allChildren []*ActionRunJob + if err := db.GetEngine(ctx). + Where("run_id = ?", runID). + In("parent_job_id", callerIDs). + Find(&allChildren); err != nil { + return nil, fmt.Errorf("find prior children: %w", err) + } + + childrenByCallerID := make(map[int64][]*ActionRunJob, len(callerIDs)) + for _, c := range allChildren { + childrenByCallerID[c.ParentJobID] = append(childrenByCallerID[c.ParentJobID], c) + } + + // Walk priorCallers in run_attempt_id-desc order and return the children of the first caller that actually had any. + // Skipped attempts (caller exists but no children) are bypassed. + for _, caller := range priorCallers { + children := childrenByCallerID[caller.ID] + if len(children) == 0 { + continue + } + out := make(map[string]map[string]*ActionRunJob) + for _, c := range children { + if out[c.JobID] == nil { + out[c.JobID] = make(map[string]*ActionRunJob) + } + out[c.JobID][c.Name] = c + } + return out, nil + } + + return nil, nil //nolint:nilnil // every prior attempt skipped this caller +} + +// GetDirectChildJobsByParent returns the direct child jobs of a parent job (e.g. a reusable workflow caller). +func GetDirectChildJobsByParent(ctx context.Context, parentJob *ActionRunJob) (ActionJobList, error) { + var jobs []*ActionRunJob + if err := db.GetEngine(ctx). + Where("run_id=? AND parent_job_id=?", parentJob.RunID, parentJob.ID). + OrderBy("id"). + Find(&jobs); err != nil { + return nil, err + } + return jobs, nil +} + +// CollectAllDescendantJobs returns every job in `allJobs` that lives under parent's subtree (recursively), excluding `parent` itself +func CollectAllDescendantJobs(parent *ActionRunJob, allJobs []*ActionRunJob) []*ActionRunJob { + parents := map[int64]bool{parent.ID: true} + for { + grew := false + for _, j := range allJobs { + if j.ParentJobID == 0 { + continue + } + if parents[j.ParentJobID] && !parents[j.ID] { + parents[j.ID] = true + grew = true + } + } + if !grew { + break + } + } + out := make([]*ActionRunJob, 0) + for _, j := range allJobs { + if j.ID == parent.ID || !parents[j.ID] { + continue + } + out = append(out, j) + } + return out +} + func UpdateRunJob(ctx context.Context, job *ActionRunJob, cond builder.Cond, cols ...string) (int64, error) { e := db.GetEngine(ctx) @@ -235,11 +373,15 @@ func UpdateRunJob(ctx context.Context, job *ActionRunJob, cond builder.Cond, col return 0, err } - if affected == 0 || (!slices.Contains(cols, "status") && job.Status == 0) { + // xorm's Update writes only non-zero fields when cols is empty, so a zero job.Status + // with empty cols means status isn't actually being persisted — skip aggregation. + statusUpdated := slices.Contains(cols, "status") || (len(cols) == 0 && job.Status != 0) + if affected == 0 || !statusUpdated { return affected, nil } - if slices.Contains(cols, "status") && job.Status.IsWaiting() { + // Reusable workflow caller jobs are never picked up by runners, so they don't need a task-version bump. + if statusUpdated && job.Status.IsWaiting() && !job.IsReusableCaller { // if the status of job changes to waiting again, increase tasks version. if err := IncreaseTaskVersion(ctx, job.OwnerID, job.RepoID); err != nil { return 0, err @@ -253,6 +395,15 @@ func UpdateRunJob(ctx context.Context, job *ActionRunJob, cond builder.Cond, col } } + if statusUpdated && job.ParentJobID > 0 { + // Reusable workflow caller's children cascade their status changes upward to the parent caller. + parent, err := GetRunJobByRunAndID(ctx, job.RunID, job.ParentJobID) + if err != nil { + return affected, fmt.Errorf("load parent caller %d: %w", job.ParentJobID, err) + } + return affected, RefreshReusableCallerStatus(ctx, parent) + } + { // Other goroutines may aggregate the status of the attempt/run and update it too. // So we need to load the current jobs before updating the aggregate state. @@ -305,15 +456,54 @@ func UpdateRunJob(ctx context.Context, job *ActionRunJob, cond builder.Cond, col return affected, nil } +// RefreshReusableCallerStatus recomputes a reusable workflow caller's Status, Started and Stopped from its current direct children and persists the change. +// No-op if caller is not a reusable caller. +// +// Concurrency: two sibling children finishing at roughly the same time can each invoke this for the same parent caller. +// No row-level lock is taken because AggregateJobStatus is a pure function of the children's statuses (order-independent), so racing callers arrive at the same Status. +func RefreshReusableCallerStatus(ctx context.Context, caller *ActionRunJob) error { + if !caller.IsReusableCaller { + return nil + } + children, err := GetDirectChildJobsByParent(ctx, caller) + if err != nil { + return err + } + + newStatus := AggregateJobStatus(children) + cols := make([]string, 0, 3) + if caller.Status != newStatus { + caller.Status = newStatus + cols = append(cols, "status") + } + if newStatus != StatusSkipped { + now := timeutil.TimeStampNow() + if caller.Started.IsZero() && newStatus == StatusRunning { + caller.Started = now + cols = append(cols, "started") + } + if caller.Stopped.IsZero() && newStatus.IsDone() { + caller.Stopped = now + cols = append(cols, "stopped") + } + } + if len(cols) == 0 { + return nil + } + _, err = UpdateRunJob(ctx, caller, nil, cols...) + return err +} + func AggregateJobStatus(jobs []*ActionRunJob) Status { allSuccessOrSkipped := len(jobs) != 0 allSkipped := len(jobs) != 0 - var hasFailure, hasCancelled, hasWaiting, hasRunning, hasBlocked bool + var hasFailure, hasCancelled, hasCancelling, hasWaiting, hasRunning, hasBlocked bool for _, job := range jobs { allSuccessOrSkipped = allSuccessOrSkipped && (job.Status == StatusSuccess || job.Status == StatusSkipped) allSkipped = allSkipped && job.Status == StatusSkipped hasFailure = hasFailure || job.Status == StatusFailure hasCancelled = hasCancelled || job.Status == StatusCancelled + hasCancelling = hasCancelling || job.Status == StatusCancelling hasWaiting = hasWaiting || job.Status == StatusWaiting hasRunning = hasRunning || job.Status == StatusRunning hasBlocked = hasBlocked || job.Status == StatusBlocked @@ -323,21 +513,68 @@ func AggregateJobStatus(jobs []*ActionRunJob) Status { return StatusSkipped case allSuccessOrSkipped: return StatusSuccess - case hasCancelled: - return StatusCancelled + case hasCancelling: + return StatusCancelling case hasRunning: return StatusRunning case hasWaiting: return StatusWaiting + case hasBlocked: + // Blocked is still a pending state, so it should outrank terminal + // statuses like cancelled/failure when no job is waiting or running. + return StatusBlocked + case hasCancelled: + return StatusCancelled case hasFailure: return StatusFailure - case hasBlocked: - return StatusBlocked default: return StatusUnknown // it shouldn't happen } } +// CancelPreviousJobs cancels all previous jobs of the same repository, reference, workflow, and event. +// It's useful when a new run is triggered, and all previous runs needn't be continued anymore. +func CancelPreviousJobs(ctx context.Context, repoID int64, ref, workflowID string, event webhook_module.HookEventType) ([]*ActionRunJob, error) { + // Find all runs in the specified repository, reference, and workflow with non-final status + runs, total, err := db.FindAndCount[ActionRun](ctx, FindRunOptions{ + RepoID: repoID, + Ref: ref, + WorkflowID: workflowID, + TriggerEvent: event, + Status: []Status{StatusRunning, StatusWaiting, StatusBlocked, StatusCancelling}, + }) + if err != nil { + return nil, err + } + + // If there are no runs found, there's no need to proceed with cancellation, so return nil. + if total == 0 { + return nil, nil + } + + cancelledJobs := make([]*ActionRunJob, 0, total) + + // Iterate over each found run and cancel its associated jobs. + for _, run := range runs { + // Find all jobs associated with the current run. + jobs, err := db.Find[ActionRunJob](ctx, FindRunJobOptions{ + RunID: run.ID, + }) + if err != nil { + return cancelledJobs, err + } + + cjs, err := CancelJobs(ctx, jobs) + if err != nil { + return cancelledJobs, err + } + cancelledJobs = append(cancelledJobs, cjs...) + } + + // Return nil to indicate successful cancellation of all running and waiting jobs. + return cancelledJobs, nil +} + func CancelPreviousJobsByJobConcurrency(ctx context.Context, job *ActionRunJob) (jobsToCancel []*ActionRunJob, _ error) { if job.RawConcurrency == "" { return nil, nil @@ -352,6 +589,7 @@ func CancelPreviousJobsByJobConcurrency(ctx context.Context, job *ActionRunJob) statusFindOption := []Status{StatusWaiting, StatusBlocked} if job.ConcurrencyCancel { statusFindOption = append(statusFindOption, StatusRunning) + statusFindOption = append(statusFindOption, StatusCancelling) } attempts, jobs, err := GetConcurrentRunAttemptsAndJobs(ctx, job.RepoID, job.ConcurrencyGroup, statusFindOption) if err != nil { @@ -374,3 +612,84 @@ func CancelPreviousJobsByJobConcurrency(ctx context.Context, job *ActionRunJob) return CancelJobs(ctx, jobsToCancel) } + +func CancelJobs(ctx context.Context, jobs []*ActionRunJob) ([]*ActionRunJob, error) { + cancelledJobs := make([]*ActionRunJob, 0, len(jobs)) + + for _, job := range jobs { + if job.IsReusableCaller { + sub, err := cancelReusableCaller(ctx, job) + if err != nil { + return cancelledJobs, err + } + cancelledJobs = append(cancelledJobs, sub...) + continue + } + + c, err := cancelOneJob(ctx, job) + if err != nil { + return cancelledJobs, err + } + if c != nil { + cancelledJobs = append(cancelledJobs, c) + } + } + return cancelledJobs, nil +} + +// cancelOneJob cancels a single job and returns the post-cancel row +func cancelOneJob(ctx context.Context, job *ActionRunJob) (*ActionRunJob, error) { + if job.Status.IsDone() { + return nil, nil //nolint:nilnil // signal "nothing to cancel; not an error" + } + // No associated task: mark Cancelled directly. This includes reusable callers and jobs that never reached PickTask. + if job.TaskID == 0 { + job.Status = StatusCancelled + job.Stopped = timeutil.TimeStampNow() + n, err := UpdateRunJob(ctx, job, builder.Eq{"task_id": 0}, "status", "stopped") + if err != nil { + return nil, err + } + if n == 0 { + log.Error("Failed to cancel job %d because it has changed", job.ID) + return nil, nil //nolint:nilnil // signal "nothing to cancel; not an error" + } + return job, nil + } + // Has a task: stop the task and re-read the row. + if err := StopTask(ctx, job.TaskID, StatusCancelling); err != nil { + return nil, err + } + updated, err := GetRunJobByRunAndID(ctx, job.RunID, job.ID) + if err != nil { + return nil, fmt.Errorf("get job: %w", err) + } + return updated, nil +} + +// cancelReusableCaller cancels `caller` and all its child jobs +func cancelReusableCaller(ctx context.Context, caller *ActionRunJob) ([]*ActionRunJob, error) { + cancelledJobs := make([]*ActionRunJob, 0) + + if c, err := cancelOneJob(ctx, caller); err != nil { + return cancelledJobs, err + } else if c != nil { + cancelledJobs = append(cancelledJobs, c) + } + + attemptJobs, err := GetRunJobsByRunAndAttemptID(ctx, caller.RunID, caller.RunAttemptID) + if err != nil { + return cancelledJobs, err + } + + for _, c := range CollectAllDescendantJobs(caller, attemptJobs) { + cancelled, err := cancelOneJob(ctx, c) + if err != nil { + return cancelledJobs, err + } + if cancelled != nil { + cancelledJobs = append(cancelledJobs, cancelled) + } + } + return cancelledJobs, nil +} diff --git a/models/actions/run_job_list.go b/models/actions/run_job_list.go index db7554593dd..f08f7c84a61 100644 --- a/models/actions/run_job_list.go +++ b/models/actions/run_job_list.go @@ -5,12 +5,14 @@ package actions import ( "context" + "slices" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/base" + "gitea.dev/modules/container" + "gitea.dev/modules/optional" + "gitea.dev/modules/timeutil" "xorm.io/builder" ) @@ -23,6 +25,22 @@ func (jobs ActionJobList) GetRunIDs() []int64 { }) } +// SortMatrixGroupsByName natural-sorts each contiguous run of jobs that share a JobID +// so matrix expansions (e.g. "test (1)", "test (2)", "test (10)") appear in human order. +// Input is expected to be in DB id order so JobID groups are contiguous; cross-group order is preserved. +func (jobs ActionJobList) SortMatrixGroupsByName() { + for i := 0; i < len(jobs); { + j := i + 1 + for j < len(jobs) && jobs[j].JobID == jobs[i].JobID { + j++ + } + slices.SortFunc(jobs[i:j], func(a, b *ActionRunJob) int { + return base.NaturalSortCompare(a.Name, b.Name) + }) + i = j + } +} + func (jobs ActionJobList) LoadRepos(ctx context.Context) error { repoIDs := container.FilterSlice(jobs, func(j *ActionRunJob) (int64, bool) { return j.RepoID, j.RepoID != 0 && j.Repo == nil @@ -80,6 +98,12 @@ type FindRunJobOptions struct { Statuses []Status UpdatedBefore timeutil.TimeStamp ConcurrencyGroup string + OrderBy db.SearchOrderBy +} + +var JobOrderByMap = map[string]map[string]db.SearchOrderBy{ + "asc": {"id": "`action_run_job`.id ASC"}, + "desc": {"id": "`action_run_job`.id DESC"}, } func (opts FindRunJobOptions) ToConds() builder.Cond { @@ -122,3 +146,9 @@ func (opts FindRunJobOptions) ToJoins() []db.JoinFunc { } return nil } + +func (opts FindRunJobOptions) ToOrders() string { + return string(opts.OrderBy) +} + +var _ db.FindOptionsOrder = FindRunJobOptions{} diff --git a/models/actions/run_job_list_test.go b/models/actions/run_job_list_test.go new file mode 100644 index 00000000000..271031b4cdd --- /dev/null +++ b/models/actions/run_job_list_test.go @@ -0,0 +1,61 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package actions + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestActionJobList_SortMatrixGroupsByName(t *testing.T) { + mk := func(jobID, name string) *ActionRunJob { + return &ActionRunJob{JobID: jobID, Name: name} + } + names := func(jobs ActionJobList) []string { + out := make([]string, len(jobs)) + for i, j := range jobs { + out[i] = j.Name + } + return out + } + + t.Run("matrix group sorted naturally", func(t *testing.T) { + jobs := ActionJobList{ + mk("build", "build"), + mk("test", "test (10)"), + mk("test", "test (2)"), + mk("test", "test (1)"), + mk("deploy", "deploy"), + } + jobs.SortMatrixGroupsByName() + assert.Equal(t, []string{"build", "test (1)", "test (2)", "test (10)", "deploy"}, names(jobs)) + }) + + t.Run("non-adjacent same JobID stays in input order", func(t *testing.T) { + jobs := ActionJobList{ + mk("test", "test (10)"), + mk("build", "build"), + mk("test", "test (1)"), + } + jobs.SortMatrixGroupsByName() + assert.Equal(t, []string{"test (10)", "build", "test (1)"}, names(jobs)) + }) + + t.Run("groups stay in input order", func(t *testing.T) { + jobs := ActionJobList{ + mk("z", "z"), + mk("a", "a"), + } + jobs.SortMatrixGroupsByName() + assert.Equal(t, []string{"z", "a"}, names(jobs)) + }) + + t.Run("empty and singleton", func(t *testing.T) { + ActionJobList(nil).SortMatrixGroupsByName() + jobs := ActionJobList{mk("only", "only")} + jobs.SortMatrixGroupsByName() + assert.Equal(t, []string{"only"}, names(jobs)) + }) +} diff --git a/models/actions/run_job_status_test.go b/models/actions/run_job_status_test.go index b9ae9f34bfd..c1a44cc6d36 100644 --- a/models/actions/run_job_status_test.go +++ b/models/actions/run_job_status_test.go @@ -36,6 +36,7 @@ func TestAggregateJobStatus(t *testing.T) { {[]Status{StatusUnknown, StatusSkipped}, StatusUnknown}, {[]Status{StatusUnknown, StatusFailure}, StatusFailure}, {[]Status{StatusUnknown, StatusCancelled}, StatusCancelled}, + {[]Status{StatusUnknown, StatusCancelling}, StatusCancelling}, {[]Status{StatusUnknown, StatusWaiting}, StatusWaiting}, {[]Status{StatusUnknown, StatusRunning}, StatusRunning}, {[]Status{StatusUnknown, StatusBlocked}, StatusBlocked}, @@ -45,6 +46,7 @@ func TestAggregateJobStatus(t *testing.T) { {[]Status{StatusSuccess, StatusSkipped}, StatusSuccess}, // skipped doesn't affect success {[]Status{StatusSuccess, StatusFailure}, StatusFailure}, {[]Status{StatusSuccess, StatusCancelled}, StatusCancelled}, + {[]Status{StatusSuccess, StatusCancelling}, StatusCancelling}, {[]Status{StatusSuccess, StatusWaiting}, StatusWaiting}, {[]Status{StatusSuccess, StatusRunning}, StatusRunning}, {[]Status{StatusSuccess, StatusBlocked}, StatusBlocked}, @@ -54,9 +56,16 @@ func TestAggregateJobStatus(t *testing.T) { {[]Status{StatusCancelled, StatusSuccess}, StatusCancelled}, {[]Status{StatusCancelled, StatusSkipped}, StatusCancelled}, {[]Status{StatusCancelled, StatusFailure}, StatusCancelled}, - {[]Status{StatusCancelled, StatusWaiting}, StatusCancelled}, - {[]Status{StatusCancelled, StatusRunning}, StatusCancelled}, - {[]Status{StatusCancelled, StatusBlocked}, StatusCancelled}, + {[]Status{StatusCancelled, StatusCancelling}, StatusCancelling}, + {[]Status{StatusCancelled, StatusWaiting}, StatusWaiting}, + {[]Status{StatusCancelled, StatusRunning}, StatusRunning}, + {[]Status{StatusCancelled, StatusBlocked}, StatusBlocked}, + + {[]Status{StatusCancelling}, StatusCancelling}, + {[]Status{StatusCancelling, StatusRunning}, StatusCancelling}, + {[]Status{StatusCancelling, StatusWaiting}, StatusCancelling}, + {[]Status{StatusCancelling, StatusFailure}, StatusCancelling}, + {[]Status{StatusCancelling, StatusSkipped}, StatusCancelling}, // failure with other status, usually fail fast, but "running" wins to match GitHub's behavior // another reason that we can't make "failure" wins over "running": it would cause a weird behavior that user cannot cancel a workflow or get current running workflows correctly by filter after a job fail. @@ -64,9 +73,10 @@ func TestAggregateJobStatus(t *testing.T) { {[]Status{StatusFailure, StatusSuccess}, StatusFailure}, {[]Status{StatusFailure, StatusSkipped}, StatusFailure}, {[]Status{StatusFailure, StatusCancelled}, StatusCancelled}, + {[]Status{StatusFailure, StatusCancelling}, StatusCancelling}, {[]Status{StatusFailure, StatusWaiting}, StatusWaiting}, {[]Status{StatusFailure, StatusRunning}, StatusRunning}, - {[]Status{StatusFailure, StatusBlocked}, StatusFailure}, + {[]Status{StatusFailure, StatusBlocked}, StatusBlocked}, // skipped with other status // "all skipped" is also considered as "mergeable" by "services/actions.toCommitStatus", the same as GitHub @@ -74,6 +84,7 @@ func TestAggregateJobStatus(t *testing.T) { {[]Status{StatusSkipped, StatusSuccess}, StatusSuccess}, {[]Status{StatusSkipped, StatusFailure}, StatusFailure}, {[]Status{StatusSkipped, StatusCancelled}, StatusCancelled}, + {[]Status{StatusSkipped, StatusCancelling}, StatusCancelling}, {[]Status{StatusSkipped, StatusWaiting}, StatusWaiting}, {[]Status{StatusSkipped, StatusRunning}, StatusRunning}, {[]Status{StatusSkipped, StatusBlocked}, StatusBlocked}, diff --git a/models/actions/run_job_test.go b/models/actions/run_job_test.go new file mode 100644 index 00000000000..a9e07ce0cf0 --- /dev/null +++ b/models/actions/run_job_test.go @@ -0,0 +1,133 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package actions + +import ( + "testing" + + "gitea.dev/models/db" + "gitea.dev/models/unittest" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestGetPriorAttemptChildrenByParent(t *testing.T) { + require.NoError(t, unittest.PrepareTestDatabase()) + ctx := t.Context() + + // 3 attempts of one run: + // 1: caller expanded with 3 matrix instances of "work" + non-matrix sibling "summary". + // 2: caller skipped, no children rows. + // 3: placeholder "current" attempt for the walkback subtest. + + run := &ActionRun{ + Title: "prior-children-test", + RepoID: 4, + Index: 9501, + OwnerID: 1, + WorkflowID: "matrix.yaml", + TriggerUserID: 1, + Ref: "refs/heads/master", + CommitSHA: "c2d72f548424103f01ee1dc02889c1e2bff816b0", + Event: "push", + TriggerEvent: "push", + EventPayload: "{}", + Status: StatusSuccess, + } + require.NoError(t, db.Insert(ctx, run)) + + const callerAttemptJobID int64 = 9001 + insertAttempt := func(t *testing.T, num int64, status Status) *ActionRunAttempt { + t.Helper() + a := &ActionRunAttempt{ + RepoID: run.RepoID, + RunID: run.ID, + Attempt: num, + TriggerUserID: 1, + Status: status, + } + require.NoError(t, db.Insert(ctx, a)) + return a + } + insertCaller := func(t *testing.T, attemptID int64, status Status, expanded bool) *ActionRunJob { + t.Helper() + caller := &ActionRunJob{ + RunID: run.ID, + RunAttemptID: attemptID, + RepoID: run.RepoID, + OwnerID: run.OwnerID, + CommitSHA: run.CommitSHA, + Name: "caller", + JobID: "caller", + Attempt: 1, + Status: status, + AttemptJobID: callerAttemptJobID, + IsReusableCaller: true, + IsExpanded: expanded, + } + require.NoError(t, db.Insert(ctx, caller)) + return caller + } + insertChild := func(t *testing.T, attemptID, parentID, attemptJobID int64, name, jobID string) { + t.Helper() + require.NoError(t, db.Insert(ctx, &ActionRunJob{ + RunID: run.ID, + RunAttemptID: attemptID, + RepoID: run.RepoID, + OwnerID: run.OwnerID, + CommitSHA: run.CommitSHA, + Name: name, + JobID: jobID, + Attempt: 1, + Status: StatusSuccess, + AttemptJobID: attemptJobID, + ParentJobID: parentID, + })) + } + + attempt1 := insertAttempt(t, 1, StatusSuccess) + caller1 := insertCaller(t, attempt1.ID, StatusSuccess, true) + insertChild(t, attempt1.ID, caller1.ID, 101, "work (alpha)", "work") + insertChild(t, attempt1.ID, caller1.ID, 102, "work (beta)", "work") + insertChild(t, attempt1.ID, caller1.ID, 103, "work (gamma)", "work") + insertChild(t, attempt1.ID, caller1.ID, 104, "summary", "summary") + + attempt2 := insertAttempt(t, 2, StatusSkipped) + insertCaller(t, attempt2.ID, StatusSkipped, false) // no children intentionally + + // both subtests expect attempt 1's expansion, differing only in the "current" attempt id + assertAttempt1Children := func(t *testing.T, out map[string]map[string]*ActionRunJob) { + t.Helper() + // outer map keyed by JobID: "work" has 3 matrix instances, "summary" 1 + assert.Len(t, out, 2) + assert.Len(t, out["work"], 3, "matrix instances must each get their own inner-map entry") + assert.Len(t, out["summary"], 1) + + require.NotNil(t, out["work"]["work (alpha)"]) + require.NotNil(t, out["work"]["work (beta)"]) + require.NotNil(t, out["work"]["work (gamma)"]) + require.NotNil(t, out["summary"]["summary"]) + + assert.Equal(t, int64(101), out["work"]["work (alpha)"].AttemptJobID) + assert.Equal(t, int64(102), out["work"]["work (beta)"].AttemptJobID) + assert.Equal(t, int64(103), out["work"]["work (gamma)"].AttemptJobID) + assert.Equal(t, int64(104), out["summary"]["summary"].AttemptJobID) + } + + t.Run("matrix instances and non-matrix sibling are indexed by (JobID, Name)", func(t *testing.T) { + // "current" = attempt 2; prior = attempt 1, which is the immediately preceding attempt. + out, err := GetPriorAttemptChildrenByParent(ctx, run.ID, attempt2.ID, callerAttemptJobID) + require.NoError(t, err) + assertAttempt1Children(t, out) + }) + + t.Run("walkback past an attempt where the caller had no children", func(t *testing.T) { + attempt3 := insertAttempt(t, 3, StatusRunning) + // "current" = attempt 3; the immediately preceding attempt 2 has no children, so the lookup must walk further back to attempt 1. + out, err := GetPriorAttemptChildrenByParent(ctx, run.ID, attempt3.ID, callerAttemptJobID) + require.NoError(t, err) + assertAttempt1Children(t, out) + }) +} diff --git a/models/actions/run_list.go b/models/actions/run_list.go index 0a0840648da..77de6a85127 100644 --- a/models/actions/run_list.go +++ b/models/actions/run_list.go @@ -6,12 +6,12 @@ package actions import ( "context" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/translation" - webhook_module "code.gitea.io/gitea/modules/webhook" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/translation" + webhook_module "gitea.dev/modules/webhook" "xorm.io/builder" ) @@ -121,8 +121,8 @@ type StatusInfo struct { // GetStatusInfoList returns a slice of StatusInfo func GetStatusInfoList(ctx context.Context, lang translation.Locale) []StatusInfo { // same as those in aggregateJobStatus - allStatus := []Status{StatusSuccess, StatusFailure, StatusWaiting, StatusRunning} - statusInfoList := make([]StatusInfo, 0, 4) + allStatus := []Status{StatusSuccess, StatusFailure, StatusWaiting, StatusRunning, StatusCancelling} + statusInfoList := make([]StatusInfo, 0, len(allStatus)) for _, s := range allStatus { statusInfoList = append(statusInfoList, StatusInfo{ Status: int(s), @@ -132,6 +132,32 @@ func GetStatusInfoList(ctx context.Context, lang translation.Locale) []StatusInf return statusInfoList } +// GetRunBranches returns branch names for the run-list "Branch" filter. +// Sourced from the `branch` table (indexed by repo_id) rather than DISTINCT-ing +// `action_run.ref`, which is wildcard-matched and slow on large repos; as a side +// effect the list reflects existing branches, not only ones that produced a run. +func GetRunBranches(ctx context.Context, repoID int64) ([]string, error) { + branches := make([]string, 0, 10) + return branches, db.GetEngine(ctx).Table("branch"). + Where("repo_id = ?", repoID). + And("is_deleted = ?", false). + Cols("name"). + OrderBy("name ASC"). + Find(&branches) +} + +// GetRunWorkflowIDs returns all distinct WorkflowIDs that have at least +// one ActionRun in the given repo. +func GetRunWorkflowIDs(ctx context.Context, repoID int64) ([]string, error) { + ids := make([]string, 0, 10) + return ids, db.GetEngine(ctx).Table("action_run"). + Where(builder.Eq{"repo_id": repoID}). + Distinct("workflow_id"). + Cols("workflow_id"). + Asc("workflow_id"). + Find(&ids) +} + // GetActors returns a slice of Actors func GetActors(ctx context.Context, repoID int64) ([]*user_model.User, error) { actors := make([]*user_model.User, 0, 10) diff --git a/models/actions/run_list_test.go b/models/actions/run_list_test.go new file mode 100644 index 00000000000..70d8dd91b1b --- /dev/null +++ b/models/actions/run_list_test.go @@ -0,0 +1,24 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package actions + +import ( + "testing" + + "gitea.dev/models/unittest" + + "github.com/stretchr/testify/assert" +) + +func TestGetRunWorkflowIDs(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + + ids, err := GetRunWorkflowIDs(t.Context(), 4) + assert.NoError(t, err) + assert.Equal(t, []string{"artifact.yaml", "test.yaml"}, ids) + + ids, err = GetRunWorkflowIDs(t.Context(), 999999) + assert.NoError(t, err) + assert.Empty(t, ids) +} diff --git a/models/actions/run_test.go b/models/actions/run_test.go index e82cbe84b51..356ed28a74e 100644 --- a/models/actions/run_test.go +++ b/models/actions/run_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) @@ -29,8 +29,7 @@ func TestUpdateRepoRunsNumbers(t *testing.T) { assert.Equal(t, 2, repo.NumClosedActionRuns) // now update will correct them, only num_actionr_runs and num_closed_action_runs should be updated - err = UpdateRepoRunsNumbers(t.Context(), repo) - assert.NoError(t, err) + UpdateRepoRunsNumbers(t.Context(), repo.ID) repo = unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 4}) assert.Equal(t, 4, repo.NumActionRuns) assert.Equal(t, 3, repo.NumClosedActionRuns) diff --git a/models/actions/runner.go b/models/actions/runner.go index f0088491bb5..ba2b38ee7e9 100644 --- a/models/actions/runner.go +++ b/models/actions/runner.go @@ -10,18 +10,18 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/shared/types" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/translation" - "code.gitea.io/gitea/modules/util" + runnerv1 "gitea.dev/actions-proto-go/runner/v1" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/shared/types" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/optional" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/translation" + "gitea.dev/modules/util" - runnerv1 "code.gitea.io/actions-proto-go/runner/v1" "xorm.io/builder" ) @@ -64,6 +64,8 @@ type ActionRunner struct { Ephemeral bool `xorm:"ephemeral NOT NULL DEFAULT false"` // Store if this runner is disabled and should not pick up new jobs IsDisabled bool `xorm:"is_disabled NOT NULL DEFAULT false"` + // Store if this runner supports the StatusCancelling flow + HasCancellingSupport bool `xorm:"has_cancelling_support NOT NULL DEFAULT false"` Created timeutil.TimeStamp `xorm:"created"` Updated timeutil.TimeStamp `xorm:"updated"` diff --git a/models/actions/runner_list.go b/models/actions/runner_list.go index 3ef8ebb2545..1bd714c66fd 100644 --- a/models/actions/runner_list.go +++ b/models/actions/runner_list.go @@ -6,10 +6,10 @@ package actions import ( "context" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" ) type RunnerList []*ActionRunner diff --git a/models/actions/runner_token.go b/models/actions/runner_token.go index f7b7c9fdf0b..0945ce3d489 100644 --- a/models/actions/runner_token.go +++ b/models/actions/runner_token.go @@ -7,11 +7,11 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" ) // ActionRunnerToken represents runner tokens diff --git a/models/actions/runner_token_test.go b/models/actions/runner_token_test.go index 243d6716a00..d95a530f101 100644 --- a/models/actions/runner_token_test.go +++ b/models/actions/runner_token_test.go @@ -6,7 +6,7 @@ package actions import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/actions/schedule.go b/models/actions/schedule.go index ffde5092e0f..031ea8350d0 100644 --- a/models/actions/schedule.go +++ b/models/actions/schedule.go @@ -8,12 +8,12 @@ import ( "fmt" "time" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" - webhook_module "code.gitea.io/gitea/modules/webhook" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" + webhook_module "gitea.dev/modules/webhook" ) // ActionSchedule represents a schedule of a workflow file diff --git a/models/actions/schedule_list.go b/models/actions/schedule_list.go index 6b5cae94fe9..549bbf17441 100644 --- a/models/actions/schedule_list.go +++ b/models/actions/schedule_list.go @@ -4,7 +4,7 @@ package actions import ( - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" "xorm.io/builder" ) diff --git a/models/actions/schedule_spec.go b/models/actions/schedule_spec.go index 923e5f78077..3e127cec8c8 100644 --- a/models/actions/schedule_spec.go +++ b/models/actions/schedule_spec.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/timeutil" "github.com/robfig/cron/v3" ) diff --git a/models/actions/schedule_spec_list.go b/models/actions/schedule_spec_list.go index e26b2c11206..81994471f02 100644 --- a/models/actions/schedule_spec_list.go +++ b/models/actions/schedule_spec_list.go @@ -6,9 +6,9 @@ package actions import ( "context" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/container" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/container" "xorm.io/builder" ) diff --git a/models/actions/schedule_spec_test.go b/models/actions/schedule_spec_test.go index 57221461dfe..3b2cfd087bc 100644 --- a/models/actions/schedule_spec_test.go +++ b/models/actions/schedule_spec_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "code.gitea.io/gitea/modules/test" + "gitea.dev/modules/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/actions/status.go b/models/actions/status.go index 2b1d70613c7..22ea0d1555b 100644 --- a/models/actions/status.go +++ b/models/actions/status.go @@ -6,34 +6,35 @@ package actions import ( "slices" - "code.gitea.io/gitea/modules/translation" - - runnerv1 "code.gitea.io/actions-proto-go/runner/v1" + runnerv1 "gitea.dev/actions-proto-go/runner/v1" + "gitea.dev/modules/translation" ) // Status represents the status of ActionRun, ActionRunJob, ActionTask, or ActionTaskStep type Status int const ( - StatusUnknown Status = iota // 0, consistent with runnerv1.Result_RESULT_UNSPECIFIED - StatusSuccess // 1, consistent with runnerv1.Result_RESULT_SUCCESS - StatusFailure // 2, consistent with runnerv1.Result_RESULT_FAILURE - StatusCancelled // 3, consistent with runnerv1.Result_RESULT_CANCELLED - StatusSkipped // 4, consistent with runnerv1.Result_RESULT_SKIPPED - StatusWaiting // 5, isn't a runnerv1.Result - StatusRunning // 6, isn't a runnerv1.Result - StatusBlocked // 7, isn't a runnerv1.Result + StatusUnknown Status = iota // 0, consistent with runnerv1.Result_RESULT_UNSPECIFIED + StatusSuccess // 1, consistent with runnerv1.Result_RESULT_SUCCESS + StatusFailure // 2, consistent with runnerv1.Result_RESULT_FAILURE + StatusCancelled // 3, consistent with runnerv1.Result_RESULT_CANCELLED + StatusSkipped // 4, consistent with runnerv1.Result_RESULT_SKIPPED + StatusWaiting // 5, isn't a runnerv1.Result + StatusRunning // 6, isn't a runnerv1.Result + StatusBlocked // 7, isn't a runnerv1.Result + StatusCancelling // 8, isn't a runnerv1.Result ) var statusNames = map[Status]string{ - StatusUnknown: "unknown", - StatusWaiting: "waiting", - StatusRunning: "running", - StatusSuccess: "success", - StatusFailure: "failure", - StatusCancelled: "cancelled", - StatusSkipped: "skipped", - StatusBlocked: "blocked", + StatusUnknown: "unknown", + StatusWaiting: "waiting", + StatusRunning: "running", + StatusSuccess: "success", + StatusFailure: "failure", + StatusCancelled: "cancelled", + StatusCancelling: "cancelling", + StatusSkipped: "skipped", + StatusBlocked: "blocked", } // String returns the string name of the Status @@ -88,14 +89,41 @@ func (s Status) IsBlocked() bool { return s == StatusBlocked } +func (s Status) IsCancelling() bool { + return s == StatusCancelling +} + // In returns whether s is one of the given statuses func (s Status) In(statuses ...Status) bool { return slices.Contains(statuses, s) } func (s Status) AsResult() runnerv1.Result { - if s.IsDone() { - return runnerv1.Result(s) + switch s { + case StatusSuccess: + return runnerv1.Result_RESULT_SUCCESS + case StatusFailure: + return runnerv1.Result_RESULT_FAILURE + case StatusCancelled, StatusCancelling: + return runnerv1.Result_RESULT_CANCELLED + case StatusSkipped: + return runnerv1.Result_RESULT_SKIPPED + default: + return runnerv1.Result_RESULT_UNSPECIFIED + } +} + +func StatusFromResult(r runnerv1.Result) Status { + switch r { + case runnerv1.Result_RESULT_SUCCESS: + return StatusSuccess + case runnerv1.Result_RESULT_FAILURE: + return StatusFailure + case runnerv1.Result_RESULT_CANCELLED: + return StatusCancelled + case runnerv1.Result_RESULT_SKIPPED: + return StatusSkipped + default: + return StatusUnknown } - return runnerv1.Result_RESULT_UNSPECIFIED } diff --git a/models/actions/status_test.go b/models/actions/status_test.go new file mode 100644 index 00000000000..f1551b28923 --- /dev/null +++ b/models/actions/status_test.go @@ -0,0 +1,50 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package actions + +import ( + "testing" + + runnerv1 "gitea.dev/actions-proto-go/runner/v1" + + "github.com/stretchr/testify/assert" +) + +func TestStatusAsResult(t *testing.T) { + cases := []struct { + status Status + want runnerv1.Result + }{ + {StatusUnknown, runnerv1.Result_RESULT_UNSPECIFIED}, + {StatusWaiting, runnerv1.Result_RESULT_UNSPECIFIED}, + {StatusRunning, runnerv1.Result_RESULT_UNSPECIFIED}, + {StatusBlocked, runnerv1.Result_RESULT_UNSPECIFIED}, + {StatusSuccess, runnerv1.Result_RESULT_SUCCESS}, + {StatusFailure, runnerv1.Result_RESULT_FAILURE}, + {StatusCancelled, runnerv1.Result_RESULT_CANCELLED}, + {StatusCancelling, runnerv1.Result_RESULT_CANCELLED}, + {StatusSkipped, runnerv1.Result_RESULT_SKIPPED}, + } + + for _, tt := range cases { + assert.Equal(t, tt.want, tt.status.AsResult(), "status=%s", tt.status) + } +} + +func TestStatusFromResult(t *testing.T) { + cases := []struct { + result runnerv1.Result + want Status + }{ + {runnerv1.Result_RESULT_UNSPECIFIED, StatusUnknown}, + {runnerv1.Result_RESULT_SUCCESS, StatusSuccess}, + {runnerv1.Result_RESULT_FAILURE, StatusFailure}, + {runnerv1.Result_RESULT_CANCELLED, StatusCancelled}, + {runnerv1.Result_RESULT_SKIPPED, StatusSkipped}, + } + + for _, tt := range cases { + assert.Equal(t, tt.want, StatusFromResult(tt.result), "result=%s", tt.result) + } +} diff --git a/models/actions/task.go b/models/actions/task.go index 7a97eadc798..36318c878aa 100644 --- a/models/actions/task.go +++ b/models/actions/task.go @@ -11,16 +11,16 @@ import ( "strings" "time" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unit" - "code.gitea.io/gitea/modules/actions/jobparser" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + runnerv1 "gitea.dev/actions-proto-go/runner/v1" + auth_model "gitea.dev/models/auth" + "gitea.dev/models/db" + "gitea.dev/models/unit" + "gitea.dev/modules/actions/jobparser" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" - runnerv1 "code.gitea.io/actions-proto-go/runner/v1" lru "github.com/hashicorp/golang-lru/v2" "google.golang.org/protobuf/types/known/timestamppb" "xorm.io/builder" @@ -193,7 +193,8 @@ func GetRunningTaskByToken(ctx context.Context, token string) (*ActionTask, erro } var tasks []*ActionTask - err := db.GetEngine(ctx).Where("token_last_eight = ? AND status = ?", lastEight, StatusRunning).Find(&tasks) + // Cancelling tasks are still authenticating — post-run cleanup steps need API access (artifact uploads, cache saves, etc.) before the runner finalizes the task. + err := db.GetEngine(ctx).Where("token_last_eight = ? AND status IN (?, ?)", lastEight, StatusRunning, StatusCancelling).Find(&tasks) if err != nil { return nil, err } else if len(tasks) == 0 { @@ -248,7 +249,7 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask } var jobs []*ActionRunJob - if err := e.Where("task_id=? AND status=?", 0, StatusWaiting).And(jobCond).Asc("updated", "id").Find(&jobs); err != nil { + if err := e.Where("task_id=? AND status=? AND is_reusable_caller=?", 0, StatusWaiting, false).And(jobCond).Asc("updated", "id").Find(&jobs); err != nil { return nil, false, err } @@ -374,7 +375,12 @@ func UpdateTaskByState(ctx context.Context, runnerID int64, state *runnerv1.Task // state.Result is not unspecified means the task is finished if state.Result != runnerv1.Result_RESULT_UNSPECIFIED { - task.Status = Status(state.Result) + if task.Status == StatusCancelling { + // The runner may report SUCCESS/FAILURE for the cleanup phase; preserve user intent. + task.Status = StatusCancelled + } else { + task.Status = StatusFromResult(state.Result) + } task.Stopped = timeutil.TimeStamp(state.StoppedAt.AsTime().Unix()) if err := UpdateTask(ctx, task, "status", "stopped"); err != nil { return nil, err @@ -384,7 +390,7 @@ func UpdateTaskByState(ctx context.Context, runnerID int64, state *runnerv1.Task RepoID: task.RepoID, Status: task.Status, Stopped: task.Stopped, - }, nil); err != nil { + }, nil, "status", "stopped"); err != nil { return nil, err } } else { @@ -409,7 +415,7 @@ func UpdateTaskByState(ctx context.Context, runnerID int64, state *runnerv1.Task step.Stopped = convertTimestamp(v.StoppedAt) } if result != runnerv1.Result_RESULT_UNSPECIFIED { - step.Status = Status(result) + step.Status = StatusFromResult(result) } else if step.Started != 0 { step.Status = StatusRunning } @@ -423,7 +429,7 @@ func UpdateTaskByState(ctx context.Context, runnerID int64, state *runnerv1.Task } func StopTask(ctx context.Context, taskID int64, status Status) error { - if !status.IsDone() { + if !status.IsDone() && status != StatusCancelling { return fmt.Errorf("cannot stop task with status %v", status) } e := db.GetEngine(ctx) @@ -439,6 +445,32 @@ func StopTask(ctx context.Context, taskID int64, status Status) error { } now := timeutil.TimeStampNow() + if status == StatusCancelling { + runner, err := GetRunnerByID(ctx, task.RunnerID) + if err != nil { + if !errors.Is(err, util.ErrNotExist) { + return err + } + status = StatusCancelled + } else if !runner.HasCancellingSupport { + status = StatusCancelled + } + } + + if status == StatusCancelling { + task.Status = StatusCancelling + + if _, err := UpdateRunJob(ctx, &ActionRunJob{ + ID: task.JobID, + RepoID: task.RepoID, + Status: StatusCancelling, + }, nil, "status"); err != nil { + return err + } + + return UpdateTask(ctx, task, "status") + } + task.Status = status task.Stopped = now if _, err := UpdateRunJob(ctx, &ActionRunJob{ diff --git a/models/actions/task_list.go b/models/actions/task_list.go index 0c803978994..5df0f3bfa58 100644 --- a/models/actions/task_list.go +++ b/models/actions/task_list.go @@ -6,9 +6,9 @@ package actions import ( "context" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/container" + "gitea.dev/modules/timeutil" "xorm.io/builder" ) diff --git a/models/actions/task_output.go b/models/actions/task_output.go index eab5b931183..36cc77e6d19 100644 --- a/models/actions/task_output.go +++ b/models/actions/task_output.go @@ -6,7 +6,7 @@ package actions import ( "context" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" ) // ActionTaskOutput represents an output of ActionTask. diff --git a/models/actions/task_step.go b/models/actions/task_step.go index 3b477d8483c..598b9adb1ae 100644 --- a/models/actions/task_step.go +++ b/models/actions/task_step.go @@ -7,8 +7,8 @@ import ( "context" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) // ActionTaskStep represents a step of ActionTask diff --git a/models/actions/task_test.go b/models/actions/task_test.go index cbfc6f7636b..fe4436ec635 100644 --- a/models/actions/task_test.go +++ b/models/actions/task_test.go @@ -7,9 +7,15 @@ import ( "strings" "testing" - "code.gitea.io/gitea/modules/actions/jobparser" + runnerv1 "gitea.dev/actions-proto-go/runner/v1" + "gitea.dev/models/db" + "gitea.dev/models/unittest" + "gitea.dev/modules/actions/jobparser" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "google.golang.org/protobuf/types/known/timestamppb" ) func TestMakeTaskStepDisplayName(t *testing.T) { @@ -75,3 +81,228 @@ func TestMakeTaskStepDisplayName(t *testing.T) { }) } } + +func TestTaskCancellingFinalizesToCancelled(t *testing.T) { + newRunningTask := func(t *testing.T) (*ActionTask, *ActionRunJob) { + t.Helper() + + run := &ActionRun{ + Title: "cancelling-test-run", + RepoID: 1, + OwnerID: 2, + WorkflowID: "test.yaml", + Index: 999, + TriggerUserID: 2, + Ref: "refs/heads/master", + CommitSHA: "c2d72f548424103f01ee1dc02889c1e2bff816b0", + Event: "push", + TriggerEvent: "push", + Status: StatusRunning, + Started: timeutil.TimeStampNow(), + } + require.NoError(t, db.Insert(t.Context(), run)) + + job := &ActionRunJob{ + RunID: run.ID, + RepoID: run.RepoID, + OwnerID: run.OwnerID, + CommitSHA: run.CommitSHA, + Name: "cancelling-finalization-job", + Attempt: 1, + JobID: "cancelling-finalization-job", + Status: StatusRunning, + } + require.NoError(t, db.Insert(t.Context(), job)) + + runner := &ActionRunner{ + UUID: "runner-cancelling-supported", + Name: "runner-cancelling-supported", + HasCancellingSupport: true, + } + require.NoError(t, db.Insert(t.Context(), runner)) + + task := &ActionTask{ + JobID: job.ID, + Attempt: 1, + RunnerID: runner.ID, + Status: StatusRunning, + Started: timeutil.TimeStampNow(), + RepoID: run.RepoID, + OwnerID: run.OwnerID, + CommitSHA: run.CommitSHA, + } + require.NoError(t, db.Insert(t.Context(), task)) + + job.TaskID = task.ID + _, err := UpdateRunJob(t.Context(), job, nil, "task_id") + require.NoError(t, err) + + return task, job + } + + testResult := func(t *testing.T, result runnerv1.Result) { + t.Helper() + require.NoError(t, unittest.PrepareTestDatabase()) + + task, job := newRunningTask(t) + require.NoError(t, StopTask(t.Context(), task.ID, StatusCancelling)) + + taskAfterStop := unittest.AssertExistsAndLoadBean(t, &ActionTask{ID: task.ID}) + assert.Equal(t, StatusCancelling, taskAfterStop.Status) + + updatedTask, err := UpdateTaskByState(t.Context(), task.RunnerID, &runnerv1.TaskState{ + Id: task.ID, + Result: result, + StoppedAt: timestamppb.Now(), + }) + require.NoError(t, err) + assert.Equal(t, StatusCancelled, updatedTask.Status) + + taskAfterUpdate := unittest.AssertExistsAndLoadBean(t, &ActionTask{ID: task.ID}) + assert.Equal(t, StatusCancelled, taskAfterUpdate.Status) + + jobAfterUpdate := unittest.AssertExistsAndLoadBean(t, &ActionRunJob{ID: job.ID}) + assert.Equal(t, StatusCancelled, jobAfterUpdate.Status) + } + + t.Run("runner reports success", func(t *testing.T) { + testResult(t, runnerv1.Result_RESULT_SUCCESS) + }) + + t.Run("runner reports failure", func(t *testing.T) { + testResult(t, runnerv1.Result_RESULT_FAILURE) + }) +} + +func TestStopTaskCancellingFallsBackForLegacyRunner(t *testing.T) { + require.NoError(t, unittest.PrepareTestDatabase()) + + run := &ActionRun{ + Title: "cancelling-test-run", + RepoID: 1, + OwnerID: 2, + WorkflowID: "test.yaml", + Index: 999, + TriggerUserID: 2, + Ref: "refs/heads/master", + CommitSHA: "c2d72f548424103f01ee1dc02889c1e2bff816b0", + Event: "push", + TriggerEvent: "push", + Status: StatusRunning, + Started: timeutil.TimeStampNow(), + } + require.NoError(t, db.Insert(t.Context(), run)) + + job := &ActionRunJob{ + RunID: run.ID, + RepoID: run.RepoID, + OwnerID: run.OwnerID, + CommitSHA: run.CommitSHA, + Name: "legacy-cancelling-job", + Attempt: 1, + JobID: "legacy-cancelling-job", + Status: StatusRunning, + } + require.NoError(t, db.Insert(t.Context(), job)) + + runner := &ActionRunner{ + UUID: "runner-legacy-no-cancelling", + Name: "runner-legacy-no-cancelling", + HasCancellingSupport: false, + } + require.NoError(t, db.Insert(t.Context(), runner)) + + task := &ActionTask{ + JobID: job.ID, + Attempt: 1, + RunnerID: runner.ID, + Status: StatusRunning, + Started: timeutil.TimeStampNow(), + RepoID: run.RepoID, + OwnerID: run.OwnerID, + CommitSHA: run.CommitSHA, + } + require.NoError(t, db.Insert(t.Context(), task)) + + job.TaskID = task.ID + _, err := UpdateRunJob(t.Context(), job, nil, "task_id") + require.NoError(t, err) + + require.NoError(t, StopTask(t.Context(), task.ID, StatusCancelling)) + + taskAfterStop := unittest.AssertExistsAndLoadBean(t, &ActionTask{ID: task.ID}) + assert.Equal(t, StatusCancelled, taskAfterStop.Status) + assert.NotZero(t, taskAfterStop.Stopped) + + jobAfterStop := unittest.AssertExistsAndLoadBean(t, &ActionRunJob{ID: job.ID}) + assert.Equal(t, StatusCancelled, jobAfterStop.Status) + assert.NotZero(t, jobAfterStop.Stopped) +} + +func TestStopTaskCancellingFallsBackForMissingRunner(t *testing.T) { + require.NoError(t, unittest.PrepareTestDatabase()) + + run := &ActionRun{ + Title: "cancelling-test-run", + RepoID: 1, + OwnerID: 2, + WorkflowID: "test.yaml", + Index: 999, + TriggerUserID: 2, + Ref: "refs/heads/master", + CommitSHA: "c2d72f548424103f01ee1dc02889c1e2bff816b0", + Event: "push", + TriggerEvent: "push", + Status: StatusRunning, + Started: timeutil.TimeStampNow(), + } + require.NoError(t, db.Insert(t.Context(), run)) + + job := &ActionRunJob{ + RunID: run.ID, + RepoID: run.RepoID, + OwnerID: run.OwnerID, + CommitSHA: run.CommitSHA, + Name: "missing-runner-cancelling-job", + Attempt: 1, + JobID: "missing-runner-cancelling-job", + Status: StatusRunning, + } + require.NoError(t, db.Insert(t.Context(), job)) + + runner := &ActionRunner{ + UUID: "runner-cleaned-up-before-cancel", + Name: "runner-cleaned-up-before-cancel", + HasCancellingSupport: true, + } + require.NoError(t, db.Insert(t.Context(), runner)) + + task := &ActionTask{ + JobID: job.ID, + Attempt: 1, + RunnerID: runner.ID, + Status: StatusRunning, + Started: timeutil.TimeStampNow(), + RepoID: run.RepoID, + OwnerID: run.OwnerID, + CommitSHA: run.CommitSHA, + } + require.NoError(t, db.Insert(t.Context(), task)) + + job.TaskID = task.ID + _, err := UpdateRunJob(t.Context(), job, nil, "task_id") + require.NoError(t, err) + + _, err = db.DeleteByID[ActionRunner](t.Context(), runner.ID) + require.NoError(t, err) + + require.NoError(t, StopTask(t.Context(), task.ID, StatusCancelling)) + + taskAfterStop := unittest.AssertExistsAndLoadBean(t, &ActionTask{ID: task.ID}) + assert.Equal(t, StatusCancelled, taskAfterStop.Status) + assert.NotZero(t, taskAfterStop.Stopped) + + jobAfterStop := unittest.AssertExistsAndLoadBean(t, &ActionRunJob{ID: job.ID}) + assert.Equal(t, StatusCancelled, jobAfterStop.Status) + assert.NotZero(t, jobAfterStop.Stopped) +} diff --git a/models/actions/tasks_version.go b/models/actions/tasks_version.go index b686ce24431..c8fd0db36b1 100644 --- a/models/actions/tasks_version.go +++ b/models/actions/tasks_version.go @@ -6,9 +6,9 @@ package actions import ( "context" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" ) // ActionTasksVersion diff --git a/models/actions/token_permissions.go b/models/actions/token_permissions.go index 985f6cc97be..f77ce48878a 100644 --- a/models/actions/token_permissions.go +++ b/models/actions/token_permissions.go @@ -6,8 +6,8 @@ package actions import ( "context" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" ) // ComputeTaskTokenPermissions computes the effective permissions for a job token against the target repository. diff --git a/models/actions/utils.go b/models/actions/utils.go index e5704d0377d..25b6532972b 100644 --- a/models/actions/utils.go +++ b/models/actions/utils.go @@ -12,10 +12,10 @@ import ( "io" "time" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + auth_model "gitea.dev/models/auth" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" ) func generateSaltedToken() (string, string, string, string) { diff --git a/models/actions/utils_test.go b/models/actions/utils_test.go index 2f7e7da3607..c83173e81ea 100644 --- a/models/actions/utils_test.go +++ b/models/actions/utils_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/actions/variable.go b/models/actions/variable.go index 7154843c170..839b8129ad3 100644 --- a/models/actions/variable.go +++ b/models/actions/variable.go @@ -8,10 +8,10 @@ import ( "strings" "unicode/utf8" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/activities/action.go b/models/activities/action.go index 4ffdca842a4..a666c31c270 100644 --- a/models/activities/action.go +++ b/models/activities/action.go @@ -14,17 +14,17 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/organization" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/organization" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/git" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" "xorm.io/xorm/schemas" @@ -436,6 +436,12 @@ type GetFeedsOptions struct { DontCount bool // do counting in GetFeeds } +func (opts *GetFeedsOptions) ApplyPublicOnly(publicOnly bool) { + if publicOnly { + opts.IncludePrivate = false + } +} + // ActivityReadable return whether doer can read activities of user func ActivityReadable(user, doer *user_model.User) bool { return !user.KeepActivityPrivate || diff --git a/models/activities/action_list.go b/models/activities/action_list.go index 5b07a8e080a..f1c617f5942 100644 --- a/models/activities/action_list.go +++ b/models/activities/action_list.go @@ -9,12 +9,12 @@ import ( "fmt" "strconv" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -242,7 +242,7 @@ func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, int64, err if opts.Page < 10 { // TODO: why it's 10 but other values? It's an experience value. sess := db.GetEngine(ctx).Where(cond) - sess = db.SetSessionPagination(sess, &opts) + db.SetSessionPagination(sess, &opts) if opts.DontCount { err = sess.Desc("`action`.created_unix").Find(&actions) @@ -255,7 +255,7 @@ func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, int64, err } else { // First, only query which IDs are necessary, and only then query all actions to speed up the overall query sess := db.GetEngine(ctx).Where(cond).Select("`action`.id") - sess = db.SetSessionPagination(sess, &opts) + db.SetSessionPagination(sess, &opts) actionIDs := make([]int64, 0, opts.PageSize) if err := sess.Table("action").Desc("`action`.created_unix").Find(&actionIDs); err != nil { diff --git a/models/activities/action_test.go b/models/activities/action_test.go index 9447f39d62a..0a60cd9c781 100644 --- a/models/activities/action_test.go +++ b/models/activities/action_test.go @@ -8,14 +8,14 @@ import ( "path" "testing" - activities_model "code.gitea.io/gitea/models/activities" - "code.gitea.io/gitea/models/db" - issue_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/test" + activities_model "gitea.dev/models/activities" + "gitea.dev/models/db" + issue_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/test" "github.com/stretchr/testify/assert" ) diff --git a/models/activities/main_test.go b/models/activities/main_test.go index 43afb84ef15..5b64a455fef 100644 --- a/models/activities/main_test.go +++ b/models/activities/main_test.go @@ -6,10 +6,10 @@ package activities_test import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" - _ "code.gitea.io/gitea/models" - _ "code.gitea.io/gitea/models/actions" + _ "gitea.dev/models" + _ "gitea.dev/models/actions" ) func TestMain(m *testing.M) { diff --git a/models/activities/notification.go b/models/activities/notification.go index 8a830c5aa26..c786811fcd2 100644 --- a/models/activities/notification.go +++ b/models/activities/notification.go @@ -9,13 +9,13 @@ import ( "net/url" "strconv" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/organization" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/organization" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" "xorm.io/builder" "xorm.io/xorm/schemas" diff --git a/models/activities/notification_list.go b/models/activities/notification_list.go index d38758bc41a..70bf6811bce 100644 --- a/models/activities/notification_list.go +++ b/models/activities/notification_list.go @@ -6,15 +6,15 @@ package activities import ( "context" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - access_model "code.gitea.io/gitea/models/perm/access" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + access_model "gitea.dev/models/perm/access" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/log" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/activities/notification_test.go b/models/activities/notification_test.go index 6f2253c815d..eaf96bf31eb 100644 --- a/models/activities/notification_test.go +++ b/models/activities/notification_test.go @@ -7,11 +7,11 @@ import ( "context" "testing" - activities_model "code.gitea.io/gitea/models/activities" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + activities_model "gitea.dev/models/activities" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) diff --git a/models/activities/repo_activity.go b/models/activities/repo_activity.go index aeaa452c9e9..fd6a1630e51 100644 --- a/models/activities/repo_activity.go +++ b/models/activities/repo_activity.go @@ -9,15 +9,14 @@ import ( "sort" "time" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/gitrepo" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/git" + "gitea.dev/modules/gitrepo" "xorm.io/builder" - "xorm.io/xorm" ) // ActivityAuthorData represents statistical git commit count data @@ -248,7 +247,7 @@ func (stats *ActivityStats) FillPullRequests(ctx context.Context, repoID int64, return nil } -func pullRequestsForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time, merged bool) *xorm.Session { +func pullRequestsForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time, merged bool) db.Session { sess := db.GetEngine(ctx).Where("pull_request.base_repo_id=?", repoID). Join("INNER", "issue", "pull_request.issue_id = issue.id") @@ -324,7 +323,7 @@ func (stats *ActivityStats) FillUnresolvedIssues(ctx context.Context, repoID int return sess.Find(&stats.UnresolvedIssues) } -func newlyCreatedIssues(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session { +func newlyCreatedIssues(ctx context.Context, repoID int64, fromTime time.Time) db.Session { sess := db.GetEngine(ctx).Where("issue.repo_id = ?", repoID). And("issue.is_pull = ?", false). // Retain the is_pull check to exclude pull requests And("issue.created_unix >= ?", fromTime.Unix()) // Include all issues created after fromTime @@ -332,7 +331,7 @@ func newlyCreatedIssues(ctx context.Context, repoID int64, fromTime time.Time) * return sess } -func activeIssues(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session { +func activeIssues(ctx context.Context, repoID int64, fromTime time.Time) db.Session { sess := db.GetEngine(ctx).Where("issue.repo_id = ?", repoID). And("issue.is_pull = ?", false). And(builder.Or( @@ -343,7 +342,7 @@ func activeIssues(ctx context.Context, repoID int64, fromTime time.Time) *xorm.S return sess } -func issuesForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time, closed, unresolved bool) *xorm.Session { +func issuesForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time, closed, unresolved bool) db.Session { sess := db.GetEngine(ctx).Where("issue.repo_id = ?", repoID). And("issue.is_closed = ?", closed) @@ -385,7 +384,7 @@ func (stats *ActivityStats) FillReleases(ctx context.Context, repoID int64, from return nil } -func releasesForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session { +func releasesForActivityStatement(ctx context.Context, repoID int64, fromTime time.Time) db.Session { return db.GetEngine(ctx).Where("`release`.repo_id = ?", repoID). And("`release`.is_draft = ?", false). And("`release`.created_unix >= ?", fromTime.Unix()) diff --git a/models/activities/statistic.go b/models/activities/statistic.go index 940651d3592..087a257a336 100644 --- a/models/activities/statistic.go +++ b/models/activities/statistic.go @@ -6,20 +6,20 @@ package activities import ( "context" - asymkey_model "code.gitea.io/gitea/models/asymkey" - "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" - git_model "code.gitea.io/gitea/models/git" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/organization" - access_model "code.gitea.io/gitea/models/perm/access" - project_model "code.gitea.io/gitea/models/project" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/models/webhook" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/structs" + asymkey_model "gitea.dev/models/asymkey" + "gitea.dev/models/auth" + "gitea.dev/models/db" + git_model "gitea.dev/models/git" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/organization" + access_model "gitea.dev/models/perm/access" + project_model "gitea.dev/models/project" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/models/webhook" + "gitea.dev/modules/optional" + "gitea.dev/modules/setting" + "gitea.dev/modules/structs" ) // Statistic contains the database statistics diff --git a/models/activities/user_heatmap.go b/models/activities/user_heatmap.go index 2d1635917ef..643c86e480b 100644 --- a/models/activities/user_heatmap.go +++ b/models/activities/user_heatmap.go @@ -6,11 +6,11 @@ package activities import ( "context" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/models/organization" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" ) // UserHeatmapData represents the data needed to create a heatmap diff --git a/models/activities/user_heatmap_test.go b/models/activities/user_heatmap_test.go index 66087325b1d..1a8ad7620f6 100644 --- a/models/activities/user_heatmap_test.go +++ b/models/activities/user_heatmap_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" - activities_model "code.gitea.io/gitea/models/activities" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/timeutil" + activities_model "gitea.dev/models/activities" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/json" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) diff --git a/models/admin/task.go b/models/admin/task.go index 5d2b9bbff6f..be02137c906 100644 --- a/models/admin/task.go +++ b/models/admin/task.go @@ -7,17 +7,17 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/migration" - "code.gitea.io/gitea/modules/secret" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/json" + "gitea.dev/modules/log" + "gitea.dev/modules/migration" + "gitea.dev/modules/secret" + "gitea.dev/modules/setting" + "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" ) // Task represents a task @@ -137,6 +137,11 @@ func (task *Task) MigrateConfig() (*migration.MigrateOptions, error) { log.Error("Unable to decrypt AuthToken, maybe SECRET_KEY is wrong: %v", err) } } + if opts.AWSSecretAccessKeyEncrypted != "" { + if opts.AWSSecretAccessKey, err = secret.DecryptSecret(setting.SecretKey, opts.AWSSecretAccessKeyEncrypted); err != nil { + log.Error("Unable to decrypt AWSSecretAccessKey, maybe SECRET_KEY is wrong: %v", err) + } + } return &opts, nil } @@ -201,6 +206,8 @@ func FinishMigrateTask(ctx context.Context, task *Task) error { conf.AuthPasswordEncrypted = "" conf.AuthTokenEncrypted = "" conf.CloneAddrEncrypted = "" + conf.AWSSecretAccessKey = "" + conf.AWSSecretAccessKeyEncrypted = "" confBytes, err := json.Marshal(conf) if err != nil { return err diff --git a/models/asymkey/error.go b/models/asymkey/error.go index 5df7beb8cd7..1a862954a32 100644 --- a/models/asymkey/error.go +++ b/models/asymkey/error.go @@ -6,7 +6,7 @@ package asymkey import ( "fmt" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/util" ) // ErrKeyUnableVerify represents a "KeyUnableVerify" kind of error. diff --git a/models/asymkey/gpg_key.go b/models/asymkey/gpg_key.go index 38de7cbda61..77034eb0892 100644 --- a/models/asymkey/gpg_key.go +++ b/models/asymkey/gpg_key.go @@ -10,9 +10,9 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" "github.com/ProtonMail/go-crypto/openpgp" "github.com/ProtonMail/go-crypto/openpgp/packet" diff --git a/models/asymkey/gpg_key_add.go b/models/asymkey/gpg_key_add.go index 3969edcc869..aa74f66c557 100644 --- a/models/asymkey/gpg_key_add.go +++ b/models/asymkey/gpg_key_add.go @@ -7,8 +7,8 @@ import ( "context" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" + "gitea.dev/models/db" + "gitea.dev/modules/log" "github.com/ProtonMail/go-crypto/openpgp" ) diff --git a/models/asymkey/gpg_key_commit_verification.go b/models/asymkey/gpg_key_commit_verification.go index ae5192de9fd..17244076dd2 100644 --- a/models/asymkey/gpg_key_commit_verification.go +++ b/models/asymkey/gpg_key_commit_verification.go @@ -8,9 +8,9 @@ import ( "fmt" "hash" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/log" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/log" "github.com/ProtonMail/go-crypto/openpgp/packet" ) diff --git a/models/asymkey/gpg_key_import.go b/models/asymkey/gpg_key_import.go index c9d46d29e56..0189f331f8d 100644 --- a/models/asymkey/gpg_key_import.go +++ b/models/asymkey/gpg_key_import.go @@ -6,7 +6,7 @@ package asymkey import ( "context" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" ) // __________________ ________ ____ __. diff --git a/models/asymkey/gpg_key_list.go b/models/asymkey/gpg_key_list.go index 89548e495ec..e7cff4e3fb5 100644 --- a/models/asymkey/gpg_key_list.go +++ b/models/asymkey/gpg_key_list.go @@ -6,7 +6,7 @@ package asymkey import ( "context" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" ) type GPGKeyList []*GPGKey diff --git a/models/asymkey/gpg_key_test.go b/models/asymkey/gpg_key_test.go index e6656cb70d6..5cce164a78f 100644 --- a/models/asymkey/gpg_key_test.go +++ b/models/asymkey/gpg_key_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" "github.com/ProtonMail/go-crypto/openpgp" "github.com/ProtonMail/go-crypto/openpgp/packet" diff --git a/models/asymkey/gpg_key_verify.go b/models/asymkey/gpg_key_verify.go index 5df0265c880..b699a1d3cb2 100644 --- a/models/asymkey/gpg_key_verify.go +++ b/models/asymkey/gpg_key_verify.go @@ -8,10 +8,10 @@ import ( "strconv" "time" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/base" - "code.gitea.io/gitea/modules/log" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/base" + "gitea.dev/modules/log" ) // This file provides functions relating verifying gpg keys diff --git a/models/asymkey/key_display.go b/models/asymkey/key_display.go index ee17553b5b4..0bfba26bac4 100644 --- a/models/asymkey/key_display.go +++ b/models/asymkey/key_display.go @@ -6,9 +6,9 @@ package asymkey import ( "os" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/git" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" ) func GetDisplaySigningKey(key *git.SigningKey) string { diff --git a/models/asymkey/main_test.go b/models/asymkey/main_test.go index be71f848d9d..3c64834e274 100644 --- a/models/asymkey/main_test.go +++ b/models/asymkey/main_test.go @@ -6,7 +6,7 @@ package asymkey import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" ) func TestMain(m *testing.M) { diff --git a/models/asymkey/ssh_key.go b/models/asymkey/ssh_key.go index 1873c30859d..e72a88ae8f6 100644 --- a/models/asymkey/ssh_key.go +++ b/models/asymkey/ssh_key.go @@ -10,14 +10,14 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/perm" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/auth" + "gitea.dev/models/db" + "gitea.dev/models/perm" + user_model "gitea.dev/models/user" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "golang.org/x/crypto/ssh" "xorm.io/builder" diff --git a/models/asymkey/ssh_key_authorized_keys.go b/models/asymkey/ssh_key_authorized_keys.go index cb2943e31df..8eb5d24c82c 100644 --- a/models/asymkey/ssh_key_authorized_keys.go +++ b/models/asymkey/ssh_key_authorized_keys.go @@ -14,10 +14,10 @@ import ( "strings" "sync" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" "golang.org/x/crypto/ssh" ) diff --git a/models/asymkey/ssh_key_authorized_keys_test.go b/models/asymkey/ssh_key_authorized_keys_test.go index 36ed57a6537..0eb4097f85e 100644 --- a/models/asymkey/ssh_key_authorized_keys_test.go +++ b/models/asymkey/ssh_key_authorized_keys_test.go @@ -7,8 +7,8 @@ import ( "strings" "testing" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/test" + "gitea.dev/modules/setting" + "gitea.dev/modules/test" "github.com/stretchr/testify/assert" ) diff --git a/models/asymkey/ssh_key_deploy.go b/models/asymkey/ssh_key_deploy.go index ea3d93e8c81..e7cbc9253eb 100644 --- a/models/asymkey/ssh_key_deploy.go +++ b/models/asymkey/ssh_key_deploy.go @@ -8,9 +8,9 @@ import ( "fmt" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/perm" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/models/perm" + "gitea.dev/modules/timeutil" "xorm.io/builder" ) diff --git a/models/asymkey/ssh_key_fingerprint.go b/models/asymkey/ssh_key_fingerprint.go index b666469ae87..c495275e210 100644 --- a/models/asymkey/ssh_key_fingerprint.go +++ b/models/asymkey/ssh_key_fingerprint.go @@ -7,7 +7,7 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" "golang.org/x/crypto/ssh" "xorm.io/builder" diff --git a/models/asymkey/ssh_key_parse.go b/models/asymkey/ssh_key_parse.go index fc39f28624d..d39ddf3c772 100644 --- a/models/asymkey/ssh_key_parse.go +++ b/models/asymkey/ssh_key_parse.go @@ -15,9 +15,9 @@ import ( "math/big" "strings" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" "golang.org/x/crypto/ssh" ) diff --git a/models/asymkey/ssh_key_principals.go b/models/asymkey/ssh_key_principals.go index e8b97d306e6..24072667646 100644 --- a/models/asymkey/ssh_key_principals.go +++ b/models/asymkey/ssh_key_principals.go @@ -8,10 +8,10 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" ) // CheckPrincipalKeyString strips spaces and returns an error if the given principal contains newlines @@ -40,7 +40,7 @@ func CheckPrincipalKeyString(ctx context.Context, user *user_model.User, content if !email.IsActivated { continue } - if content == email.Email { + if strings.EqualFold(content, email.LowerEmail) { return content, nil } } diff --git a/models/asymkey/ssh_key_test.go b/models/asymkey/ssh_key_test.go index d7f48ada033..8ecb3f94741 100644 --- a/models/asymkey/ssh_key_test.go +++ b/models/asymkey/ssh_key_test.go @@ -12,8 +12,8 @@ import ( "strings" "testing" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/unittest" + "gitea.dev/modules/setting" "github.com/42wim/sshsig" "github.com/stretchr/testify/assert" diff --git a/models/asymkey/ssh_key_verify.go b/models/asymkey/ssh_key_verify.go index 04917239eed..85dba08746e 100644 --- a/models/asymkey/ssh_key_verify.go +++ b/models/asymkey/ssh_key_verify.go @@ -7,8 +7,8 @@ import ( "context" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" + "gitea.dev/models/db" + "gitea.dev/modules/log" "github.com/42wim/sshsig" ) diff --git a/models/auth/access_token.go b/models/auth/access_token.go index 7578528be87..da451fb044d 100644 --- a/models/auth/access_token.go +++ b/models/auth/access_token.go @@ -11,10 +11,10 @@ import ( "fmt" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" lru "github.com/hashicorp/golang-lru/v2" "xorm.io/builder" diff --git a/models/auth/access_token_scope.go b/models/auth/access_token_scope.go index 3eae19b2a53..71a81425a0b 100644 --- a/models/auth/access_token_scope.go +++ b/models/auth/access_token_scope.go @@ -8,7 +8,7 @@ import ( "slices" "strings" - "code.gitea.io/gitea/models/perm" + "gitea.dev/models/perm" ) // AccessTokenScopeCategory represents the scope category for an access token diff --git a/models/auth/access_token_test.go b/models/auth/access_token_test.go index 9ae072cc5fa..504600cd087 100644 --- a/models/auth/access_token_test.go +++ b/models/auth/access_token_test.go @@ -6,9 +6,9 @@ package auth_test import ( "testing" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" + auth_model "gitea.dev/models/auth" + "gitea.dev/models/db" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/auth/auth_token.go b/models/auth/auth_token.go index 54ff5a0d754..0eaf700c2e2 100644 --- a/models/auth/auth_token.go +++ b/models/auth/auth_token.go @@ -6,9 +6,9 @@ package auth import ( "context" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/auth/main_test.go b/models/auth/main_test.go index d772ea6b1c8..0d9eddbdfe5 100644 --- a/models/auth/main_test.go +++ b/models/auth/main_test.go @@ -6,13 +6,13 @@ package auth_test import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" - _ "code.gitea.io/gitea/models" - _ "code.gitea.io/gitea/models/actions" - _ "code.gitea.io/gitea/models/activities" - _ "code.gitea.io/gitea/models/auth" - _ "code.gitea.io/gitea/models/perm/access" + _ "gitea.dev/models" + _ "gitea.dev/models/actions" + _ "gitea.dev/models/activities" + _ "gitea.dev/models/auth" + _ "gitea.dev/models/perm/access" ) func TestMain(m *testing.M) { diff --git a/models/auth/oauth2.go b/models/auth/oauth2.go index d5a5e2af8e8..f67a5560654 100644 --- a/models/auth/oauth2.go +++ b/models/auth/oauth2.go @@ -5,9 +5,8 @@ package auth import ( "context" - "crypto/sha256" + "crypto/subtle" "encoding/base32" - "encoding/base64" "errors" "fmt" "net" @@ -16,14 +15,15 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/container" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" uuid "github.com/google/uuid" "golang.org/x/crypto/bcrypt" + "golang.org/x/oauth2" "xorm.io/builder" "xorm.io/xorm" ) @@ -31,7 +31,10 @@ import ( // Authorization codes should expire within 10 minutes per https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2 const oauth2AuthorizationCodeValidity = 10 * time.Minute -var ErrOAuth2AuthorizationCodeInvalidated = errors.New("oauth2 authorization code already invalidated") +var ( + ErrOAuth2AuthorizationCodeInvalidated = errors.New("oauth2 authorization code already invalidated") + ErrOAuth2GrantStaleCounter = errors.New("oauth2 grant state changed during token refresh") +) // OAuth2Application represents an OAuth2 client (RFC 6749) type OAuth2Application struct { @@ -151,30 +154,40 @@ func (app *OAuth2Application) ContainsRedirectURI(redirectURI string) bool { // https://www.rfc-editor.org/rfc/rfc6819#section-5.2.3.3 // https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest // https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics-12#section-3.1 - contains := func(s string) bool { - s = strings.TrimSuffix(strings.ToLower(s), "/") - for _, u := range app.RedirectURIs { - if strings.TrimSuffix(strings.ToLower(u), "/") == s { + redirectCandidates := []string{redirectURI} + if !app.ConfidentialClient { + loopbackRedirect, ok := normalizePublicClientRedirectURI(redirectURI) + if ok { + redirectCandidates = append(redirectCandidates, loopbackRedirect) + } + } + + for _, candidate := range redirectCandidates { + normalizedCandidate := normalizeRedirectURIForComparison(candidate) + for _, registeredURI := range app.RedirectURIs { + if normalizeRedirectURIForComparison(registeredURI) == normalizedCandidate { return true } } - return false } - if !app.ConfidentialClient { - uri, err := url.Parse(redirectURI) - // ignore port for http loopback uris following https://datatracker.ietf.org/doc/html/rfc8252#section-7.3 - if err == nil && uri.Scheme == "http" && uri.Port() != "" { - ip := net.ParseIP(uri.Hostname()) - if ip != nil && ip.IsLoopback() { - // strip port - uri.Host = uri.Hostname() - if contains(uri.String()) { - return true - } - } - } + + return false +} + +func normalizeRedirectURIForComparison(redirectURI string) string { + return strings.TrimSuffix(util.ToLowerASCII(redirectURI), "/") +} + +func normalizePublicClientRedirectURI(redirectURI string) (string, bool) { + parsedURI, err := url.Parse(redirectURI) + if err != nil || parsedURI.Scheme != "http" || parsedURI.Port() == "" { + return "", false } - return contains(redirectURI) + if ip := net.ParseIP(parsedURI.Hostname()); ip == nil || !ip.IsLoopback() { + return "", false + } + parsedURI.Host = parsedURI.Hostname() + return parsedURI.String(), true } // Base32 characters, but lowercased. @@ -424,22 +437,34 @@ func (code *OAuth2AuthorizationCode) Invalidate(ctx context.Context) error { return nil } +func (code *OAuth2AuthorizationCode) requiresCodeVerifier() bool { + return code.CodeChallengeMethod != "" || code.CodeChallenge != "" +} + +func deriveCodeChallenge(method, verifier string) (string, bool) { + switch method { + case "S256": + return oauth2.S256ChallengeFromVerifier(verifier), true + case "plain": + return verifier, true + default: + return "", false + } +} + // ValidateCodeChallenge validates the given verifier against the saved code challenge. This is part of the PKCE implementation. func (code *OAuth2AuthorizationCode) ValidateCodeChallenge(verifier string) bool { - switch code.CodeChallengeMethod { - case "S256": - // base64url(SHA256(verifier)) see https://tools.ietf.org/html/rfc7636#section-4.6 - h := sha256.Sum256([]byte(verifier)) - hashedVerifier := base64.RawURLEncoding.EncodeToString(h[:]) - return hashedVerifier == code.CodeChallenge - case "plain": - return verifier == code.CodeChallenge - case "": + if !code.requiresCodeVerifier() { return true - default: - // unsupported method -> return false + } + if verifier == "" || code.CodeChallengeMethod == "" { return false } + expectedChallenge, ok := deriveCodeChallenge(code.CodeChallengeMethod, verifier) + if !ok { + return false + } + return subtle.ConstantTimeCompare([]byte(expectedChallenge), []byte(code.CodeChallenge)) == 1 } // GetOAuth2AuthorizationByCode returns an authorization by its code @@ -504,15 +529,18 @@ func (grant *OAuth2Grant) GenerateNewAuthorizationCode(ctx context.Context, redi // IncreaseCounter increases the counter and updates the grant func (grant *OAuth2Grant) IncreaseCounter(ctx context.Context) error { - _, err := db.GetEngine(ctx).ID(grant.ID).Incr("counter").Update(new(OAuth2Grant)) + affected, err := db.GetEngine(ctx). + Where("id = ?", grant.ID). + And("counter = ?", grant.Counter). + Incr("counter"). + Update(new(OAuth2Grant)) if err != nil { return err } - updatedGrant, err := GetOAuth2GrantByID(ctx, grant.ID) - if err != nil { - return err + if affected == 0 { + return ErrOAuth2GrantStaleCounter } - grant.Counter = updatedGrant.Counter + grant.Counter++ return nil } diff --git a/models/auth/oauth2_list.go b/models/auth/oauth2_list.go index c55f10b3c85..9a4271fb6db 100644 --- a/models/auth/oauth2_list.go +++ b/models/auth/oauth2_list.go @@ -4,7 +4,7 @@ package auth import ( - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" "xorm.io/builder" ) diff --git a/models/auth/oauth2_test.go b/models/auth/oauth2_test.go index d72e1cb1d52..ea760eb2636 100644 --- a/models/auth/oauth2_test.go +++ b/models/auth/oauth2_test.go @@ -7,12 +7,13 @@ import ( "testing" "time" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/timeutil" + auth_model "gitea.dev/models/auth" + "gitea.dev/models/unittest" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "golang.org/x/oauth2" ) func TestOAuth2AuthorizationCode(t *testing.T) { @@ -116,6 +117,47 @@ func TestOAuth2Application_ContainsRedirect_Slash(t *testing.T) { assert.False(t, app.ContainsRedirectURI("http://127.0.0.1/other")) } +func TestOAuth2Application_ContainsRedirectURI_ASCIIOnlyNormalization(t *testing.T) { + testCases := []struct { + name string + registered []string + redirectURI string + allowed bool + }{ + { + name: "exact-match", + registered: []string{"https://signin.example.test/callback"}, + redirectURI: "https://signin.example.test/callback", + allowed: true, + }, + { + name: "ascii-case-insensitive", + registered: []string{"https://signin.example.test/callback"}, + redirectURI: "https://signIN.example.test/callback", + allowed: true, + }, + { + name: "non-ascii-not-folded", + registered: []string{"https://signin.example.test/callback"}, + redirectURI: "https://signİn.example.test/callback", + allowed: false, + }, + { + name: "loopback-strips-port", + registered: []string{"http://127.0.0.1/callback"}, + redirectURI: "http://127.0.0.1:12345/callback", + allowed: true, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + app := &auth_model.OAuth2Application{RedirectURIs: tc.registered} + assert.Equal(t, tc.allowed, app.ContainsRedirectURI(tc.redirectURI)) + }) + } +} + func TestOAuth2Application_ValidateClientSecret(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) app := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Application{ID: 1}) @@ -193,6 +235,16 @@ func TestOAuth2Grant_IncreaseCounter(t *testing.T) { unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Grant{ID: 1, Counter: 2}) } +func TestOAuth2Grant_IncreaseCounterRejectsStaleCounter(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + grant := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Grant{ID: 1, Counter: 1}) + stale := *grant + + assert.NoError(t, grant.IncreaseCounter(t.Context())) + err := stale.IncreaseCounter(t.Context()) + assert.ErrorIs(t, err, auth_model.ErrOAuth2GrantStaleCounter) +} + func TestOAuth2Grant_ScopeContains(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) grant := unittest.AssertExistsAndLoadBean(t, &auth_model.OAuth2Grant{ID: 1, Scope: "openid profile"}) @@ -237,35 +289,38 @@ func TestRevokeOAuth2Grant(t *testing.T) { //////////////////// Authorization Code func TestOAuth2AuthorizationCode_ValidateCodeChallenge(t *testing.T) { - // test plain - code := &auth_model.OAuth2AuthorizationCode{ - CodeChallengeMethod: "plain", - CodeChallenge: "test123", - } - assert.True(t, code.ValidateCodeChallenge("test123")) - assert.False(t, code.ValidateCodeChallenge("ierwgjoergjio")) + s256Verifier := "s256-verifier" + s256Challenge := oauth2.S256ChallengeFromVerifier(s256Verifier) + missingVerifierChallenge := oauth2.S256ChallengeFromVerifier("verifier-not-supplied") - // test S256 - code = &auth_model.OAuth2AuthorizationCode{ - CodeChallengeMethod: "S256", - CodeChallenge: "CjvyTLSdR47G5zYenDA-eDWW4lRrO8yvjcWwbD_deOg", + testCases := []struct { + name string + method string + challenge string + verifier string + valid bool + }{ + {"plain-success", "plain", "plain-secret", "plain-secret", true}, + {"plain-failure", "plain", "plain-secret", "ierwgjoergjio", false}, + {"s256-success", "S256", s256Challenge, s256Verifier, true}, + {"s256-failure", "S256", s256Challenge, "wiogjerogorewngoenrgoiuenorg", false}, + {"unsupported-method", "monkey", "foiwgjioriogeiogjerger", "foiwgjioriogeiogjerger", false}, + {"no-pkce-configured", "", "", "", true}, + {"s256-missing-verifier", "S256", missingVerifierChallenge, "", false}, + {"plain-missing-verifier", "plain", "plain-secret", "", false}, + {"missing-method-with-challenge", "", "foierjiogerogerg", "", false}, + {"missing-method-rejects-even-matching-verifier", "", "foierjiogerogerg", "foierjiogerogerg", false}, } - assert.True(t, code.ValidateCodeChallenge("N1Zo9-8Rfwhkt68r1r29ty8YwIraXR8eh_1Qwxg7yQXsonBt")) - assert.False(t, code.ValidateCodeChallenge("wiogjerogorewngoenrgoiuenorg")) - // test unknown - code = &auth_model.OAuth2AuthorizationCode{ - CodeChallengeMethod: "monkey", - CodeChallenge: "foiwgjioriogeiogjerger", + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + code := &auth_model.OAuth2AuthorizationCode{ + CodeChallengeMethod: tc.method, + CodeChallenge: tc.challenge, + } + assert.Equal(t, tc.valid, code.ValidateCodeChallenge(tc.verifier)) + }) } - assert.False(t, code.ValidateCodeChallenge("foiwgjioriogeiogjerger")) - - // test no code challenge - code = &auth_model.OAuth2AuthorizationCode{ - CodeChallengeMethod: "", - CodeChallenge: "foierjiogerogerg", - } - assert.True(t, code.ValidateCodeChallenge("")) } func TestOAuth2AuthorizationCode_GenerateRedirectURI(t *testing.T) { diff --git a/models/auth/session.go b/models/auth/session.go index dbdcde03a0b..6de69a61308 100644 --- a/models/auth/session.go +++ b/models/auth/session.go @@ -7,8 +7,8 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" "xorm.io/builder" ) diff --git a/models/auth/source.go b/models/auth/source.go index 7a008f08a8b..278898e49db 100644 --- a/models/auth/source.go +++ b/models/auth/source.go @@ -9,12 +9,12 @@ import ( "fmt" "reflect" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/optional" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" "xorm.io/xorm" @@ -100,7 +100,7 @@ var registeredConfigs = map[Type]func() Config{} // RegisterTypeConfig register a config for a provided type func RegisterTypeConfig(typ Type, exemplar Config) { - if reflect.TypeOf(exemplar).Kind() == reflect.Ptr { + if reflect.TypeOf(exemplar).Kind() == reflect.Pointer { // Pointer: registeredConfigs[typ] = func() Config { return reflect.New(reflect.ValueOf(exemplar).Elem().Type()).Interface().(Config) diff --git a/models/auth/source_test.go b/models/auth/source_test.go index fbd663a64fa..b09fc7f4b06 100644 --- a/models/auth/source_test.go +++ b/models/auth/source_test.go @@ -7,9 +7,9 @@ import ( "strings" "testing" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/json" + auth_model "gitea.dev/models/auth" + "gitea.dev/models/unittest" + "gitea.dev/modules/json" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/auth/twofactor.go b/models/auth/twofactor.go index 80c34ba6adb..9c0208f47f5 100644 --- a/models/auth/twofactor.go +++ b/models/auth/twofactor.go @@ -13,11 +13,11 @@ import ( "encoding/hex" "fmt" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/secret" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/secret" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "github.com/pquerna/otp/totp" "golang.org/x/crypto/pbkdf2" diff --git a/models/auth/webauthn.go b/models/auth/webauthn.go index 7bd79ed3f52..11297556d25 100644 --- a/models/auth/webauthn.go +++ b/models/auth/webauthn.go @@ -8,9 +8,9 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "github.com/go-webauthn/webauthn/protocol" "github.com/go-webauthn/webauthn/webauthn" diff --git a/models/auth/webauthn_test.go b/models/auth/webauthn_test.go index 41c5f6de94a..a6483192261 100644 --- a/models/auth/webauthn_test.go +++ b/models/auth/webauthn_test.go @@ -6,8 +6,8 @@ package auth_test import ( "testing" - auth_model "code.gitea.io/gitea/models/auth" - "code.gitea.io/gitea/models/unittest" + auth_model "gitea.dev/models/auth" + "gitea.dev/models/unittest" "github.com/go-webauthn/webauthn/webauthn" "github.com/stretchr/testify/assert" diff --git a/models/avatars/avatar.go b/models/avatars/avatar.go index 9c56e0f9a0f..7ecb55183c5 100644 --- a/models/avatars/avatar.go +++ b/models/avatars/avatar.go @@ -14,10 +14,10 @@ import ( "strings" "sync/atomic" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/cache" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/cache" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" "strk.kbt.io/projects/go/libravatar" ) diff --git a/models/avatars/avatar_test.go b/models/avatars/avatar_test.go index 43a062cc2a1..cfc578d27b9 100644 --- a/models/avatars/avatar_test.go +++ b/models/avatars/avatar_test.go @@ -6,10 +6,10 @@ package avatars_test import ( "testing" - avatars_model "code.gitea.io/gitea/models/avatars" - system_model "code.gitea.io/gitea/models/system" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/setting/config" + avatars_model "gitea.dev/models/avatars" + system_model "gitea.dev/models/system" + "gitea.dev/modules/setting" + "gitea.dev/modules/setting/config" "github.com/stretchr/testify/assert" ) diff --git a/models/avatars/main_test.go b/models/avatars/main_test.go index c721a7dc2ac..ce48dada28a 100644 --- a/models/avatars/main_test.go +++ b/models/avatars/main_test.go @@ -6,11 +6,11 @@ package avatars_test import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" - _ "code.gitea.io/gitea/models" - _ "code.gitea.io/gitea/models/activities" - _ "code.gitea.io/gitea/models/perm/access" + _ "gitea.dev/models" + _ "gitea.dev/models/activities" + _ "gitea.dev/models/perm/access" ) func TestMain(m *testing.M) { diff --git a/models/db/collation.go b/models/db/collation.go index 203f7cbfe47..d9a54e57689 100644 --- a/models/db/collation.go +++ b/models/db/collation.go @@ -8,11 +8,10 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/container" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) @@ -27,7 +26,7 @@ type CheckCollationsResult struct { InconsistentCollationColumns []string } -func findAvailableCollationsMySQL(x *xorm.Engine) (ret container.Set[string], err error) { +func findAvailableCollationsMySQL(x EngineMigration) (ret container.Set[string], err error) { var res []struct { Collation string } @@ -41,7 +40,7 @@ func findAvailableCollationsMySQL(x *xorm.Engine) (ret container.Set[string], er return ret, nil } -func findAvailableCollationsMSSQL(x *xorm.Engine) (ret container.Set[string], err error) { +func findAvailableCollationsMSSQL(x EngineMigration) (ret container.Set[string], err error) { var res []struct { Name string } @@ -55,7 +54,7 @@ func findAvailableCollationsMSSQL(x *xorm.Engine) (ret container.Set[string], er return ret, nil } -func CheckCollations(x *xorm.Engine) (*CheckCollationsResult, error) { +func CheckCollations(x EngineMigration) (*CheckCollationsResult, error) { dbTables, err := x.DBMetas() if err != nil { return nil, err @@ -143,7 +142,7 @@ func CheckCollationsDefaultEngine() (*CheckCollationsResult, error) { return CheckCollations(xormEngine) } -func alterDatabaseCollation(x *xorm.Engine, collation string) error { +func alterDatabaseCollation(x EngineMigration, collation string) error { if x.Dialect().URI().DBType == schemas.MYSQL { _, err := x.Exec("ALTER DATABASE CHARACTER SET utf8mb4 COLLATE " + collation) return err @@ -156,7 +155,7 @@ func alterDatabaseCollation(x *xorm.Engine, collation string) error { } // preprocessDatabaseCollation checks database & table column collation, and alter the database collation if needed -func preprocessDatabaseCollation(x *xorm.Engine) { +func preprocessDatabaseCollation(x EngineMigration) { r, err := CheckCollations(x) if err != nil { log.Error("Failed to check database collation: %v", err) diff --git a/models/db/common.go b/models/db/common.go index b3c43f8b626..ff17962fa46 100644 --- a/models/db/common.go +++ b/models/db/common.go @@ -6,8 +6,8 @@ package db import ( "strings" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/db/conn.go b/models/db/conn.go index de6f3cd5ec7..34349124178 100644 --- a/models/db/conn.go +++ b/models/db/conn.go @@ -10,10 +10,11 @@ import ( "net/url" "os" "path/filepath" + "slices" "strings" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" ) type ConnOptions struct { @@ -31,7 +32,9 @@ type ConnOptions struct { } type SQLiteConnStrOptions struct { - FilePath string + FilePath string + // how long a concurrent query can wait for others (milliseconds), + // if timeout is reached, the error is something like "database is locked (SQLITE_BUSY)" BusyTimeout int JournalMode string } @@ -52,10 +55,21 @@ func GlobalConnOptions() ConnOptions { } } -const sqlDriverPostgresSchema = "postgresschema" +const ( + sqlDriverPostgresSchema = "postgresschema" + sqlDriverSQLite3 = "sqlite3" // although database type also has "sqlite3", they are different, for different purposes +) var makeSQLiteConnStr = func(opts SQLiteConnStrOptions) (string, string, error) { - return "", "", errors.New(`this Gitea binary was not built with SQLite3 support, get an official release or rebuild with: -tags sqlite,sqlite_unlock_notify`) + return "", "", errors.New(`this Gitea binary was not built with SQLite3 support, get an official release or rebuild with correct "-tags"`) +} + +func registerSQLiteConnStrMaker(fn func(opts SQLiteConnStrOptions) (string, string, error)) { + if slices.Contains(setting.SupportedDatabaseTypes, setting.DatabaseTypeSQLite3) { + panic("another sqlite3 driver has been registered") + } + setting.SupportedDatabaseTypes = append(setting.SupportedDatabaseTypes, setting.DatabaseTypeSQLite3) + makeSQLiteConnStr = fn } func ConnStrDefaultDatabase(opts ConnOptions) (string, string, error) { diff --git a/models/db/context.go b/models/db/context.go index 8bb14f1389b..bb2001673d0 100644 --- a/models/db/context.go +++ b/models/db/context.go @@ -11,18 +11,21 @@ import ( "slices" "sync" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/setting" "xorm.io/builder" "xorm.io/xorm" ) -type engineContextKeyType struct{} +type contextKey struct{ key string } -var engineContextKey = engineContextKeyType{} +var ( + contextKeyEngine = contextKey{"engine"} + ContextKeyTestFixtures = contextKey{"test-fixtures"} +) func withContextEngine(ctx context.Context, e Engine) context.Context { - return context.WithValue(ctx, engineContextKey, e) + return context.WithValue(ctx, contextKeyEngine, e) } var ( @@ -68,7 +71,7 @@ func contextSafetyCheck(e Engine) { // GetEngine gets an existing db Engine/Statement or creates a new Session func GetEngine(ctx context.Context) Engine { - if engine, ok := ctx.Value(engineContextKey).(Engine); ok { + if engine, ok := ctx.Value(contextKeyEngine).(Engine); ok { // if reusing the existing session, need to do "contextSafetyCheck" because the Iterate creates a "autoResetStatement=false" session contextSafetyCheck(engine) return engine @@ -309,7 +312,7 @@ func InTransaction(ctx context.Context) bool { } func getTransactionSession(ctx context.Context) *xorm.Session { - e, _ := ctx.Value(engineContextKey).(Engine) + e, _ := ctx.Value(contextKeyEngine).(Engine) if sess, ok := e.(*xorm.Session); ok && sess.IsInTx() { return sess } diff --git a/models/db/context_test.go b/models/db/context_test.go index 1719a7bfe85..7804a15d1a3 100644 --- a/models/db/context_test.go +++ b/models/db/context_test.go @@ -7,8 +7,8 @@ import ( "context" "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/db" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/db/convert.go b/models/db/convert.go index 374dbfd8a82..125449705c0 100644 --- a/models/db/convert.go +++ b/models/db/convert.go @@ -6,7 +6,7 @@ package db import ( "fmt" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/setting" "xorm.io/xorm" "xorm.io/xorm/convert" diff --git a/models/db/driver_postgresschema.go b/models/db/driver_postgresschema.go index b6735007631..ad2b5abc04a 100644 --- a/models/db/driver_postgresschema.go +++ b/models/db/driver_postgresschema.go @@ -8,7 +8,7 @@ import ( "database/sql/driver" "sync" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/setting" "github.com/lib/pq" "xorm.io/xorm/dialects" diff --git a/models/db/driver_sqlite_mattn.go b/models/db/driver_sqlite_mattn.go index 4988a43d3f2..a25cb099901 100644 --- a/models/db/driver_sqlite_mattn.go +++ b/models/db/driver_sqlite_mattn.go @@ -1,8 +1,8 @@ -//go:build sqlite - // Copyright 2026 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT +//go:build sqlite_mattn && sqlite_unlock_notify + package db import ( @@ -10,14 +10,11 @@ import ( "strconv" "strings" - "code.gitea.io/gitea/modules/setting" - _ "github.com/mattn/go-sqlite3" ) func init() { - setting.SupportedDatabaseTypes = append(setting.SupportedDatabaseTypes, "sqlite3") - makeSQLiteConnStr = makeSQLiteConnStrMattnCGO + registerSQLiteConnStrMaker(makeSQLiteConnStrMattnCGO) } func makeSQLiteConnStrMattnCGO(opts SQLiteConnStrOptions) (string, string, error) { @@ -30,5 +27,5 @@ func makeSQLiteConnStrMattnCGO(opts SQLiteConnStrOptions) (string, string, error params = append(params, "_journal_mode="+opts.JournalMode) } connStr := fmt.Sprintf("file:%s?%s", opts.FilePath, strings.Join(params, "&")) - return "sqlite3", connStr, nil + return sqlDriverSQLite3, connStr, nil } diff --git a/models/db/driver_sqlite_modernc.go b/models/db/driver_sqlite_modernc.go new file mode 100644 index 00000000000..6bd5498a555 --- /dev/null +++ b/models/db/driver_sqlite_modernc.go @@ -0,0 +1,41 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +//go:build !sqlite_mattn + +// modernc driver is chosen as the default one (compared to mattn, ncruces) +// * mattn was used as default, but it requires CGO +// * the CI times are almost the same for these three (race detector must be disabled) +// * modernc increases the binary size about 2MB, ncruces increases about 7MB +// * compiling time: modernc is slightly slower than mattn, ncruces is the slowest + +package db + +import ( + "database/sql" + "fmt" + "strings" + + "modernc.org/sqlite" +) + +func init() { + // this driver contains huge amount of Golang code, so it is much slower when "-race" check is enabled. + registerSQLiteConnStrMaker(makeSQLiteConnStrModerncCCGO) + sql.Register(sqlDriverSQLite3, &sqlite.Driver{}) +} + +func makeSQLiteConnStrModerncCCGO(opts SQLiteConnStrOptions) (string, string, error) { + var params []string + // TODO: there is a changed behavior from mattn driver: + // * mattn driver can wait for pretty long time for concurrent accesses (not limited by the busy timeout) + // * but other drivers will report something like "database is locked (5) (SQLITE_BUSY)" if the timeout is reached + // Maybe we need to relax the busy timeout to a reasonable long time in the future + params = append(params, fmt.Sprintf("_pragma=busy_timeout(%d)", opts.BusyTimeout)) + params = append(params, "_txlock=immediate") + if opts.JournalMode != "" { + params = append(params, fmt.Sprintf("_pragma=journal_mode(%s)", opts.JournalMode)) + } + connStr := fmt.Sprintf("file:%s?%s", opts.FilePath, strings.Join(params, "&")) + return sqlDriverSQLite3, connStr, nil +} diff --git a/models/db/engine.go b/models/db/engine.go index fbcc3fa15e8..d4ac0b4aca0 100755 --- a/models/db/engine.go +++ b/models/db/engine.go @@ -16,6 +16,10 @@ import ( _ "github.com/microsoft/go-mssqldb" // Needed for the MSSQL driver "xorm.io/xorm" + "xorm.io/xorm/core" + "xorm.io/xorm/dialects" + "xorm.io/xorm/names" + "xorm.io/xorm/schemas" ) var ( @@ -33,6 +37,7 @@ type Engine interface { Truncate(...any) (int64, error) Exec(...any) (sql.Result, error) Find(any, ...any) error + FindAndCount(any, ...any) (int64, error) Get(beans ...any) (bool, error) ID(any) *xorm.Session In(string, ...any) *xorm.Session @@ -61,9 +66,41 @@ type Engine interface { IsTableExist(tableNameOrBean any) (bool, error) } +// Session represents a xorm session interface, used as an abstraction over *xorm.Session. +type Session interface { + Engine + And(query any, args ...any) *xorm.Session + Begin() error + Close() error + Commit() error + IsInTx() bool + Rollback() error + Engine() *xorm.Engine +} + +// EngineMigration is a xorm engine interface used for migrations. +// It extends Engine with additional methods that are only available on the engine (not on the session) +// and are needed by the migration packages. +type EngineMigration interface { + Engine + Close() error + DB() *core.DB + DBMetas() ([]*schemas.Table, error) + Dialect() dialects.Dialect + DropTables(beans ...any) error + NewSession() *xorm.Session + QueryInterface(sqlOrArgs ...any) ([]map[string]any, error) + SetMapper(mapper names.Mapper) + SyncWithOptions(opts xorm.SyncOptions, beans ...any) (*xorm.SyncResult, error) + TableInfo(bean any) (*schemas.Table, error) + TableName(bean any, includeSchema ...bool) string +} + var ( - _ Engine = (*xorm.Engine)(nil) - _ Engine = (*xorm.Session)(nil) + _ Engine = (*xorm.Engine)(nil) + _ Engine = (*xorm.Session)(nil) + _ Session = (*xorm.Session)(nil) + _ EngineMigration = (*xorm.Engine)(nil) ) // RegisterModel registers model, if initFuncs provided, it will be invoked after data model sync diff --git a/models/db/engine_dump.go b/models/db/engine_dump.go index 1d8d555b448..016bc99287a 100644 --- a/models/db/engine_dump.go +++ b/models/db/engine_dump.go @@ -4,7 +4,7 @@ package db import ( - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/setting" "xorm.io/xorm/schemas" ) diff --git a/models/db/engine_hook.go b/models/db/engine_hook.go index 8709a2c2a13..00318d28e76 100644 --- a/models/db/engine_hook.go +++ b/models/db/engine_hook.go @@ -7,9 +7,9 @@ import ( "context" "time" - "code.gitea.io/gitea/modules/gtprof" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/gtprof" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" "xorm.io/xorm/contexts" ) @@ -22,11 +22,17 @@ type EngineHook struct { var _ contexts.Hook = (*EngineHook)(nil) func (*EngineHook) BeforeProcess(c *contexts.ContextHook) (context.Context, error) { + if c.Ctx.Value(ContextKeyTestFixtures) != nil { + return c.Ctx, nil + } ctx, _ := gtprof.GetTracer().Start(c.Ctx, gtprof.TraceSpanDatabase) return ctx, nil } func (h *EngineHook) AfterProcess(c *contexts.ContextHook) error { + if c.Ctx.Value(ContextKeyTestFixtures) != nil { + return nil + } span := gtprof.GetContextSpan(c.Ctx) if span != nil { // Do not record SQL parameters here: diff --git a/models/db/engine_init.go b/models/db/engine_init.go index 65192d3327a..a7ae3488da4 100644 --- a/models/db/engine_init.go +++ b/models/db/engine_init.go @@ -7,8 +7,8 @@ import ( "context" "fmt" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" "xorm.io/xorm" "xorm.io/xorm/names" @@ -92,7 +92,7 @@ func UnsetDefaultEngine() { // When called from the "doctor" command, the migration function is a version check // that prevents the doctor from fixing anything in the database if the migration level // is different from the expected value. -func InitEngineWithMigration(ctx context.Context, migrateFunc func(context.Context, *xorm.Engine) error) (err error) { +func InitEngineWithMigration(ctx context.Context, migrateFunc func(context.Context, EngineMigration) error) (err error) { if err = InitEngine(ctx); err != nil { return err } diff --git a/models/db/engine_test.go b/models/db/engine_test.go index 6a6264b5353..69e30aaa4bf 100644 --- a/models/db/engine_test.go +++ b/models/db/engine_test.go @@ -7,12 +7,12 @@ import ( "path/filepath" "testing" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" + "gitea.dev/modules/setting" - _ "code.gitea.io/gitea/cmd" // for TestPrimaryKeys + _ "gitea.dev/cmd" // for TestPrimaryKeys "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -60,7 +60,7 @@ func TestPrimaryKeys(t *testing.T) { // https://github.com/go-gitea/gitea/issues/21086 // https://github.com/go-gitea/gitea/issues/16802 // To avoid creating tables without primary key again, this test will check them. - // Import "code.gitea.io/gitea/cmd" to make sure each db.RegisterModel in init functions has been called. + // Import "gitea.dev/cmd" to make sure each db.RegisterModel in init functions has been called. beans, err := db.NamesToBean() require.NoError(t, err) diff --git a/models/db/error.go b/models/db/error.go index d47c7adac49..e44886dcd71 100644 --- a/models/db/error.go +++ b/models/db/error.go @@ -6,7 +6,7 @@ package db import ( "fmt" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/util" ) // ErrCancelled represents an error due to context cancellation diff --git a/models/db/index.go b/models/db/index.go index 7a11645bd45..488e188aca9 100644 --- a/models/db/index.go +++ b/models/db/index.go @@ -9,7 +9,7 @@ import ( "fmt" "strconv" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/setting" ) // ResourceIndex represents a resource index which could be used as issue/release and others diff --git a/models/db/index_test.go b/models/db/index_test.go index e2af7f35bb1..5dece7e1beb 100644 --- a/models/db/index_test.go +++ b/models/db/index_test.go @@ -9,8 +9,8 @@ import ( "fmt" "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/db" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/db/install/db.go b/models/db/install/db.go index a84e5e54fe6..1fee5ff9db4 100644 --- a/models/db/install/db.go +++ b/models/db/install/db.go @@ -6,8 +6,8 @@ package install import ( "context" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) // CheckDatabaseConnection checks the database connection diff --git a/models/db/iterate.go b/models/db/iterate.go index 481be1b4b77..171ad9f5576 100644 --- a/models/db/iterate.go +++ b/models/db/iterate.go @@ -6,7 +6,7 @@ package db import ( "context" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/setting" "xorm.io/builder" ) diff --git a/models/db/iterate_test.go b/models/db/iterate_test.go index 21bb0c0b4bb..d6d50730875 100644 --- a/models/db/iterate_test.go +++ b/models/db/iterate_test.go @@ -7,9 +7,9 @@ import ( "context" "testing" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/db/list.go b/models/db/list.go index 5c005a03501..47c163c1d72 100644 --- a/models/db/list.go +++ b/models/db/list.go @@ -6,10 +6,9 @@ package db import ( "context" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/setting" "xorm.io/builder" - "xorm.io/xorm" ) const ( @@ -25,7 +24,7 @@ type Paginator interface { } // SetSessionPagination sets pagination for a database session -func SetSessionPagination(sess Engine, p Paginator) *xorm.Session { +func SetSessionPagination(sess Engine, p Paginator) Session { skip, take := p.GetSkipTake() return sess.Limit(take, skip) diff --git a/models/db/list_test.go b/models/db/list_test.go index ddcfff1f88d..959cb91bfb6 100644 --- a/models/db/list_test.go +++ b/models/db/list_test.go @@ -6,9 +6,9 @@ package db_test import ( "testing" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" "xorm.io/builder" diff --git a/models/db/log.go b/models/db/log.go index 4f563a4df04..55b03c81646 100644 --- a/models/db/log.go +++ b/models/db/log.go @@ -7,7 +7,7 @@ import ( "fmt" "sync/atomic" - "code.gitea.io/gitea/modules/log" + "gitea.dev/modules/log" xormlog "xorm.io/xorm/log" ) diff --git a/models/db/main_test.go b/models/db/main_test.go index 7d80b400fe5..81cd92a9f68 100644 --- a/models/db/main_test.go +++ b/models/db/main_test.go @@ -6,10 +6,10 @@ package db_test import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" - _ "code.gitea.io/gitea/models" - _ "code.gitea.io/gitea/models/repo" + _ "gitea.dev/models" + _ "gitea.dev/models/repo" ) func TestMain(m *testing.M) { diff --git a/models/db/name.go b/models/db/name.go index 48c7fdbce5f..dc449ba9d7a 100644 --- a/models/db/name.go +++ b/models/db/name.go @@ -9,7 +9,7 @@ import ( "strings" "unicode/utf8" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/util" ) // ErrNameReserved represents a "reserved name" error. diff --git a/models/db/paginator/main_test.go b/models/db/paginator/main_test.go index 47993aed6be..2f5ef392df3 100644 --- a/models/db/paginator/main_test.go +++ b/models/db/paginator/main_test.go @@ -6,7 +6,7 @@ package paginator import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" ) func TestMain(m *testing.M) { diff --git a/models/db/paginator/paginator_test.go b/models/db/paginator/paginator_test.go index 20602212d98..7511ed5ea8c 100644 --- a/models/db/paginator/paginator_test.go +++ b/models/db/paginator/paginator_test.go @@ -6,8 +6,8 @@ package paginator import ( "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/setting" "github.com/stretchr/testify/assert" ) diff --git a/models/db/sequence.go b/models/db/sequence.go index 9adc5113acc..446f344fbc1 100644 --- a/models/db/sequence.go +++ b/models/db/sequence.go @@ -8,7 +8,7 @@ import ( "fmt" "regexp" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/modules/setting" ) // CountBadSequences looks for broken sequences from recreate-table mistakes diff --git a/models/dbfs/dbfile.go b/models/dbfs/dbfile.go index a6981cb7d6a..8ff836452e8 100644 --- a/models/dbfs/dbfile.go +++ b/models/dbfs/dbfile.go @@ -14,7 +14,7 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" ) var defaultFileBlockSize int64 = 32 * 1024 diff --git a/models/dbfs/dbfs.go b/models/dbfs/dbfs.go index 3f768b5339d..92581857f92 100644 --- a/models/dbfs/dbfs.go +++ b/models/dbfs/dbfs.go @@ -10,7 +10,7 @@ import ( "path" "time" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" ) /* diff --git a/models/dbfs/dbfs_test.go b/models/dbfs/dbfs_test.go index ca57ebe171a..7dff86153f0 100644 --- a/models/dbfs/dbfs_test.go +++ b/models/dbfs/dbfs_test.go @@ -9,7 +9,7 @@ import ( "os" "testing" - "code.gitea.io/gitea/modules/test" + "gitea.dev/modules/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/dbfs/main_test.go b/models/dbfs/main_test.go index 537ba0935d6..7c737a1b744 100644 --- a/models/dbfs/main_test.go +++ b/models/dbfs/main_test.go @@ -6,7 +6,7 @@ package dbfs import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" ) func TestMain(m *testing.M) { diff --git a/models/git/branch.go b/models/git/branch.go index 698c43f1472..17433fcff81 100644 --- a/models/git/branch.go +++ b/models/git/branch.go @@ -8,16 +8,16 @@ import ( "fmt" "time" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/git" + "gitea.dev/modules/log" + "gitea.dev/modules/optional" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -261,7 +261,7 @@ func UpdateBranch(ctx context.Context, repoID, pusherID int64, branchName string Cols("commit_id, commit_message, pusher_id, commit_time, is_deleted, updated_unix"). Update(&Branch{ CommitID: commit.ID.String(), - CommitMessage: commit.Summary(), + CommitMessage: commit.MessageTitle(), PusherID: pusherID, CommitTime: timeutil.TimeStamp(commit.Committer.When.Unix()), IsDeleted: false, diff --git a/models/git/branch_list.go b/models/git/branch_list.go index 1445f3a5a02..45b02d9d33d 100644 --- a/models/git/branch_list.go +++ b/models/git/branch_list.go @@ -6,10 +6,10 @@ package git import ( "context" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/optional" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/optional" "xorm.io/builder" ) @@ -101,7 +101,7 @@ func (opts FindBranchOptions) ToOrders() string { func FindBranchNames(ctx context.Context, opts FindBranchOptions) ([]string, error) { sess := db.GetEngine(ctx).Select("name").Where(opts.ToConds()) if opts.PageSize > 0 && !opts.IsListAll() { - sess = db.SetSessionPagination(sess, &opts.ListOptions) + db.SetSessionPagination(sess, &opts.ListOptions) } var branches []string diff --git a/models/git/branch_test.go b/models/git/branch_test.go index 3832df93509..54ee652abd7 100644 --- a/models/git/branch_test.go +++ b/models/git/branch_test.go @@ -8,15 +8,15 @@ import ( "testing" "time" - "code.gitea.io/gitea/models/db" - git_model "code.gitea.io/gitea/models/git" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + git_model "gitea.dev/models/git" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/git" + "gitea.dev/modules/optional" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) @@ -36,7 +36,7 @@ func TestAddDeletedBranch(t *testing.T) { commit := &git.Commit{ ID: git.MustIDFromString(secondBranch.CommitID), - CommitMessage: secondBranch.CommitMessage, + CommitMessage: git.CommitMessage{MessageRaw: secondBranch.CommitMessage}, Committer: &git.Signature{ When: secondBranch.CommitTime.AsLocalTime(), }, diff --git a/models/git/commit_status.go b/models/git/commit_status.go index 2ae5937a3d8..918e45c207c 100644 --- a/models/git/commit_status.go +++ b/models/git/commit_status.go @@ -13,19 +13,18 @@ import ( "strings" "time" - asymkey_model "code.gitea.io/gitea/models/asymkey" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/commitstatus" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/translation" + asymkey_model "gitea.dev/models/asymkey" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/commitstatus" + "gitea.dev/modules/git" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/translation" "xorm.io/builder" - "xorm.io/xorm" ) // CommitStatus holds a single Status of a single Commit @@ -329,7 +328,7 @@ type CommitStatusIndex struct { MaxIndex int64 `xorm:"index"` } -func makeRepoCommitQuery(ctx context.Context, repoID int64, sha string) *xorm.Session { +func makeRepoCommitQuery(ctx context.Context, repoID int64, sha string) db.Session { return db.GetEngine(ctx).Table(&CommitStatus{}). Where("repo_id = ?", repoID).And("sha = ?", sha) } @@ -337,12 +336,10 @@ func makeRepoCommitQuery(ctx context.Context, repoID int64, sha string) *xorm.Se // GetLatestCommitStatus returns all statuses with a unique context for a given commit. func GetLatestCommitStatus(ctx context.Context, repoID int64, sha string, listOptions db.ListOptions) ([]*CommitStatus, error) { indices := make([]int64, 0, 10) - sess := makeRepoCommitQuery(ctx, repoID, sha). - Select("max( `index` ) as `index`"). - GroupBy("context_hash"). - OrderBy("max( `index` ) desc") + sess := makeRepoCommitQuery(ctx, repoID, sha) + sess.Select("max( `index` ) as `index`").GroupBy("context_hash").OrderBy("max( `index` ) desc") if !listOptions.IsListAll() { - sess = db.SetSessionPagination(sess, &listOptions) + db.SetSessionPagination(sess, &listOptions) } if err := sess.Find(&indices); err != nil { return nil, err @@ -372,7 +369,7 @@ func GetLatestCommitStatusForPairs(ctx context.Context, repoSHAs []RepoSHA) (map results := make([]result, 0, len(repoSHAs)) - getBase := func() *xorm.Session { + getBase := func() db.Session { return db.GetEngine(ctx).Table(&CommitStatus{}) } @@ -425,7 +422,7 @@ func GetLatestCommitStatusForRepoCommitIDs(ctx context.Context, repoID int64, co SHA string } - getBase := func() *xorm.Session { + getBase := func() db.Session { return db.GetEngine(ctx).Table(&CommitStatus{}).Where("repo_id = ?", repoID) } results := make([]result, 0, len(commitIDs)) diff --git a/models/git/commit_status_summary.go b/models/git/commit_status_summary.go index dd416fa0159..4ab1beec923 100644 --- a/models/git/commit_status_summary.go +++ b/models/git/commit_status_summary.go @@ -6,9 +6,9 @@ package git import ( "context" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/commitstatus" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/commitstatus" + "gitea.dev/modules/setting" "xorm.io/builder" ) diff --git a/models/git/commit_status_test.go b/models/git/commit_status_test.go index f18d3470b02..bb0858c44ed 100644 --- a/models/git/commit_status_test.go +++ b/models/git/commit_status_test.go @@ -8,14 +8,14 @@ import ( "testing" "time" - actions_model "code.gitea.io/gitea/models/actions" - "code.gitea.io/gitea/models/db" - git_model "code.gitea.io/gitea/models/git" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/commitstatus" - "code.gitea.io/gitea/modules/gitrepo" + actions_model "gitea.dev/models/actions" + "gitea.dev/models/db" + git_model "gitea.dev/models/git" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/commitstatus" + "gitea.dev/modules/gitrepo" "github.com/stretchr/testify/assert" ) diff --git a/models/git/lfs.go b/models/git/lfs.go index 1f3d086ac25..1cfb9331001 100644 --- a/models/git/lfs.go +++ b/models/git/lfs.go @@ -7,15 +7,15 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/lfs" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/lfs" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/git/lfs_lock.go b/models/git/lfs_lock.go index 8e63598fb28..92fb06f5b68 100644 --- a/models/git/lfs_lock.go +++ b/models/git/lfs_lock.go @@ -10,11 +10,11 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" ) // LFSLock represents a git lfs lock of repository. diff --git a/models/git/lfs_lock_list.go b/models/git/lfs_lock_list.go index cab1e61cabc..85cce753c87 100644 --- a/models/git/lfs_lock_list.go +++ b/models/git/lfs_lock_list.go @@ -7,9 +7,9 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" ) // LFSLockList is a list of LFSLock diff --git a/models/git/lfs_lock_test.go b/models/git/lfs_lock_test.go index c88e89be473..ca875534911 100644 --- a/models/git/lfs_lock_test.go +++ b/models/git/lfs_lock_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/git/lfs_test.go b/models/git/lfs_test.go index 4c0242f439c..17772cdd3c2 100644 --- a/models/git/lfs_test.go +++ b/models/git/lfs_test.go @@ -10,14 +10,14 @@ import ( "testing" "time" - "code.gitea.io/gitea/models/db" - git_model "code.gitea.io/gitea/models/git" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/lfs" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/test" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + git_model "gitea.dev/models/git" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + "gitea.dev/modules/lfs" + "gitea.dev/modules/setting" + "gitea.dev/modules/test" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) diff --git a/models/git/main_test.go b/models/git/main_test.go index aab1fa9a26f..98f0bf32ee3 100644 --- a/models/git/main_test.go +++ b/models/git/main_test.go @@ -6,11 +6,11 @@ package git_test import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" - _ "code.gitea.io/gitea/models" - _ "code.gitea.io/gitea/models/actions" - _ "code.gitea.io/gitea/models/activities" + _ "gitea.dev/models" + _ "gitea.dev/models/actions" + _ "gitea.dev/models/activities" ) func TestMain(m *testing.M) { diff --git a/models/git/protected_branch.go b/models/git/protected_branch.go index f242f94f7b7..ec710a710e2 100644 --- a/models/git/protected_branch.go +++ b/models/git/protected_branch.go @@ -9,17 +9,17 @@ import ( "slices" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - "code.gitea.io/gitea/models/perm" - access_model "code.gitea.io/gitea/models/perm/access" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/glob" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/models/organization" + "gitea.dev/models/perm" + access_model "gitea.dev/models/perm/access" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/glob" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -43,6 +43,9 @@ type ProtectedBranch struct { WhitelistDeployKeys bool `xorm:"NOT NULL DEFAULT false"` MergeWhitelistUserIDs []int64 `xorm:"JSON TEXT"` MergeWhitelistTeamIDs []int64 `xorm:"JSON TEXT"` + EnableBypassAllowlist bool `xorm:"NOT NULL DEFAULT false"` + BypassAllowlistUserIDs []int64 `xorm:"JSON TEXT"` + BypassAllowlistTeamIDs []int64 `xorm:"JSON TEXT"` CanForcePush bool `xorm:"NOT NULL DEFAULT false"` EnableForcePushAllowlist bool `xorm:"NOT NULL DEFAULT false"` ForcePushAllowlistUserIDs []int64 `xorm:"JSON TEXT"` @@ -204,6 +207,29 @@ func IsUserMergeWhitelisted(ctx context.Context, protectBranch *ProtectedBranch, return in } +// CanBypassBranchProtection reports whether the user can bypass branch protection checks (status checks, approvals, protected files) +// Either a repo admin (when not blocked) or a user/team on the bypass allowlist can bypass. +func CanBypassBranchProtection(ctx context.Context, protectBranch *ProtectedBranch, user *user_model.User, isRepoAdmin bool) bool { + if isRepoAdmin && !protectBranch.BlockAdminMergeOverride { + return true + } + if !protectBranch.EnableBypassAllowlist { + return false + } + if slices.Contains(protectBranch.BypassAllowlistUserIDs, user.ID) { + return true + } + if len(protectBranch.BypassAllowlistTeamIDs) == 0 { + return false + } + in, err := organization.IsUserInTeams(ctx, user.ID, protectBranch.BypassAllowlistTeamIDs) + if err != nil { + log.Error("IsUserInTeams failed: userID=%d, repoID=%d, allowlistTeamIDs=%v, err=%v", user.ID, protectBranch.RepoID, protectBranch.BypassAllowlistTeamIDs, err) + return false + } + return in +} + // IsUserOfficialReviewer check if user is official reviewer for the branch (counts towards required approvals) func IsUserOfficialReviewer(ctx context.Context, protectBranch *ProtectedBranch, user *user_model.User) (bool, error) { repo, err := repo_model.GetRepositoryByID(ctx, protectBranch.RepoID) @@ -347,6 +373,9 @@ type WhitelistOptions struct { ApprovalsUserIDs []int64 ApprovalsTeamIDs []int64 + + BypassUserIDs []int64 + BypassTeamIDs []int64 } // UpdateProtectBranch saves branch protection options of repository. @@ -387,6 +416,12 @@ func UpdateProtectBranch(ctx context.Context, repo *repo_model.Repository, prote } protectBranch.ApprovalsWhitelistUserIDs = whitelist + whitelist, err = updateUserWhitelist(ctx, repo, protectBranch.BypassAllowlistUserIDs, opts.BypassUserIDs) + if err != nil { + return err + } + protectBranch.BypassAllowlistUserIDs = whitelist + // if the repo is in an organization whitelist, err = updateTeamWhitelist(ctx, repo, protectBranch.WhitelistTeamIDs, opts.TeamIDs) if err != nil { @@ -412,6 +447,12 @@ func UpdateProtectBranch(ctx context.Context, repo *repo_model.Repository, prote } protectBranch.ApprovalsWhitelistTeamIDs = whitelist + whitelist, err = updateTeamWhitelist(ctx, repo, protectBranch.BypassAllowlistTeamIDs, opts.BypassTeamIDs) + if err != nil { + return err + } + protectBranch.BypassAllowlistTeamIDs = whitelist + // Looks like it's a new rule if protectBranch.ID == 0 { // as it's a new rule and if priority was not set, we need to calc it. diff --git a/models/git/protected_branch_list.go b/models/git/protected_branch_list.go index 6b282835a46..9defb708401 100644 --- a/models/git/protected_branch_list.go +++ b/models/git/protected_branch_list.go @@ -7,9 +7,9 @@ import ( "context" "sort" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/glob" - "code.gitea.io/gitea/modules/optional" + "gitea.dev/models/db" + "gitea.dev/modules/glob" + "gitea.dev/modules/optional" ) type ProtectedBranchRules []*ProtectedBranch diff --git a/models/git/protected_branch_test.go b/models/git/protected_branch_test.go index 3aa1d7daa8a..da642d6aad7 100644 --- a/models/git/protected_branch_test.go +++ b/models/git/protected_branch_test.go @@ -6,9 +6,10 @@ package git import ( "testing" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) @@ -153,3 +154,51 @@ func TestNewProtectBranchPriority(t *testing.T) { assert.NoError(t, err) assert.Equal(t, int64(2), savedPB2.Priority) } + +func TestCanBypassBranchProtection(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + + user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}) // not in team 1 + teamMember := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) + + pb := &ProtectedBranch{ + EnableBypassAllowlist: true, + BypassAllowlistUserIDs: []int64{user.ID}, + } + + testBypass := func(t *testing.T, expected bool, pb *ProtectedBranch, doer *user_model.User, isAdmin bool) { + assert.Equal(t, expected, CanBypassBranchProtection(t.Context(), pb, doer, isAdmin)) + } + // User bypasses via explicit allowlist. + testBypass(t, true, pb, user, false) + + // Non-admin cannot bypass when allowlist is disabled. + pb.EnableBypassAllowlist = false + testBypass(t, false, pb, user, false) + + // Repo admin can bypass independently of allowlist when not blocked. + testBypass(t, true, pb, user, true) + + // Admin override block still allows bypass for allowlisted users. + pb.EnableBypassAllowlist = true + pb.BlockAdminMergeOverride = true + testBypass(t, true, pb, user, false) + + // admin cannot bypass without allowlist membership. + pb.BypassAllowlistUserIDs = nil + testBypass(t, false, pb, user, true) + + // admin can bypass when allowlisted. + pb.BypassAllowlistUserIDs = []int64{user.ID} + testBypass(t, true, pb, user, true) + + // User bypasses via team allowlist membership. + pb.EnableBypassAllowlist = true + pb.BlockAdminMergeOverride = false + pb.BypassAllowlistUserIDs = nil + pb.BypassAllowlistTeamIDs = []int64{1} // team 1 contains user 2 in test fixtures + testBypass(t, true, pb, teamMember, false) + + // User does not bypass when not in allowlisted teams. + testBypass(t, false, pb, user, false) +} diff --git a/models/git/protected_tag.go b/models/git/protected_tag.go index dc38daf9815..35d406f45ce 100644 --- a/models/git/protected_tag.go +++ b/models/git/protected_tag.go @@ -9,10 +9,10 @@ import ( "slices" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - "code.gitea.io/gitea/modules/glob" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/models/organization" + "gitea.dev/modules/glob" + "gitea.dev/modules/timeutil" ) // ProtectedTag struct diff --git a/models/git/protected_tag_test.go b/models/git/protected_tag_test.go index 252eaf1bbae..a0400c9bfa1 100644 --- a/models/git/protected_tag_test.go +++ b/models/git/protected_tag_test.go @@ -6,8 +6,8 @@ package git_test import ( "testing" - git_model "code.gitea.io/gitea/models/git" - "code.gitea.io/gitea/models/unittest" + git_model "gitea.dev/models/git" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/assignees.go b/models/issues/assignees.go index 54f995dd2e9..a45ab468ebc 100644 --- a/models/issues/assignees.go +++ b/models/issues/assignees.go @@ -7,9 +7,9 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/issues/assignees_test.go b/models/issues/assignees_test.go index 13922899dc0..58a1edc02b8 100644 --- a/models/issues/assignees_test.go +++ b/models/issues/assignees_test.go @@ -6,9 +6,9 @@ package issues_test import ( "testing" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/comment.go b/models/issues/comment.go index acfc07ff220..febc49ca76b 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -14,23 +14,23 @@ import ( "strconv" "unicode/utf8" - "code.gitea.io/gitea/models/db" - git_model "code.gitea.io/gitea/models/git" - "code.gitea.io/gitea/models/organization" - project_model "code.gitea.io/gitea/models/project" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/htmlutil" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/markup" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/references" - "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/translation" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + git_model "gitea.dev/models/git" + "gitea.dev/models/organization" + project_model "gitea.dev/models/project" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/htmlutil" + "gitea.dev/modules/json" + "gitea.dev/modules/log" + "gitea.dev/modules/markup" + "gitea.dev/modules/optional" + "gitea.dev/modules/references" + "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/translation" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -1124,7 +1124,7 @@ func FindComments(ctx context.Context, opts *FindCommentsOptions) (CommentList, } if opts.Page > 0 { - sess = db.SetSessionPagination(sess, opts) + db.SetSessionPagination(sess, opts) } // WARNING: If you change this order you will need to fix createCodeComment diff --git a/models/issues/comment_code.go b/models/issues/comment_code.go index 8de52f815a4..7195736f923 100644 --- a/models/issues/comment_code.go +++ b/models/issues/comment_code.go @@ -7,10 +7,10 @@ import ( "context" "strconv" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/renderhelper" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/markup/markdown" + "gitea.dev/models/db" + "gitea.dev/models/renderhelper" + user_model "gitea.dev/models/user" + "gitea.dev/modules/markup/markdown" "xorm.io/builder" ) diff --git a/models/issues/comment_list.go b/models/issues/comment_list.go index f6c485449f6..522c066309b 100644 --- a/models/issues/comment_list.go +++ b/models/issues/comment_list.go @@ -6,11 +6,11 @@ package issues import ( "context" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/log" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/log" ) // CommentList defines a list of comments diff --git a/models/issues/comment_test.go b/models/issues/comment_test.go index 3660f9c9398..c47a0c7a4a4 100644 --- a/models/issues/comment_test.go +++ b/models/issues/comment_test.go @@ -7,11 +7,11 @@ import ( "testing" "time" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/content_history.go b/models/issues/content_history.go index 31c80d2cea3..fe2fc0d6804 100644 --- a/models/issues/content_history.go +++ b/models/issues/content_history.go @@ -7,11 +7,11 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/avatars" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/avatars" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/issues/content_history_test.go b/models/issues/content_history_test.go index d2fcc82b1d5..9efd4a33e24 100644 --- a/models/issues/content_history_test.go +++ b/models/issues/content_history_test.go @@ -6,10 +6,10 @@ package issues_test import ( "testing" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/dependency.go b/models/issues/dependency.go index db8054e1618..cf76fec2bff 100644 --- a/models/issues/dependency.go +++ b/models/issues/dependency.go @@ -7,10 +7,10 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" ) // ErrDependencyExists represents a "DependencyAlreadyExists" kind of error. diff --git a/models/issues/dependency_test.go b/models/issues/dependency_test.go index 0e6a870ff9e..786a24f146d 100644 --- a/models/issues/dependency_test.go +++ b/models/issues/dependency_test.go @@ -6,9 +6,9 @@ package issues_test import ( "testing" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/issue.go b/models/issues/issue.go index 345b36a82fa..1dba275ff03 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -12,17 +12,17 @@ import ( "slices" "strconv" - "code.gitea.io/gitea/models/db" - project_model "code.gitea.io/gitea/models/project" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/setting" - api "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + project_model "gitea.dev/models/project" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/log" + "gitea.dev/modules/optional" + "gitea.dev/modules/setting" + api "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -682,7 +682,7 @@ func (issue *Issue) BlockedByDependencies(ctx context.Context, opts db.ListOptio // sort by repo id then created date, with the issues of the same repo at the beginning of the list OrderBy("CASE WHEN issue.repo_id = ? THEN 0 ELSE issue.repo_id END, issue.created_unix DESC", issue.RepoID) if opts.Page > 0 { - sess = db.SetSessionPagination(sess, &opts) + db.SetSessionPagination(sess, &opts) } total, err = sess.FindAndCount(&issueDeps) diff --git a/models/issues/issue_index.go b/models/issues/issue_index.go index 1fe4a08a09b..895fd34193c 100644 --- a/models/issues/issue_index.go +++ b/models/issues/issue_index.go @@ -6,7 +6,7 @@ package issues import ( "context" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" ) // RecalculateIssueIndexForRepo create issue_index for repo if not exist and diff --git a/models/issues/issue_label.go b/models/issues/issue_label.go index 697448cf5e5..b628a25c14c 100644 --- a/models/issues/issue_label.go +++ b/models/issues/issue_label.go @@ -8,9 +8,9 @@ import ( "fmt" "sort" - "code.gitea.io/gitea/models/db" - access_model "code.gitea.io/gitea/models/perm/access" - user_model "code.gitea.io/gitea/models/user" + "gitea.dev/models/db" + access_model "gitea.dev/models/perm/access" + user_model "gitea.dev/models/user" "xorm.io/builder" ) diff --git a/models/issues/issue_label_test.go b/models/issues/issue_label_test.go index 6ccf6debaea..fc01feaecfa 100644 --- a/models/issues/issue_label_test.go +++ b/models/issues/issue_label_test.go @@ -6,9 +6,9 @@ package issues_test import ( "testing" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/issue_list.go b/models/issues/issue_list.go index da407094a74..45e25c2da89 100644 --- a/models/issues/issue_list.go +++ b/models/issues/issue_list.go @@ -7,11 +7,11 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - project_model "code.gitea.io/gitea/models/project" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" + "gitea.dev/models/db" + project_model "gitea.dev/models/project" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" "xorm.io/builder" ) diff --git a/models/issues/issue_list_test.go b/models/issues/issue_list_test.go index 842249bad23..1c9f2a1e8e7 100644 --- a/models/issues/issue_list_test.go +++ b/models/issues/issue_list_test.go @@ -6,9 +6,9 @@ package issues_test import ( "testing" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/setting" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" + "gitea.dev/modules/setting" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/issue_lock.go b/models/issues/issue_lock.go index 2e5bf64cc65..0bb4dc149a7 100644 --- a/models/issues/issue_lock.go +++ b/models/issues/issue_lock.go @@ -6,8 +6,8 @@ package issues import ( "context" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" ) // IssueLockOptions defines options for locking and/or unlocking an issue/PR diff --git a/models/issues/issue_pin.go b/models/issues/issue_pin.go index 753c96ed180..b3f2a485223 100644 --- a/models/issues/issue_pin.go +++ b/models/issues/issue_pin.go @@ -8,10 +8,10 @@ import ( "errors" "sort" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" ) type IssuePin struct { diff --git a/models/issues/issue_project.go b/models/issues/issue_project.go index 18f0f91c381..894eede22c3 100644 --- a/models/issues/issue_project.go +++ b/models/issues/issue_project.go @@ -6,10 +6,10 @@ package issues import ( "context" - "code.gitea.io/gitea/models/db" - project_model "code.gitea.io/gitea/models/project" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + project_model "gitea.dev/models/project" + user_model "gitea.dev/models/user" + "gitea.dev/modules/util" ) // LoadProjects loads all projects the issue is assigned to diff --git a/models/issues/issue_project_multi_test.go b/models/issues/issue_project_multi_test.go index b004f994b17..5d5aae3b9ce 100644 --- a/models/issues/issue_project_multi_test.go +++ b/models/issues/issue_project_multi_test.go @@ -7,10 +7,10 @@ import ( "fmt" "testing" - issues_model "code.gitea.io/gitea/models/issues" - project_model "code.gitea.io/gitea/models/project" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + issues_model "gitea.dev/models/issues" + project_model "gitea.dev/models/project" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/issues/issue_search.go b/models/issues/issue_search.go index f905e629e38..bc39199766e 100644 --- a/models/issues/issue_search.go +++ b/models/issues/issue_search.go @@ -9,17 +9,16 @@ import ( "strconv" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/models/organization" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/optional" + "gitea.dev/modules/util" "xorm.io/builder" - "xorm.io/xorm" ) const ScopeSortPrefix = "scope-" @@ -71,7 +70,7 @@ func (o *IssuesOptions) Copy(edit ...func(options *IssuesOptions)) *IssuesOption // applySorts sort an issues-related session based on the provided // sortType string -func applySorts(sess *xorm.Session, sortType string, priorityRepoID int64) { +func applySorts(sess db.Session, sortType string, priorityRepoID int64) { // Since this sortType is dynamically created, it has to be treated specially. if after, ok := strings.CutPrefix(sortType, ScopeSortPrefix); ok { scope := after @@ -129,7 +128,7 @@ func applySorts(sess *xorm.Session, sortType string, priorityRepoID int64) { } } -func applyLimit(sess *xorm.Session, opts *IssuesOptions) { +func applyLimit(sess db.Session, opts *IssuesOptions) { if opts.Paginator == nil || opts.Paginator.IsListAll() { return } @@ -141,7 +140,7 @@ func applyLimit(sess *xorm.Session, opts *IssuesOptions) { sess.Limit(opts.Paginator.PageSize, start) } -func applyLabelsCondition(sess *xorm.Session, opts *IssuesOptions) { +func applyLabelsCondition(sess db.Session, opts *IssuesOptions) { if len(opts.LabelIDs) > 0 { if opts.LabelIDs[0] == 0 { sess.Where("issue.id NOT IN (SELECT issue_id FROM issue_label)") @@ -182,7 +181,7 @@ func applyLabelsCondition(sess *xorm.Session, opts *IssuesOptions) { } } -func applyMilestoneCondition(sess *xorm.Session, opts *IssuesOptions) { +func applyMilestoneCondition(sess db.Session, opts *IssuesOptions) { if len(opts.MilestoneIDs) == 1 && opts.MilestoneIDs[0] == db.NoConditionID { sess.And("issue.milestone_id = 0") } else if len(opts.MilestoneIDs) > 0 { @@ -197,7 +196,7 @@ func applyMilestoneCondition(sess *xorm.Session, opts *IssuesOptions) { } } -func applyProjectCondition(sess *xorm.Session, opts *IssuesOptions) { +func applyProjectCondition(sess db.Session, opts *IssuesOptions) { projectIDs := util.SliceRemoveAll(opts.ProjectIDs, 0) if len(projectIDs) == 1 && projectIDs[0] == db.NoConditionID { // show those that are in no project sess.And(builder.NotIn("issue.id", builder.Select("issue_id").From("project_issue"))) @@ -211,7 +210,7 @@ func applyProjectCondition(sess *xorm.Session, opts *IssuesOptions) { // do not need to apply any condition } -func applyRepoConditions(sess *xorm.Session, opts *IssuesOptions) { +func applyRepoConditions(sess db.Session, opts *IssuesOptions) { if len(opts.RepoIDs) == 1 { opts.RepoCond = builder.Eq{"issue.repo_id": opts.RepoIDs[0]} } else if len(opts.RepoIDs) > 1 { @@ -228,7 +227,7 @@ func applyRepoConditions(sess *xorm.Session, opts *IssuesOptions) { } } -func applyConditions(sess *xorm.Session, opts *IssuesOptions) { +func applyConditions(sess db.Session, opts *IssuesOptions) { if len(opts.IssueIDs) > 0 { sess.In("issue.id", opts.IssueIDs) } @@ -362,7 +361,7 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, owner *user_mod return cond } -func applyAssigneeCondition(sess *xorm.Session, assigneeID string) { +func applyAssigneeCondition(sess db.Session, assigneeID string) { // old logic: 0 is also treated as "not filtering assignee", because the "assignee" was read as FormInt64 if assigneeID == "(none)" { sess.Where("issue.id NOT IN (SELECT issue_id FROM issue_assignees)") @@ -374,7 +373,7 @@ func applyAssigneeCondition(sess *xorm.Session, assigneeID string) { } } -func applyPosterCondition(sess *xorm.Session, posterID string) { +func applyPosterCondition(sess db.Session, posterID string) { // Actually every issue has a poster. // The "(none)" is for internal usage only: when doer tries to search non-existing user as poster, use "(none)" to return empty result. if posterID == "(none)" { @@ -384,13 +383,13 @@ func applyPosterCondition(sess *xorm.Session, posterID string) { } } -func applyMentionedCondition(sess *xorm.Session, mentionedID int64) { +func applyMentionedCondition(sess db.Session, mentionedID int64) { sess.Join("INNER", "issue_user", "issue.id = issue_user.issue_id"). And("issue_user.is_mentioned = ?", true). And("issue_user.uid = ?", mentionedID) } -func applyReviewRequestedCondition(sess *xorm.Session, reviewRequestedID int64) { +func applyReviewRequestedCondition(sess db.Session, reviewRequestedID int64) { existInTeamQuery := builder.Select("team_user.team_id"). From("team_user"). Where(builder.Eq{"team_user.uid": reviewRequestedID}) @@ -415,7 +414,7 @@ func applyReviewRequestedCondition(sess *xorm.Session, reviewRequestedID int64) And(builder.In("issue.id", subQuery)) } -func applyReviewedCondition(sess *xorm.Session, reviewedID int64) { +func applyReviewedCondition(sess db.Session, reviewedID int64) { // Query for pull requests where you are a reviewer or commenter, excluding // any pull requests already returned by the review requested filter. notPoster := builder.Neq{"issue.poster_id": reviewedID} @@ -445,7 +444,7 @@ func applyReviewedCondition(sess *xorm.Session, reviewedID int64) { sess.And(notPoster, builder.Or(reviewed, commented)) } -func applySubscribedCondition(sess *xorm.Session, subscriberID int64) { +func applySubscribedCondition(sess db.Session, subscriberID int64) { sess.And( builder. NotIn("issue.id", diff --git a/models/issues/issue_stats.go b/models/issues/issue_stats.go index adedaa3d3a0..0be8216c319 100644 --- a/models/issues/issue_stats.go +++ b/models/issues/issue_stats.go @@ -7,10 +7,9 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" "xorm.io/builder" - "xorm.io/xorm" ) // IssueStats represents issue statistic information. @@ -35,12 +34,10 @@ const ( FilterModeYourRepositories ) -const ( - // MaxQueryParameters represents the max query parameters - // When queries are broken down in parts because of the number - // of parameters, attempt to break by this amount - MaxQueryParameters = 300 -) +// MaxQueryParameters represents the max query parameters +// When queries are broken down in parts because of the number +// of parameters, attempt to break by this amount +var MaxQueryParameters = 300 // CountIssuesByRepo map from repoID to number of issues matching the options func CountIssuesByRepo(ctx context.Context, opts *IssuesOptions) (map[int64]int64, error) { @@ -131,7 +128,7 @@ func getIssueStatsChunk(ctx context.Context, opts *IssuesOptions, issueIDs []int return stats, err } -func applyIssuesOptions(sess *xorm.Session, opts *IssuesOptions, issueIDs []int64) *xorm.Session { +func applyIssuesOptions(sess db.Session, opts *IssuesOptions, issueIDs []int64) db.Session { if len(opts.RepoIDs) > 1 { sess.In("issue.repo_id", opts.RepoIDs) } else if len(opts.RepoIDs) == 1 { diff --git a/models/issues/issue_test.go b/models/issues/issue_test.go index b935c0fffdb..9d975d998ed 100644 --- a/models/issues/issue_test.go +++ b/models/issues/issue_test.go @@ -11,12 +11,13 @@ import ( "testing" "time" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/test" "github.com/stretchr/testify/assert" "xorm.io/builder" @@ -297,14 +298,11 @@ func TestIssue_ResolveMentions(t *testing.T) { func TestResourceIndex(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) - var wg sync.WaitGroup - for i := range 100 { - wg.Add(1) - go func(i int) { + for i := range 10 { + wg.Go(func() { testInsertIssue(t, fmt.Sprintf("issue %d", i+1), "my issue", 0) - wg.Done() - }(i) + }) } wg.Wait() } @@ -317,18 +315,12 @@ func TestCorrectIssueStats(t *testing.T) { // maxQueryParameters + 10 issues into the testDatabase. // Each new issues will have a constant description "Bugs are nasty" // Which will be used later on. - + defer test.MockVariableValue(&issues_model.MaxQueryParameters, 25)() issueAmount := issues_model.MaxQueryParameters + 10 - var wg sync.WaitGroup for i := range issueAmount { - wg.Add(1) - go func(i int) { - testInsertIssue(t, fmt.Sprintf("Issue %d", i+1), "Bugs are nasty", 0) - wg.Done() - }(i) + testInsertIssue(t, fmt.Sprintf("Issue %d", i+1), "Bugs are nasty", 0) } - wg.Wait() // Now we will get all issueID's that match the "Bugs are nasty" query. issues, err := issues_model.Issues(t.Context(), &issues_model.IssuesOptions{ diff --git a/models/issues/issue_update.go b/models/issues/issue_update.go index c58a2f319dd..74a4b4aac1b 100644 --- a/models/issues/issue_update.go +++ b/models/issues/issue_update.go @@ -9,17 +9,17 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - access_model "code.gitea.io/gitea/models/perm/access" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/references" - api "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/models/organization" + access_model "gitea.dev/models/perm/access" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/git" + "gitea.dev/modules/references" + api "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/issues/issue_user.go b/models/issues/issue_user.go index 6b59e0725ed..038447dca18 100644 --- a/models/issues/issue_user.go +++ b/models/issues/issue_user.go @@ -7,8 +7,8 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" ) // IssueUser represents an issue-user relation. diff --git a/models/issues/issue_user_test.go b/models/issues/issue_user_test.go index ec6d85c2bb5..58d2698e768 100644 --- a/models/issues/issue_user_test.go +++ b/models/issues/issue_user_test.go @@ -6,10 +6,10 @@ package issues_test import ( "testing" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/issues/issue_watch.go b/models/issues/issue_watch.go index f384e086e56..9ac7278f83f 100644 --- a/models/issues/issue_watch.go +++ b/models/issues/issue_watch.go @@ -6,10 +6,10 @@ package issues import ( "context" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" ) // IssueWatch is connection request for receiving issue notification. @@ -106,7 +106,7 @@ func GetIssueWatchers(ctx context.Context, issueID int64, listOptions db.ListOpt Join("INNER", "`user`", "`user`.id = `issue_watch`.user_id") if listOptions.Page > 0 { - sess = db.SetSessionPagination(sess, &listOptions) + db.SetSessionPagination(sess, &listOptions) watches := make([]*IssueWatch, 0, listOptions.PageSize) return watches, sess.Find(&watches) } diff --git a/models/issues/issue_watch_test.go b/models/issues/issue_watch_test.go index c860e8b8caf..9ff5bd7e8e4 100644 --- a/models/issues/issue_watch_test.go +++ b/models/issues/issue_watch_test.go @@ -6,9 +6,9 @@ package issues_test import ( "testing" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/issue_xref.go b/models/issues/issue_xref.go index 41a867c892a..0bdc48d7156 100644 --- a/models/issues/issue_xref.go +++ b/models/issues/issue_xref.go @@ -7,12 +7,12 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - access_model "code.gitea.io/gitea/models/perm/access" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/references" + "gitea.dev/models/db" + access_model "gitea.dev/models/perm/access" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/log" + "gitea.dev/modules/references" ) type crossReference struct { diff --git a/models/issues/issue_xref_test.go b/models/issues/issue_xref_test.go index b25a704bec2..4ecc6547852 100644 --- a/models/issues/issue_xref_test.go +++ b/models/issues/issue_xref_test.go @@ -7,12 +7,12 @@ import ( "fmt" "testing" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/references" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/references" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/label.go b/models/issues/label.go index 25d6f1303e8..e3312bdab14 100644 --- a/models/issues/label.go +++ b/models/issues/label.go @@ -11,12 +11,12 @@ import ( "strconv" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/label" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/container" + "gitea.dev/modules/label" + "gitea.dev/modules/optional" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -396,7 +396,7 @@ func GetLabelsByRepoID(ctx context.Context, repoID int64, sortType string, listO } if listOptions.Page > 0 { - sess = db.SetSessionPagination(sess, &listOptions) + db.SetSessionPagination(sess, &listOptions) } return labels, sess.Find(&labels) @@ -471,7 +471,7 @@ func GetLabelsByOrgID(ctx context.Context, orgID int64, sortType string, listOpt } if listOptions.Page > 0 { - sess = db.SetSessionPagination(sess, &listOptions) + db.SetSessionPagination(sess, &listOptions) } return labels, sess.Find(&labels) diff --git a/models/issues/label_test.go b/models/issues/label_test.go index 42f774e7507..f336190f0f7 100644 --- a/models/issues/label_test.go +++ b/models/issues/label_test.go @@ -6,12 +6,12 @@ package issues_test import ( "testing" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/main_test.go b/models/issues/main_test.go index ba83ca55524..ad43ffbc85c 100644 --- a/models/issues/main_test.go +++ b/models/issues/main_test.go @@ -6,14 +6,14 @@ package issues_test import ( "testing" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" - _ "code.gitea.io/gitea/models" - _ "code.gitea.io/gitea/models/actions" - _ "code.gitea.io/gitea/models/activities" - _ "code.gitea.io/gitea/models/repo" - _ "code.gitea.io/gitea/models/user" + _ "gitea.dev/models" + _ "gitea.dev/models/actions" + _ "gitea.dev/models/activities" + _ "gitea.dev/models/repo" + _ "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/milestone.go b/models/issues/milestone.go index 1dd86302765..eb3c548c087 100644 --- a/models/issues/milestone.go +++ b/models/issues/milestone.go @@ -9,12 +9,12 @@ import ( "html/template" "strings" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/optional" - api "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/optional" + api "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/issues/milestone_list.go b/models/issues/milestone_list.go index 021b8beb9e0..3b4bdc6e9f6 100644 --- a/models/issues/milestone_list.go +++ b/models/issues/milestone_list.go @@ -7,8 +7,8 @@ import ( "context" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/optional" + "gitea.dev/models/db" + "gitea.dev/modules/optional" "xorm.io/builder" ) diff --git a/models/issues/milestone_test.go b/models/issues/milestone_test.go index 107ad305d48..925038f68e2 100644 --- a/models/issues/milestone_test.go +++ b/models/issues/milestone_test.go @@ -7,14 +7,14 @@ import ( "sort" "testing" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/setting" - api "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + "gitea.dev/modules/optional" + "gitea.dev/modules/setting" + api "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/pull.go b/models/issues/pull.go index 4c8d02a990e..7dbcef0d3fe 100644 --- a/models/issues/pull.go +++ b/models/issues/pull.go @@ -11,19 +11,19 @@ import ( "io" "strings" - "code.gitea.io/gitea/models/db" - git_model "code.gitea.io/gitea/models/git" - org_model "code.gitea.io/gitea/models/organization" - pull_model "code.gitea.io/gitea/models/pull" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + git_model "gitea.dev/models/git" + org_model "gitea.dev/models/organization" + pull_model "gitea.dev/models/pull" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/git" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" - "github.com/dlclark/regexp2" + "github.com/dlclark/regexp2/v2" "xorm.io/builder" ) diff --git a/models/issues/pull_list.go b/models/issues/pull_list.go index 6a6abca9709..f271850a147 100644 --- a/models/issues/pull_list.go +++ b/models/issues/pull_list.go @@ -7,18 +7,17 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - access_model "code.gitea.io/gitea/models/perm/access" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + access_model "gitea.dev/models/perm/access" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" - "xorm.io/xorm" ) // PullRequestsOptions holds the options for PRs @@ -32,7 +31,7 @@ type PullRequestsOptions struct { BaseBranch string } -func listPullRequestStatement(ctx context.Context, baseRepoID int64, opts *PullRequestsOptions) *xorm.Session { +func listPullRequestStatement(ctx context.Context, baseRepoID int64, opts *PullRequestsOptions) db.Session { sess := db.GetEngine(ctx).Where("pull_request.base_repo_id=?", baseRepoID) if opts.BaseBranch != "" { diff --git a/models/issues/pull_list_test.go b/models/issues/pull_list_test.go index 302b2ca0ba7..1312ba1feee 100644 --- a/models/issues/pull_list_test.go +++ b/models/issues/pull_list_test.go @@ -6,13 +6,13 @@ package issues_test import ( "testing" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/perm" - "code.gitea.io/gitea/models/perm/access" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/perm" + "gitea.dev/models/perm/access" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/issues/pull_test.go b/models/issues/pull_test.go index 79d1f8aa9b4..166fdd8482b 100644 --- a/models/issues/pull_test.go +++ b/models/issues/pull_test.go @@ -6,12 +6,12 @@ package issues_test import ( "testing" - "code.gitea.io/gitea/models/db" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/issues/reaction.go b/models/issues/reaction.go index 3b5ad6d7ab9..0043379d6d8 100644 --- a/models/issues/reaction.go +++ b/models/issues/reaction.go @@ -9,13 +9,13 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -165,7 +165,7 @@ func FindReactions(ctx context.Context, opts FindReactionsOptions) (ReactionList In("reaction.`type`", setting.UI.Reactions). Asc("reaction.issue_id", "reaction.comment_id", "reaction.created_unix", "reaction.id") if opts.Page > 0 { - sess = db.SetSessionPagination(sess, &opts) + db.SetSessionPagination(sess, &opts) reactions := make([]*Reaction, 0, opts.PageSize) count, err := sess.FindAndCount(&reactions) diff --git a/models/issues/review.go b/models/issues/review.go index 78ef0d20c23..e1f522be75d 100644 --- a/models/issues/review.go +++ b/models/issues/review.go @@ -10,16 +10,16 @@ import ( "slices" "strings" - "code.gitea.io/gitea/models/db" - git_model "code.gitea.io/gitea/models/git" - "code.gitea.io/gitea/models/organization" - "code.gitea.io/gitea/models/perm" - access_model "code.gitea.io/gitea/models/perm/access" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + git_model "gitea.dev/models/git" + "gitea.dev/models/organization" + "gitea.dev/models/perm" + access_model "gitea.dev/models/perm/access" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -483,6 +483,14 @@ func SubmitReview(ctx context.Context, doer *user_model.User, issue *Issue, revi if _, err := sess.ID(review.ID).Cols("content, type, official, commit_id, stale").Update(review); err != nil { return nil, nil, err } + + // make sure the leftover review request is cleared, consistent with CreateReview + if reviewType != ReviewTypePending { + if _, err := sess.Where(builder.Eq{"reviewer_id": doer.ID, "issue_id": issue.ID, "type": ReviewTypeRequest}). + Delete(new(Review)); err != nil { + return nil, nil, err + } + } } comm, err := CreateComment(ctx, &CreateCommentOptions{ diff --git a/models/issues/review_list.go b/models/issues/review_list.go index d0430cd06d3..d65c3fc6d7d 100644 --- a/models/issues/review_list.go +++ b/models/issues/review_list.go @@ -8,11 +8,11 @@ import ( "slices" "sort" - "code.gitea.io/gitea/models/db" - organization_model "code.gitea.io/gitea/models/organization" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/optional" + "gitea.dev/models/db" + organization_model "gitea.dev/models/organization" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/optional" "xorm.io/builder" ) @@ -121,7 +121,7 @@ func FindReviews(ctx context.Context, opts FindReviewOptions) (ReviewList, error reviews := make([]*Review, 0, 10) sess := db.GetEngine(ctx).Where(opts.toCond()) if opts.Page > 0 && !opts.IsListAll() { - sess = db.SetSessionPagination(sess, &opts) + db.SetSessionPagination(sess, &opts) } return reviews, sess. Asc("created_unix"). @@ -135,7 +135,7 @@ func FindLatestReviews(ctx context.Context, opts FindReviewOptions) (ReviewList, cond := opts.toCond() sess := db.GetEngine(ctx).Where(cond) if opts.Page > 0 { - sess = db.SetSessionPagination(sess, &opts) + db.SetSessionPagination(sess, &opts) } sess.In("id", builder. diff --git a/models/issues/review_test.go b/models/issues/review_test.go index 092d88d1749..3d2672c4036 100644 --- a/models/issues/review_test.go +++ b/models/issues/review_test.go @@ -6,10 +6,10 @@ package issues_test import ( "testing" - issues_model "code.gitea.io/gitea/models/issues" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + issues_model "gitea.dev/models/issues" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) @@ -303,6 +303,46 @@ func TestDeleteDismissedReview(t *testing.T) { unittest.AssertNotExistsBean(t, &issues_model.Comment{ID: comment.ID}) } +func TestSubmitReviewClearsStaleReviewRequest(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + + issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 3}) + assert.NoError(t, issue.LoadRepo(t.Context())) + assert.NoError(t, issue.Repo.LoadOwner(t.Context())) + reviewer := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}) + doer := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2}) + + // the reviewer is requested to review the pull request + requestReview, err := issues_model.CreateReview(t.Context(), issues_model.CreateReviewOptions{ + Type: issues_model.ReviewTypeRequest, + Issue: issue, + Reviewer: reviewer, + }) + assert.NoError(t, err) + + // the reviewer starts a pending review (e.g. by adding code comments) + pendingReview, err := issues_model.CreateReview(t.Context(), issues_model.CreateReviewOptions{ + Type: issues_model.ReviewTypePending, + Issue: issue, + Reviewer: reviewer, + }) + assert.NoError(t, err) + + // submitting the pending review must clear the leftover review request, + // otherwise the reviewer can no longer be re-requested afterwards + review, _, err := issues_model.SubmitReview(t.Context(), reviewer, issue, issues_model.ReviewTypeComment, "looks good", "", false, nil) + assert.NoError(t, err) + assert.Equal(t, pendingReview.ID, review.ID) + assert.Equal(t, issues_model.ReviewTypeComment, review.Type) + + unittest.AssertNotExistsBean(t, &issues_model.Review{ID: requestReview.ID}) + + // the reviewer can be re-requested afterwards (no-op before the fix) + comment, err := issues_model.AddReviewRequest(t.Context(), issue, reviewer, doer, false) + assert.NoError(t, err) + assert.NotNil(t, comment) +} + func TestAddReviewRequest(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) diff --git a/models/issues/stopwatch.go b/models/issues/stopwatch.go index f119951b091..9ad5796c346 100644 --- a/models/issues/stopwatch.go +++ b/models/issues/stopwatch.go @@ -7,11 +7,11 @@ import ( "context" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -77,7 +77,7 @@ func GetUserStopwatches(ctx context.Context, userID int64, listOptions db.ListOp sws := make([]*Stopwatch, 0, 8) sess := db.GetEngine(ctx).Where("stopwatch.user_id = ?", userID) if listOptions.Page > 0 { - sess = db.SetSessionPagination(sess, &listOptions) + db.SetSessionPagination(sess, &listOptions) } err := sess.Find(&sws) diff --git a/models/issues/stopwatch_test.go b/models/issues/stopwatch_test.go index 684ec6cd319..e22328061f5 100644 --- a/models/issues/stopwatch_test.go +++ b/models/issues/stopwatch_test.go @@ -6,9 +6,9 @@ package issues_test import ( "testing" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) diff --git a/models/issues/tracked_time.go b/models/issues/tracked_time.go index 0b5c341f1f2..764d03e4aad 100644 --- a/models/issues/tracked_time.go +++ b/models/issues/tracked_time.go @@ -9,14 +9,13 @@ import ( "fmt" "time" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/optional" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" "xorm.io/builder" - "xorm.io/xorm" ) // TrackedTime represents a time that was spent for a specific issue. @@ -140,7 +139,7 @@ func (opts *FindTrackedTimesOptions) toSession(e db.Engine) db.Engine { sess = sess.Where(opts.ToConds()) if opts.Page > 0 { - sess = db.SetSessionPagination(sess, opts) + db.SetSessionPagination(sess, opts) } return sess @@ -344,7 +343,7 @@ func GetIssueTotalTrackedTime(ctx context.Context, opts *IssuesOptions, isClosed } func getIssueTotalTrackedTimeChunk(ctx context.Context, opts *IssuesOptions, isClosed optional.Option[bool], issueIDs []int64) (int64, error) { - sumSession := func(opts *IssuesOptions, issueIDs []int64) *xorm.Session { + sumSession := func(opts *IssuesOptions, issueIDs []int64) db.Session { sess := db.GetEngine(ctx). Table("tracked_time"). Where("tracked_time.deleted = ?", false). @@ -359,7 +358,7 @@ func getIssueTotalTrackedTimeChunk(ctx context.Context, opts *IssuesOptions, isC session := sumSession(opts, issueIDs) if isClosed.Has() { - session = session.And("issue.is_closed = ?", isClosed.Value()) + session.And("issue.is_closed = ?", isClosed.Value()) } return session.SumInt(new(trackedTime), "tracked_time.time") } diff --git a/models/issues/tracked_time_test.go b/models/issues/tracked_time_test.go index ef7c72958fc..3b8004b9e60 100644 --- a/models/issues/tracked_time_test.go +++ b/models/issues/tracked_time_test.go @@ -7,10 +7,10 @@ import ( "testing" "time" - issues_model "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/optional" + issues_model "gitea.dev/models/issues" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/optional" "github.com/stretchr/testify/assert" ) diff --git a/models/main_test.go b/models/main_test.go index 600dcc889b7..21112a1736c 100644 --- a/models/main_test.go +++ b/models/main_test.go @@ -6,14 +6,14 @@ package models import ( "testing" - activities_model "code.gitea.io/gitea/models/activities" - "code.gitea.io/gitea/models/organization" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + activities_model "gitea.dev/models/activities" + "gitea.dev/models/organization" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" - _ "code.gitea.io/gitea/models/actions" - _ "code.gitea.io/gitea/models/system" + _ "gitea.dev/models/actions" + _ "gitea.dev/models/system" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/base/db.go b/models/migrations/base/db.go index 16048c2073b..569fd2109ff 100644 --- a/models/migrations/base/db.go +++ b/models/migrations/base/db.go @@ -11,17 +11,17 @@ import ( "regexp" "strings" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) // RecreateTables will recreate the tables for the provided beans using the newly provided bean definition and move all data to that new table // WARNING: YOU MUST PROVIDE THE FULL BEAN DEFINITION -func RecreateTables(beans ...any) func(*xorm.Engine) error { - return func(x *xorm.Engine) error { +func RecreateTables(beans ...any) func(db.EngineMigration) error { + return func(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() if err := sess.Begin(); err != nil { @@ -41,7 +41,7 @@ func RecreateTables(beans ...any) func(*xorm.Engine) error { // RecreateTable will recreate the table using the newly provided bean definition and move all data to that new table // WARNING: YOU MUST PROVIDE THE FULL BEAN DEFINITION // WARNING: YOU MUST COMMIT THE SESSION AT THE END -func RecreateTable(sess *xorm.Session, bean any) error { +func RecreateTable(sess db.Session, bean any) error { // TODO: This will not work if there are foreign keys tableName := sess.Engine().TableName(bean) @@ -304,7 +304,7 @@ func RecreateTable(sess *xorm.Session, bean any) error { } // WARNING: YOU MUST COMMIT THE SESSION AT THE END -func DropTableColumns(sess *xorm.Session, tableName string, columnNames ...string) (err error) { +func DropTableColumns(sess db.Session, tableName string, columnNames ...string) (err error) { if tableName == "" || len(columnNames) == 0 { return nil } @@ -474,7 +474,7 @@ func DropTableColumns(sess *xorm.Session, tableName string, columnNames ...strin } // ModifyColumn will modify column's type or other property. SQLITE is not supported -func ModifyColumn(x *xorm.Engine, tableName string, col *schemas.Column) error { +func ModifyColumn(x db.EngineMigration, tableName string, col *schemas.Column) error { var indexes map[string]*schemas.Index var err error // MSSQL have to remove index at first, otherwise alter column will fail diff --git a/models/migrations/base/db_test.go b/models/migrations/base/db_test.go index ce6e1169d83..3f04e6620fd 100644 --- a/models/migrations/base/db_test.go +++ b/models/migrations/base/db_test.go @@ -6,8 +6,8 @@ package base import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/timeutil" "xorm.io/xorm/names" ) diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index c3a8f08b5d7..904a3ffa205 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -9,33 +9,33 @@ import ( "errors" "fmt" - "code.gitea.io/gitea/models/migrations/v1_10" - "code.gitea.io/gitea/models/migrations/v1_11" - "code.gitea.io/gitea/models/migrations/v1_12" - "code.gitea.io/gitea/models/migrations/v1_13" - "code.gitea.io/gitea/models/migrations/v1_14" - "code.gitea.io/gitea/models/migrations/v1_15" - "code.gitea.io/gitea/models/migrations/v1_16" - "code.gitea.io/gitea/models/migrations/v1_17" - "code.gitea.io/gitea/models/migrations/v1_18" - "code.gitea.io/gitea/models/migrations/v1_19" - "code.gitea.io/gitea/models/migrations/v1_20" - "code.gitea.io/gitea/models/migrations/v1_21" - "code.gitea.io/gitea/models/migrations/v1_22" - "code.gitea.io/gitea/models/migrations/v1_23" - "code.gitea.io/gitea/models/migrations/v1_24" - "code.gitea.io/gitea/models/migrations/v1_25" - "code.gitea.io/gitea/models/migrations/v1_26" - "code.gitea.io/gitea/models/migrations/v1_27" - "code.gitea.io/gitea/models/migrations/v1_6" - "code.gitea.io/gitea/models/migrations/v1_7" - "code.gitea.io/gitea/models/migrations/v1_8" - "code.gitea.io/gitea/models/migrations/v1_9" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/models/migrations/v1_10" + "gitea.dev/models/migrations/v1_11" + "gitea.dev/models/migrations/v1_12" + "gitea.dev/models/migrations/v1_13" + "gitea.dev/models/migrations/v1_14" + "gitea.dev/models/migrations/v1_15" + "gitea.dev/models/migrations/v1_16" + "gitea.dev/models/migrations/v1_17" + "gitea.dev/models/migrations/v1_18" + "gitea.dev/models/migrations/v1_19" + "gitea.dev/models/migrations/v1_20" + "gitea.dev/models/migrations/v1_21" + "gitea.dev/models/migrations/v1_22" + "gitea.dev/models/migrations/v1_23" + "gitea.dev/models/migrations/v1_24" + "gitea.dev/models/migrations/v1_25" + "gitea.dev/models/migrations/v1_26" + "gitea.dev/models/migrations/v1_27" + "gitea.dev/models/migrations/v1_6" + "gitea.dev/models/migrations/v1_7" + "gitea.dev/models/migrations/v1_8" + "gitea.dev/models/migrations/v1_9" + "gitea.dev/modules/git" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" - "xorm.io/xorm" "xorm.io/xorm/names" ) @@ -44,23 +44,23 @@ const minDBVersion = 70 // Gitea 1.5.3 type migration struct { idNumber int64 // DB version is "the last migration's idNumber" + 1 description string - migrate func(context.Context, *xorm.Engine) error + migrate func(context.Context, db.EngineMigration) error } // newMigration creates a new migration -func newMigration[T func(*xorm.Engine) error | func(context.Context, *xorm.Engine) error](idNumber int64, desc string, fn T) *migration { +func newMigration[T func(db.EngineMigration) error | func(context.Context, db.EngineMigration) error](idNumber int64, desc string, fn T) *migration { m := &migration{idNumber: idNumber, description: desc} var ok bool - if m.migrate, ok = any(fn).(func(context.Context, *xorm.Engine) error); !ok { - m.migrate = func(ctx context.Context, x *xorm.Engine) error { - return any(fn).(func(*xorm.Engine) error)(x) + if m.migrate, ok = any(fn).(func(context.Context, db.EngineMigration) error); !ok { + m.migrate = func(ctx context.Context, x db.EngineMigration) error { + return any(fn).(func(db.EngineMigration) error)(x) } } return m } // Migrate executes the migration -func (m *migration) Migrate(ctx context.Context, x *xorm.Engine) error { +func (m *migration) Migrate(ctx context.Context, x db.EngineMigration) error { return m.migrate(ctx, x) } @@ -71,7 +71,7 @@ type Version struct { } // Use noopMigration when there is a migration that has been no-oped -var noopMigration = func(_ *xorm.Engine) error { return nil } +var noopMigration = func(_ db.EngineMigration) error { return nil } var preparedMigrations []*migration @@ -409,12 +409,16 @@ func prepareMigrationTasks() []*migration { // Gitea 1.26.0 ends at migration ID number 330 (database version 331) newMigration(331, "Add ActionRunAttempt model and related action fields", v1_27.AddActionRunAttemptModel), + newMigration(332, "Add last_sync_unix to mirror", v1_27.AddLastSyncUnixToMirror), + newMigration(333, "Add bypass allowlist to branch protection", v1_27.AddBranchProtectionBypassAllowlist), + newMigration(334, "Add cancelling support to action runners", v1_27.AddCancellingSupportToActionRunner), + newMigration(335, "Add reusable workflow fields and action_run_attempt_job_id_index table for ActionRunJob", v1_27.AddReusableWorkflowFieldsToActionRunJob), } return preparedMigrations } // GetCurrentDBVersion returns the current db version -func GetCurrentDBVersion(x *xorm.Engine) (int64, error) { +func GetCurrentDBVersion(x db.EngineMigration) (int64, error) { if err := x.Sync(new(Version)); err != nil { return -1, fmt.Errorf("sync: %w", err) } @@ -447,7 +451,7 @@ func ExpectedDBVersion() int64 { } // EnsureUpToDate will check if the db is at the correct version -func EnsureUpToDate(ctx context.Context, x *xorm.Engine) error { +func EnsureUpToDate(ctx context.Context, x db.EngineMigration) error { currentDB, err := GetCurrentDBVersion(x) if err != nil { return err @@ -479,7 +483,7 @@ func migrationIDNumberToDBVersion(idNumber int64) int64 { } // Migrate database to current version -func Migrate(ctx context.Context, x *xorm.Engine) error { +func Migrate(ctx context.Context, x db.EngineMigration) error { migrations := prepareMigrationTasks() maxDBVer := calcDBVersion(migrations) @@ -498,7 +502,7 @@ func Migrate(ctx context.Context, x *xorm.Engine) error { // XORM model framework will create all tables when initializing. currentVersion.ID = 0 currentVersion.Version = maxDBVer - if _, err = x.InsertOne(currentVersion); err != nil { + if _, err = x.Insert(currentVersion); err != nil { return fmt.Errorf("insert: %w", err) } } diff --git a/models/migrations/migrations_test.go b/models/migrations/migrations_test.go index 8649d116f58..bc94d7b1e60 100644 --- a/models/migrations/migrations_test.go +++ b/models/migrations/migrations_test.go @@ -6,7 +6,7 @@ package migrations import ( "testing" - "code.gitea.io/gitea/modules/test" + "gitea.dev/modules/test" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/migrationtest/tests.go b/models/migrations/migrationtest/tests.go index ed8bb16ef1a..bafdea24cf7 100644 --- a/models/migrations/migrationtest/tests.go +++ b/models/migrations/migrationtest/tests.go @@ -8,15 +8,14 @@ import ( "path/filepath" "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/testlogger" + "gitea.dev/models/db" + "gitea.dev/models/unittest" + "gitea.dev/modules/git" + "gitea.dev/modules/setting" + "gitea.dev/modules/testlogger" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) @@ -24,7 +23,7 @@ import ( // Provide models to be sync'd with the database - in particular any models you expect fixtures to be loaded from. // // fixtures in `models/migrations/fixtures/` will be loaded automatically -func PrepareTestEnv(t *testing.T, skip int, syncModels ...any) (*xorm.Engine, func()) { +func PrepareTestEnv(t *testing.T, skip int, syncModels ...any) (db.EngineMigration, func()) { t.Helper() ourSkip := 2 ourSkip += skip @@ -72,7 +71,7 @@ func PrepareTestEnv(t *testing.T, skip int, syncModels ...any) (*xorm.Engine, fu if err := unittest.InitFixtures( unittest.FixturesOptions{ Dir: fixturesDir, - }, x); err != nil { + }); err != nil { t.Errorf("error whilst initializing fixtures from %s: %v", fixturesDir, err) return x, deferFn } @@ -89,7 +88,7 @@ func PrepareTestEnv(t *testing.T, skip int, syncModels ...any) (*xorm.Engine, fu return x, deferFn } -func LoadTableSchemasMap(t *testing.T, x *xorm.Engine) map[string]*schemas.Table { +func LoadTableSchemasMap(t *testing.T, x db.EngineMigration) map[string]*schemas.Table { tables, err := x.DBMetas() require.NoError(t, err) tableMap := make(map[string]*schemas.Table) @@ -110,6 +109,7 @@ func mainTest(m *testing.M) int { if err = git.InitFull(); err != nil { return testlogger.MainErrorf("Unable to InitFull: %v", err) } + setting.Database.SlowQueryThreshold = 0 setting.LoadDBSetting() setting.InitLoggersForTest() return m.Run() diff --git a/models/migrations/v1_10/v100.go b/models/migrations/v1_10/v100.go index 1742bea2963..9a2bf5fe092 100644 --- a/models/migrations/v1_10/v100.go +++ b/models/migrations/v1_10/v100.go @@ -8,10 +8,10 @@ import ( "strings" "time" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func UpdateMigrationServiceTypes(x *xorm.Engine) error { +func UpdateMigrationServiceTypes(x db.EngineMigration) error { type Repository struct { ID int64 OriginalServiceType int `xorm:"index default(0)"` diff --git a/models/migrations/v1_10/v101.go b/models/migrations/v1_10/v101.go index 6c8dfe24860..06415af073b 100644 --- a/models/migrations/v1_10/v101.go +++ b/models/migrations/v1_10/v101.go @@ -3,11 +3,9 @@ package v1_10 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func ChangeSomeColumnsLengthOfExternalLoginUser(x *xorm.Engine) error { +func ChangeSomeColumnsLengthOfExternalLoginUser(x db.EngineMigration) error { type ExternalLoginUser struct { AccessToken string `xorm:"TEXT"` AccessTokenSecret string `xorm:"TEXT"` diff --git a/models/migrations/v1_10/v88.go b/models/migrations/v1_10/v88.go index eb8e81c19ee..dc086488edb 100644 --- a/models/migrations/v1_10/v88.go +++ b/models/migrations/v1_10/v88.go @@ -7,14 +7,14 @@ import ( "crypto/sha1" "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) func hashContext(context string) string { return fmt.Sprintf("%x", sha1.Sum([]byte(context))) } -func AddCommitStatusContext(x *xorm.Engine) error { +func AddCommitStatusContext(x db.EngineMigration) error { type CommitStatus struct { ID int64 `xorm:"pk autoincr"` ContextHash string `xorm:"char(40) index"` diff --git a/models/migrations/v1_10/v89.go b/models/migrations/v1_10/v89.go index 0df2a6e17b6..336c637f189 100644 --- a/models/migrations/v1_10/v89.go +++ b/models/migrations/v1_10/v89.go @@ -3,9 +3,9 @@ package v1_10 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddOriginalMigrationInfo(x *xorm.Engine) error { +func AddOriginalMigrationInfo(x db.EngineMigration) error { // Issue see models/issue.go type Issue struct { OriginalAuthor string diff --git a/models/migrations/v1_10/v90.go b/models/migrations/v1_10/v90.go index 5521a97e327..b00607f5965 100644 --- a/models/migrations/v1_10/v90.go +++ b/models/migrations/v1_10/v90.go @@ -3,9 +3,9 @@ package v1_10 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func ChangeSomeColumnsLengthOfRepo(x *xorm.Engine) error { +func ChangeSomeColumnsLengthOfRepo(x db.EngineMigration) error { type Repository struct { ID int64 `xorm:"pk autoincr"` Description string `xorm:"TEXT"` diff --git a/models/migrations/v1_10/v91.go b/models/migrations/v1_10/v91.go index 08db6c27421..e78b39b7ec5 100644 --- a/models/migrations/v1_10/v91.go +++ b/models/migrations/v1_10/v91.go @@ -3,9 +3,9 @@ package v1_10 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddIndexOnRepositoryAndComment(x *xorm.Engine) error { +func AddIndexOnRepositoryAndComment(x db.EngineMigration) error { type Repository struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"index"` diff --git a/models/migrations/v1_10/v92.go b/models/migrations/v1_10/v92.go index b6c04a92348..15ed28ad20a 100644 --- a/models/migrations/v1_10/v92.go +++ b/models/migrations/v1_10/v92.go @@ -4,11 +4,12 @@ package v1_10 import ( + "gitea.dev/models/db" + "xorm.io/builder" - "xorm.io/xorm" ) -func RemoveLingeringIndexStatus(x *xorm.Engine) error { +func RemoveLingeringIndexStatus(x db.EngineMigration) error { _, err := x.Exec(builder.Delete(builder.NotIn("`repo_id`", builder.Select("`id`").From("`repository`"))).From("`repo_indexer_status`")) return err } diff --git a/models/migrations/v1_10/v93.go b/models/migrations/v1_10/v93.go index c131be9a8d8..08dc4b4118c 100644 --- a/models/migrations/v1_10/v93.go +++ b/models/migrations/v1_10/v93.go @@ -3,9 +3,9 @@ package v1_10 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddEmailNotificationEnabledToUser(x *xorm.Engine) error { +func AddEmailNotificationEnabledToUser(x db.EngineMigration) error { // User see models/user.go type User struct { EmailNotificationsPreference string `xorm:"VARCHAR(20) NOT NULL DEFAULT 'enabled'"` diff --git a/models/migrations/v1_10/v94.go b/models/migrations/v1_10/v94.go index 13b7d7b303e..ace5f4eec29 100644 --- a/models/migrations/v1_10/v94.go +++ b/models/migrations/v1_10/v94.go @@ -3,9 +3,9 @@ package v1_10 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddStatusCheckColumnsForProtectedBranches(x *xorm.Engine) error { +func AddStatusCheckColumnsForProtectedBranches(x db.EngineMigration) error { type ProtectedBranch struct { EnableStatusCheck bool `xorm:"NOT NULL DEFAULT false"` StatusCheckContexts []string `xorm:"JSON TEXT"` diff --git a/models/migrations/v1_10/v95.go b/models/migrations/v1_10/v95.go index 86b52026bfa..4638cb175a0 100644 --- a/models/migrations/v1_10/v95.go +++ b/models/migrations/v1_10/v95.go @@ -3,9 +3,9 @@ package v1_10 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddCrossReferenceColumns(x *xorm.Engine) error { +func AddCrossReferenceColumns(x db.EngineMigration) error { // Comment see models/comment.go type Comment struct { RefRepoID int64 `xorm:"index"` diff --git a/models/migrations/v1_10/v96.go b/models/migrations/v1_10/v96.go index ca35a169c4a..8fc0c8b71cc 100644 --- a/models/migrations/v1_10/v96.go +++ b/models/migrations/v1_10/v96.go @@ -6,13 +6,12 @@ package v1_10 import ( "path/filepath" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" ) -func DeleteOrphanedAttachments(x *xorm.Engine) error { +func DeleteOrphanedAttachments(x db.EngineMigration) error { type Attachment struct { ID int64 `xorm:"pk autoincr"` UUID string `xorm:"uuid UNIQUE"` diff --git a/models/migrations/v1_10/v97.go b/models/migrations/v1_10/v97.go index 5872bb63e57..554869af3e4 100644 --- a/models/migrations/v1_10/v97.go +++ b/models/migrations/v1_10/v97.go @@ -3,9 +3,9 @@ package v1_10 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddRepoAdminChangeTeamAccessColumnForUser(x *xorm.Engine) error { +func AddRepoAdminChangeTeamAccessColumnForUser(x db.EngineMigration) error { type User struct { RepoAdminChangeTeamAccess bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_10/v98.go b/models/migrations/v1_10/v98.go index d21c3264595..9f4d1eb8460 100644 --- a/models/migrations/v1_10/v98.go +++ b/models/migrations/v1_10/v98.go @@ -3,9 +3,9 @@ package v1_10 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddOriginalAuthorOnMigratedReleases(x *xorm.Engine) error { +func AddOriginalAuthorOnMigratedReleases(x db.EngineMigration) error { type Release struct { ID int64 OriginalAuthor string diff --git a/models/migrations/v1_10/v99.go b/models/migrations/v1_10/v99.go index 223c188057b..36802c6cb66 100644 --- a/models/migrations/v1_10/v99.go +++ b/models/migrations/v1_10/v99.go @@ -4,12 +4,11 @@ package v1_10 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddTaskTable(x *xorm.Engine) error { +func AddTaskTable(x db.EngineMigration) error { // TaskType defines task type type TaskType int diff --git a/models/migrations/v1_11/v102.go b/models/migrations/v1_11/v102.go index e52290afb0a..e5263f6b942 100644 --- a/models/migrations/v1_11/v102.go +++ b/models/migrations/v1_11/v102.go @@ -4,12 +4,11 @@ package v1_11 import ( - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func DropColumnHeadUserNameOnPullRequest(x *xorm.Engine) error { +func DropColumnHeadUserNameOnPullRequest(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() if err := sess.Begin(); err != nil { diff --git a/models/migrations/v1_11/v103.go b/models/migrations/v1_11/v103.go index a5157101605..1bb4fb4dffe 100644 --- a/models/migrations/v1_11/v103.go +++ b/models/migrations/v1_11/v103.go @@ -3,11 +3,9 @@ package v1_11 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddWhitelistDeployKeysToBranches(x *xorm.Engine) error { +func AddWhitelistDeployKeysToBranches(x db.EngineMigration) error { type ProtectedBranch struct { ID int64 WhitelistDeployKeys bool `xorm:"NOT NULL DEFAULT false"` diff --git a/models/migrations/v1_11/v104.go b/models/migrations/v1_11/v104.go index 3b0d3c64b2f..e907c212082 100644 --- a/models/migrations/v1_11/v104.go +++ b/models/migrations/v1_11/v104.go @@ -4,12 +4,11 @@ package v1_11 import ( - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func RemoveLabelUneededCols(x *xorm.Engine) error { +func RemoveLabelUneededCols(x db.EngineMigration) error { // Make sure the columns exist before dropping them type Label struct { QueryString string diff --git a/models/migrations/v1_11/v105.go b/models/migrations/v1_11/v105.go index d86973a0f68..49544148f80 100644 --- a/models/migrations/v1_11/v105.go +++ b/models/migrations/v1_11/v105.go @@ -3,11 +3,9 @@ package v1_11 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddTeamIncludesAllRepositories(x *xorm.Engine) error { +func AddTeamIncludesAllRepositories(x db.EngineMigration) error { type Team struct { ID int64 `xorm:"pk autoincr"` IncludesAllRepositories bool `xorm:"NOT NULL DEFAULT false"` diff --git a/models/migrations/v1_11/v106.go b/models/migrations/v1_11/v106.go index edffe186831..8e5848cb902 100644 --- a/models/migrations/v1_11/v106.go +++ b/models/migrations/v1_11/v106.go @@ -3,9 +3,7 @@ package v1_11 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" // RepoWatchMode specifies what kind of watch the user has on a repository type RepoWatchMode int8 @@ -16,7 +14,7 @@ type Watch struct { Mode RepoWatchMode `xorm:"SMALLINT NOT NULL DEFAULT 1"` } -func AddModeColumnToWatch(x *xorm.Engine) error { +func AddModeColumnToWatch(x db.EngineMigration) error { if err := x.Sync(new(Watch)); err != nil { return err } diff --git a/models/migrations/v1_11/v107.go b/models/migrations/v1_11/v107.go index a158e3bb502..83efb242537 100644 --- a/models/migrations/v1_11/v107.go +++ b/models/migrations/v1_11/v107.go @@ -3,11 +3,9 @@ package v1_11 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddTemplateToRepo(x *xorm.Engine) error { +func AddTemplateToRepo(x db.EngineMigration) error { type Repository struct { IsTemplate bool `xorm:"INDEX NOT NULL DEFAULT false"` TemplateID int64 `xorm:"INDEX"` diff --git a/models/migrations/v1_11/v108.go b/models/migrations/v1_11/v108.go index 8f14504cebf..a8b1e50b11f 100644 --- a/models/migrations/v1_11/v108.go +++ b/models/migrations/v1_11/v108.go @@ -3,11 +3,9 @@ package v1_11 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddCommentIDOnNotification(x *xorm.Engine) error { +func AddCommentIDOnNotification(x db.EngineMigration) error { type Notification struct { ID int64 `xorm:"pk autoincr"` CommentID int64 diff --git a/models/migrations/v1_11/v109.go b/models/migrations/v1_11/v109.go index f7616aec7b5..63f4e521ef9 100644 --- a/models/migrations/v1_11/v109.go +++ b/models/migrations/v1_11/v109.go @@ -3,11 +3,9 @@ package v1_11 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddCanCreateOrgRepoColumnForTeam(x *xorm.Engine) error { +func AddCanCreateOrgRepoColumnForTeam(x db.EngineMigration) error { type Team struct { CanCreateOrgRepo bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_11/v110.go b/models/migrations/v1_11/v110.go index 512f728c035..ccd5bb0fc1e 100644 --- a/models/migrations/v1_11/v110.go +++ b/models/migrations/v1_11/v110.go @@ -4,11 +4,12 @@ package v1_11 import ( - "xorm.io/xorm" + "gitea.dev/models/db" + "xorm.io/xorm/schemas" ) -func ChangeReviewContentToText(x *xorm.Engine) error { +func ChangeReviewContentToText(x db.EngineMigration) error { switch x.Dialect().URI().DBType { case schemas.MYSQL: _, err := x.Exec("ALTER TABLE review MODIFY COLUMN content TEXT") diff --git a/models/migrations/v1_11/v111.go b/models/migrations/v1_11/v111.go index 2634906565e..7f3cf4fc929 100644 --- a/models/migrations/v1_11/v111.go +++ b/models/migrations/v1_11/v111.go @@ -7,10 +7,10 @@ import ( "fmt" "slices" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddBranchProtectionCanPushAndEnableWhitelist(x *xorm.Engine) error { +func AddBranchProtectionCanPushAndEnableWhitelist(x db.EngineMigration) error { type ProtectedBranch struct { CanPush bool `xorm:"NOT NULL DEFAULT false"` EnableApprovalsWhitelist bool `xorm:"NOT NULL DEFAULT false"` @@ -132,7 +132,7 @@ func AddBranchProtectionCanPushAndEnableWhitelist(x *xorm.Engine) error { } // getUserRepoPermission static function based on issues_model.IsOfficialReviewer at 5d78792385 - getUserRepoPermission := func(sess *xorm.Session, repo *Repository, user *User) (Permission, error) { + getUserRepoPermission := func(sess db.Session, repo *Repository, user *User) (Permission, error) { var perm Permission repoOwner := new(User) @@ -305,7 +305,7 @@ func AddBranchProtectionCanPushAndEnableWhitelist(x *xorm.Engine) error { } // isOfficialReviewer static function based on 5d78792385 - isOfficialReviewer := func(sess *xorm.Session, issueID int64, reviewer *User) (bool, error) { + isOfficialReviewer := func(sess db.Session, issueID int64, reviewer *User) (bool, error) { pr := new(PullRequest) has, err := sess.ID(issueID).Get(pr) if err != nil { diff --git a/models/migrations/v1_11/v112.go b/models/migrations/v1_11/v112.go index fe45cf92221..1acc7e6dfac 100644 --- a/models/migrations/v1_11/v112.go +++ b/models/migrations/v1_11/v112.go @@ -6,15 +6,15 @@ package v1_11 import ( "path/filepath" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" "xorm.io/builder" - "xorm.io/xorm" ) -func RemoveAttachmentMissedRepo(x *xorm.Engine) error { +func RemoveAttachmentMissedRepo(x db.EngineMigration) error { type Attachment struct { UUID string `xorm:"uuid"` } diff --git a/models/migrations/v1_11/v113.go b/models/migrations/v1_11/v113.go index a4d54f66fb4..0cdf0a9dfec 100644 --- a/models/migrations/v1_11/v113.go +++ b/models/migrations/v1_11/v113.go @@ -6,10 +6,10 @@ package v1_11 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func FeatureChangeTargetBranch(x *xorm.Engine) error { +func FeatureChangeTargetBranch(x db.EngineMigration) error { type Comment struct { OldRef string NewRef string diff --git a/models/migrations/v1_11/v114.go b/models/migrations/v1_11/v114.go index 9467a8a90c9..34025428566 100644 --- a/models/migrations/v1_11/v114.go +++ b/models/migrations/v1_11/v114.go @@ -6,10 +6,10 @@ package v1_11 import ( "net/url" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func SanitizeOriginalURL(x *xorm.Engine) error { +func SanitizeOriginalURL(x db.EngineMigration) error { type Repository struct { ID int64 OriginalURL string `xorm:"VARCHAR(2048)"` diff --git a/models/migrations/v1_11/v115.go b/models/migrations/v1_11/v115.go index 5933c0520f6..d63c9c09ec7 100644 --- a/models/migrations/v1_11/v115.go +++ b/models/migrations/v1_11/v115.go @@ -12,15 +12,14 @@ import ( "path/filepath" "time" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/container" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" ) -func RenameExistingUserAvatarName(x *xorm.Engine) error { +func RenameExistingUserAvatarName(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() diff --git a/models/migrations/v1_11/v116.go b/models/migrations/v1_11/v116.go index 729fbad18b8..9397d2a02c7 100644 --- a/models/migrations/v1_11/v116.go +++ b/models/migrations/v1_11/v116.go @@ -3,11 +3,9 @@ package v1_11 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func ExtendTrackedTimes(x *xorm.Engine) error { +func ExtendTrackedTimes(x db.EngineMigration) error { type TrackedTime struct { Time int64 `xorm:"NOT NULL"` Deleted bool `xorm:"NOT NULL DEFAULT false"` diff --git a/models/migrations/v1_12/v117.go b/models/migrations/v1_12/v117.go index 73b58ca34b2..d15c55cac36 100644 --- a/models/migrations/v1_12/v117.go +++ b/models/migrations/v1_12/v117.go @@ -3,11 +3,9 @@ package v1_12 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddBlockOnRejectedReviews(x *xorm.Engine) error { +func AddBlockOnRejectedReviews(x db.EngineMigration) error { type ProtectedBranch struct { BlockOnRejectedReviews bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_12/v118.go b/models/migrations/v1_12/v118.go index e8b4249743d..878b0e8b245 100644 --- a/models/migrations/v1_12/v118.go +++ b/models/migrations/v1_12/v118.go @@ -3,11 +3,9 @@ package v1_12 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddReviewCommitAndStale(x *xorm.Engine) error { +func AddReviewCommitAndStale(x db.EngineMigration) error { type Review struct { CommitID string `xorm:"VARCHAR(40)"` Stale bool `xorm:"NOT NULL DEFAULT false"` diff --git a/models/migrations/v1_12/v119.go b/models/migrations/v1_12/v119.go index b4bf29a9359..b4ed7c42a40 100644 --- a/models/migrations/v1_12/v119.go +++ b/models/migrations/v1_12/v119.go @@ -3,11 +3,9 @@ package v1_12 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func FixMigratedRepositoryServiceType(x *xorm.Engine) error { +func FixMigratedRepositoryServiceType(x db.EngineMigration) error { // structs.GithubService: // GithubService = 2 _, err := x.Exec("UPDATE repository SET original_service_type = ? WHERE original_url LIKE 'https://github.com/%'", 2) diff --git a/models/migrations/v1_12/v120.go b/models/migrations/v1_12/v120.go index 14d515f5a7f..7f0088346f5 100644 --- a/models/migrations/v1_12/v120.go +++ b/models/migrations/v1_12/v120.go @@ -3,11 +3,9 @@ package v1_12 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddOwnerNameOnRepository(x *xorm.Engine) error { +func AddOwnerNameOnRepository(x db.EngineMigration) error { type Repository struct { OwnerName string } diff --git a/models/migrations/v1_12/v121.go b/models/migrations/v1_12/v121.go index a28ae4e1c9f..fc436259b9b 100644 --- a/models/migrations/v1_12/v121.go +++ b/models/migrations/v1_12/v121.go @@ -3,9 +3,9 @@ package v1_12 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddIsRestricted(x *xorm.Engine) error { +func AddIsRestricted(x db.EngineMigration) error { // User see models/user.go type User struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_12/v122.go b/models/migrations/v1_12/v122.go index bc1b175f6ae..c2d114d9251 100644 --- a/models/migrations/v1_12/v122.go +++ b/models/migrations/v1_12/v122.go @@ -3,11 +3,9 @@ package v1_12 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddRequireSignedCommits(x *xorm.Engine) error { +func AddRequireSignedCommits(x db.EngineMigration) error { type ProtectedBranch struct { RequireSignedCommits bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_12/v123.go b/models/migrations/v1_12/v123.go index 52b10bb8506..159d0c2e0d7 100644 --- a/models/migrations/v1_12/v123.go +++ b/models/migrations/v1_12/v123.go @@ -3,11 +3,9 @@ package v1_12 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddReactionOriginals(x *xorm.Engine) error { +func AddReactionOriginals(x db.EngineMigration) error { type Reaction struct { OriginalAuthorID int64 `xorm:"INDEX NOT NULL DEFAULT(0)"` OriginalAuthor string diff --git a/models/migrations/v1_12/v124.go b/models/migrations/v1_12/v124.go index 9a93f436d43..928d13f3a11 100644 --- a/models/migrations/v1_12/v124.go +++ b/models/migrations/v1_12/v124.go @@ -3,11 +3,9 @@ package v1_12 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddUserRepoMissingColumns(x *xorm.Engine) error { +func AddUserRepoMissingColumns(x db.EngineMigration) error { type VisibleType int type User struct { PasswdHashAlgo string `xorm:"NOT NULL DEFAULT 'pbkdf2'"` diff --git a/models/migrations/v1_12/v125.go b/models/migrations/v1_12/v125.go index 7f582ecff5e..c83c068b6b0 100644 --- a/models/migrations/v1_12/v125.go +++ b/models/migrations/v1_12/v125.go @@ -6,10 +6,10 @@ package v1_12 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddReviewMigrateInfo(x *xorm.Engine) error { +func AddReviewMigrateInfo(x db.EngineMigration) error { type Review struct { OriginalAuthor string OriginalAuthorID int64 diff --git a/models/migrations/v1_12/v126.go b/models/migrations/v1_12/v126.go index 64fd7f74787..f74dac9985d 100644 --- a/models/migrations/v1_12/v126.go +++ b/models/migrations/v1_12/v126.go @@ -4,11 +4,12 @@ package v1_12 import ( + "gitea.dev/models/db" + "xorm.io/builder" - "xorm.io/xorm" ) -func FixTopicRepositoryCount(x *xorm.Engine) error { +func FixTopicRepositoryCount(x db.EngineMigration) error { _, err := x.Exec(builder.Delete(builder.NotIn("`repo_id`", builder.Select("`id`").From("`repository`"))).From("`repo_topic`")) if err != nil { return err diff --git a/models/migrations/v1_12/v127.go b/models/migrations/v1_12/v127.go index 9bd78db95e4..2a2438bacc6 100644 --- a/models/migrations/v1_12/v127.go +++ b/models/migrations/v1_12/v127.go @@ -6,12 +6,11 @@ package v1_12 import ( "fmt" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddLanguageStats(x *xorm.Engine) error { +func AddLanguageStats(x db.EngineMigration) error { // LanguageStat see models/repo_language_stats.go type LanguageStat struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_12/v128.go b/models/migrations/v1_12/v128.go index ff5b12af18f..b2486ea3c6f 100644 --- a/models/migrations/v1_12/v128.go +++ b/models/migrations/v1_12/v128.go @@ -11,15 +11,14 @@ import ( "strings" "time" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/git/gitcmd" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/git" + "gitea.dev/modules/git/gitcmd" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" ) -func FixMergeBase(ctx context.Context, x *xorm.Engine) error { +func FixMergeBase(ctx context.Context, x db.EngineMigration) error { type Repository struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"UNIQUE(s) index"` diff --git a/models/migrations/v1_12/v129.go b/models/migrations/v1_12/v129.go index 3e4d3aca685..5867530090c 100644 --- a/models/migrations/v1_12/v129.go +++ b/models/migrations/v1_12/v129.go @@ -3,11 +3,9 @@ package v1_12 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func PurgeUnusedDependencies(x *xorm.Engine) error { +func PurgeUnusedDependencies(x db.EngineMigration) error { if _, err := x.Exec("DELETE FROM issue_dependency WHERE issue_id NOT IN (SELECT id FROM issue)"); err != nil { return err } diff --git a/models/migrations/v1_12/v130.go b/models/migrations/v1_12/v130.go index 107bb756fd6..290cb0af052 100644 --- a/models/migrations/v1_12/v130.go +++ b/models/migrations/v1_12/v130.go @@ -4,13 +4,12 @@ package v1_12 import ( - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/json" + "gitea.dev/modules/setting" ) -func ExpandWebhooks(x *xorm.Engine) error { +func ExpandWebhooks(x db.EngineMigration) error { type HookEvents struct { Create bool `json:"create"` Delete bool `json:"delete"` diff --git a/models/migrations/v1_12/v131.go b/models/migrations/v1_12/v131.go index 1266c2f1859..35831d0cc6c 100644 --- a/models/migrations/v1_12/v131.go +++ b/models/migrations/v1_12/v131.go @@ -6,10 +6,10 @@ package v1_12 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddSystemWebhookColumn(x *xorm.Engine) error { +func AddSystemWebhookColumn(x db.EngineMigration) error { type Webhook struct { IsSystemWebhook bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_12/v132.go b/models/migrations/v1_12/v132.go index 8b1ae6db935..2248251b57e 100644 --- a/models/migrations/v1_12/v132.go +++ b/models/migrations/v1_12/v132.go @@ -6,10 +6,10 @@ package v1_12 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddBranchProtectionProtectedFilesColumn(x *xorm.Engine) error { +func AddBranchProtectionProtectedFilesColumn(x db.EngineMigration) error { type ProtectedBranch struct { ProtectedFilePatterns string `xorm:"TEXT"` } diff --git a/models/migrations/v1_12/v133.go b/models/migrations/v1_12/v133.go index 69e20597d85..6eb6cdc5041 100644 --- a/models/migrations/v1_12/v133.go +++ b/models/migrations/v1_12/v133.go @@ -3,9 +3,9 @@ package v1_12 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddEmailHashTable(x *xorm.Engine) error { +func AddEmailHashTable(x db.EngineMigration) error { // EmailHash represents a pre-generated hash map type EmailHash struct { Hash string `xorm:"pk varchar(32)"` diff --git a/models/migrations/v1_12/v134.go b/models/migrations/v1_12/v134.go index 98bb8dbda72..017fb547d39 100644 --- a/models/migrations/v1_12/v134.go +++ b/models/migrations/v1_12/v134.go @@ -11,14 +11,13 @@ import ( "strings" "time" - "code.gitea.io/gitea/modules/git/gitcmd" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/git/gitcmd" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" ) -func RefixMergeBase(ctx context.Context, x *xorm.Engine) error { +func RefixMergeBase(ctx context.Context, x db.EngineMigration) error { type Repository struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"UNIQUE(s) index"` diff --git a/models/migrations/v1_12/v135.go b/models/migrations/v1_12/v135.go index 5df0ad7fc4f..00664ca2ff1 100644 --- a/models/migrations/v1_12/v135.go +++ b/models/migrations/v1_12/v135.go @@ -6,10 +6,10 @@ package v1_12 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddOrgIDLabelColumn(x *xorm.Engine) error { +func AddOrgIDLabelColumn(x db.EngineMigration) error { type Label struct { OrgID int64 `xorm:"INDEX"` } diff --git a/models/migrations/v1_12/v136.go b/models/migrations/v1_12/v136.go index 20b892b6cc5..66f7b2aea4e 100644 --- a/models/migrations/v1_12/v136.go +++ b/models/migrations/v1_12/v136.go @@ -8,16 +8,15 @@ import ( "math" "time" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/gitrepo" - "code.gitea.io/gitea/modules/graceful" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/gitrepo" + "gitea.dev/modules/graceful" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" ) -func AddCommitDivergenceToPulls(x *xorm.Engine) error { +func AddCommitDivergenceToPulls(x db.EngineMigration) error { type Repository struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"UNIQUE(s) index"` diff --git a/models/migrations/v1_12/v137.go b/models/migrations/v1_12/v137.go index 9d384834882..c8ef8dbd430 100644 --- a/models/migrations/v1_12/v137.go +++ b/models/migrations/v1_12/v137.go @@ -3,11 +3,9 @@ package v1_12 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddBlockOnOutdatedBranch(x *xorm.Engine) error { +func AddBlockOnOutdatedBranch(x db.EngineMigration) error { type ProtectedBranch struct { BlockOnOutdatedBranch bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_12/v138.go b/models/migrations/v1_12/v138.go index 4485adeb2dc..fa418abc709 100644 --- a/models/migrations/v1_12/v138.go +++ b/models/migrations/v1_12/v138.go @@ -6,10 +6,10 @@ package v1_12 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddResolveDoerIDCommentColumn(x *xorm.Engine) error { +func AddResolveDoerIDCommentColumn(x db.EngineMigration) error { type Comment struct { ResolveDoerID int64 } diff --git a/models/migrations/v1_12/v139.go b/models/migrations/v1_12/v139.go index a3799841ac5..6c57fdef0b9 100644 --- a/models/migrations/v1_12/v139.go +++ b/models/migrations/v1_12/v139.go @@ -4,12 +4,11 @@ package v1_12 import ( - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) -func PrependRefsHeadsToIssueRefs(x *xorm.Engine) error { +func PrependRefsHeadsToIssueRefs(x db.EngineMigration) error { var query string switch { diff --git a/models/migrations/v1_13/v140.go b/models/migrations/v1_13/v140.go index a9a047bca9d..8c8e5d795a0 100644 --- a/models/migrations/v1_13/v140.go +++ b/models/migrations/v1_13/v140.go @@ -6,13 +6,12 @@ package v1_13 import ( "fmt" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/setting" ) -func FixLanguageStatsToSaveSize(x *xorm.Engine) error { +func FixLanguageStatsToSaveSize(x db.EngineMigration) error { // LanguageStat see models/repo_language_stats.go type LanguageStat struct { Size int64 `xorm:"NOT NULL DEFAULT 0"` diff --git a/models/migrations/v1_13/v141.go b/models/migrations/v1_13/v141.go index b54bc1727cb..e6d56ffa5ed 100644 --- a/models/migrations/v1_13/v141.go +++ b/models/migrations/v1_13/v141.go @@ -6,10 +6,10 @@ package v1_13 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddKeepActivityPrivateUserColumn(x *xorm.Engine) error { +func AddKeepActivityPrivateUserColumn(x db.EngineMigration) error { type User struct { KeepActivityPrivate bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_13/v142.go b/models/migrations/v1_13/v142.go index d08a0ae0bf4..189504772ff 100644 --- a/models/migrations/v1_13/v142.go +++ b/models/migrations/v1_13/v142.go @@ -4,13 +4,13 @@ package v1_13 import ( - "code.gitea.io/gitea/modules/log" + "gitea.dev/models/db" + "gitea.dev/modules/log" "xorm.io/builder" - "xorm.io/xorm" ) -func SetIsArchivedToFalse(x *xorm.Engine) error { +func SetIsArchivedToFalse(x db.EngineMigration) error { type Repository struct { IsArchived bool `xorm:"INDEX"` } diff --git a/models/migrations/v1_13/v143.go b/models/migrations/v1_13/v143.go index b9a856ed0fa..283611e764e 100644 --- a/models/migrations/v1_13/v143.go +++ b/models/migrations/v1_13/v143.go @@ -4,12 +4,11 @@ package v1_13 import ( - "code.gitea.io/gitea/modules/log" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/log" ) -func RecalculateStars(x *xorm.Engine) (err error) { +func RecalculateStars(x db.EngineMigration) (err error) { // because of issue https://github.com/go-gitea/gitea/issues/11949, // recalculate Stars number for all users to fully fix it. diff --git a/models/migrations/v1_13/v144.go b/models/migrations/v1_13/v144.go index 9352d78bc88..0e51ab9cb91 100644 --- a/models/migrations/v1_13/v144.go +++ b/models/migrations/v1_13/v144.go @@ -4,13 +4,13 @@ package v1_13 import ( - "code.gitea.io/gitea/modules/log" + "gitea.dev/models/db" + "gitea.dev/modules/log" "xorm.io/builder" - "xorm.io/xorm" ) -func UpdateMatrixWebhookHTTPMethod(x *xorm.Engine) error { +func UpdateMatrixWebhookHTTPMethod(x db.EngineMigration) error { matrixHookTaskType := 9 // value comes from the models package type Webhook struct { HTTPMethod string diff --git a/models/migrations/v1_13/v145.go b/models/migrations/v1_13/v145.go index 86ebb4f9d95..b46b269650f 100644 --- a/models/migrations/v1_13/v145.go +++ b/models/migrations/v1_13/v145.go @@ -6,12 +6,11 @@ package v1_13 import ( "fmt" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) -func IncreaseLanguageField(x *xorm.Engine) error { +func IncreaseLanguageField(x db.EngineMigration) error { type LanguageStat struct { RepoID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"` Language string `xorm:"VARCHAR(50) UNIQUE(s) INDEX NOT NULL"` diff --git a/models/migrations/v1_13/v146.go b/models/migrations/v1_13/v146.go index 355c772c268..dc0cb1a4e19 100644 --- a/models/migrations/v1_13/v146.go +++ b/models/migrations/v1_13/v146.go @@ -4,12 +4,11 @@ package v1_13 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddProjectsInfo(x *xorm.Engine) error { +func AddProjectsInfo(x db.EngineMigration) error { // Create new tables type ( ProjectType uint8 diff --git a/models/migrations/v1_13/v147.go b/models/migrations/v1_13/v147.go index 0059c062203..314b4578b60 100644 --- a/models/migrations/v1_13/v147.go +++ b/models/migrations/v1_13/v147.go @@ -4,12 +4,11 @@ package v1_13 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func CreateReviewsForCodeComments(x *xorm.Engine) error { +func CreateReviewsForCodeComments(x db.EngineMigration) error { // Review type Review struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_13/v148.go b/models/migrations/v1_13/v148.go index d276db3d61d..c1c27a49d43 100644 --- a/models/migrations/v1_13/v148.go +++ b/models/migrations/v1_13/v148.go @@ -3,11 +3,9 @@ package v1_13 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func PurgeInvalidDependenciesComments(x *xorm.Engine) error { +func PurgeInvalidDependenciesComments(x db.EngineMigration) error { _, err := x.Exec("DELETE FROM comment WHERE dependent_issue_id != 0 AND dependent_issue_id NOT IN (SELECT id FROM issue)") return err } diff --git a/models/migrations/v1_13/v149.go b/models/migrations/v1_13/v149.go index a96b8e5ac7d..09f1e818516 100644 --- a/models/migrations/v1_13/v149.go +++ b/models/migrations/v1_13/v149.go @@ -6,12 +6,11 @@ package v1_13 import ( "fmt" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddCreatedAndUpdatedToMilestones(x *xorm.Engine) error { +func AddCreatedAndUpdatedToMilestones(x db.EngineMigration) error { type Milestone struct { CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` diff --git a/models/migrations/v1_13/v150.go b/models/migrations/v1_13/v150.go index 590ea729030..a1e8236f7d1 100644 --- a/models/migrations/v1_13/v150.go +++ b/models/migrations/v1_13/v150.go @@ -4,13 +4,12 @@ package v1_13 import ( - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/timeutil" ) -func AddPrimaryKeyToRepoTopic(x *xorm.Engine) error { +func AddPrimaryKeyToRepoTopic(x db.EngineMigration) error { // Topic represents a topic of repositories type Topic struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_13/v151.go b/models/migrations/v1_13/v151.go index 454929534fe..995d4b32fa9 100644 --- a/models/migrations/v1_13/v151.go +++ b/models/migrations/v1_13/v151.go @@ -9,14 +9,14 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) -func SetDefaultPasswordToArgon2(x *xorm.Engine) error { +func SetDefaultPasswordToArgon2(x db.EngineMigration) error { switch { case setting.Database.Type.IsMySQL(): _, err := x.Exec("ALTER TABLE `user` ALTER passwd_hash_algo SET DEFAULT 'argon2';") diff --git a/models/migrations/v1_13/v152.go b/models/migrations/v1_13/v152.go index 648e26446fe..42055d0e78f 100644 --- a/models/migrations/v1_13/v152.go +++ b/models/migrations/v1_13/v152.go @@ -3,9 +3,9 @@ package v1_13 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddTrustModelToRepository(x *xorm.Engine) error { +func AddTrustModelToRepository(x db.EngineMigration) error { type Repository struct { TrustModel int } diff --git a/models/migrations/v1_13/v153.go b/models/migrations/v1_13/v153.go index e5462fc1624..c04d1b64a3e 100644 --- a/models/migrations/v1_13/v153.go +++ b/models/migrations/v1_13/v153.go @@ -3,11 +3,9 @@ package v1_13 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddTeamReviewRequestSupport(x *xorm.Engine) error { +func AddTeamReviewRequestSupport(x db.EngineMigration) error { type Review struct { ReviewerTeamID int64 `xorm:"NOT NULL DEFAULT 0"` } diff --git a/models/migrations/v1_13/v154.go b/models/migrations/v1_13/v154.go index 5477d1b8891..1954a04692e 100644 --- a/models/migrations/v1_13/v154.go +++ b/models/migrations/v1_13/v154.go @@ -4,12 +4,11 @@ package v1_13 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddTimeStamps(x *xorm.Engine) error { +func AddTimeStamps(x db.EngineMigration) error { // this will add timestamps where it is useful to have // Star represents a starred repo by an user. diff --git a/models/migrations/v1_14/main_test.go b/models/migrations/v1_14/main_test.go index 6ed240c4075..31aacc52111 100644 --- a/models/migrations/v1_14/main_test.go +++ b/models/migrations/v1_14/main_test.go @@ -6,7 +6,7 @@ package v1_14 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_14/v155.go b/models/migrations/v1_14/v155.go index 505a9ae0334..f605c18d57b 100644 --- a/models/migrations/v1_14/v155.go +++ b/models/migrations/v1_14/v155.go @@ -6,10 +6,10 @@ package v1_14 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddChangedProtectedFilesPullRequestColumn(x *xorm.Engine) error { +func AddChangedProtectedFilesPullRequestColumn(x db.EngineMigration) error { type PullRequest struct { ChangedProtectedFiles []string `xorm:"TEXT JSON"` } diff --git a/models/migrations/v1_14/v156.go b/models/migrations/v1_14/v156.go index 593d3f9c70c..e1078f4bd05 100644 --- a/models/migrations/v1_14/v156.go +++ b/models/migrations/v1_14/v156.go @@ -9,11 +9,10 @@ import ( "path/filepath" "strings" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/git" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" ) // Copy paste from models/repo.go because we cannot import models package @@ -25,7 +24,7 @@ func userPath(userName string) string { return filepath.Join(setting.RepoRootPath, strings.ToLower(userName)) } -func FixPublisherIDforTagReleases(ctx context.Context, x *xorm.Engine) error { +func FixPublisherIDforTagReleases(ctx context.Context, x db.EngineMigration) error { type Release struct { ID int64 RepoID int64 diff --git a/models/migrations/v1_14/v157.go b/models/migrations/v1_14/v157.go index 2c5625ebbd4..b6058a03039 100644 --- a/models/migrations/v1_14/v157.go +++ b/models/migrations/v1_14/v157.go @@ -3,11 +3,9 @@ package v1_14 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func FixRepoTopics(x *xorm.Engine) error { +func FixRepoTopics(x db.EngineMigration) error { type Repository struct { ID int64 `xorm:"pk autoincr"` Topics []string `xorm:"TEXT JSON"` diff --git a/models/migrations/v1_14/v158.go b/models/migrations/v1_14/v158.go index 3c57e8e3daa..62f8036b355 100644 --- a/models/migrations/v1_14/v158.go +++ b/models/migrations/v1_14/v158.go @@ -7,13 +7,12 @@ import ( "errors" "strconv" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" ) -func UpdateCodeCommentReplies(x *xorm.Engine) error { +func UpdateCodeCommentReplies(x db.EngineMigration) error { type Comment struct { ID int64 `xorm:"pk autoincr"` CommitSHA string `xorm:"VARCHAR(40)"` diff --git a/models/migrations/v1_14/v159.go b/models/migrations/v1_14/v159.go index e6f6f0f061a..1dd2e1c639f 100644 --- a/models/migrations/v1_14/v159.go +++ b/models/migrations/v1_14/v159.go @@ -4,13 +4,12 @@ package v1_14 import ( - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/timeutil" ) -func UpdateReactionConstraint(x *xorm.Engine) error { +func UpdateReactionConstraint(x db.EngineMigration) error { // Reaction represents a reactions on issues and comments. type Reaction struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_14/v160.go b/models/migrations/v1_14/v160.go index 73f37989547..b216929387c 100644 --- a/models/migrations/v1_14/v160.go +++ b/models/migrations/v1_14/v160.go @@ -3,11 +3,9 @@ package v1_14 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddBlockOnOfficialReviewRequests(x *xorm.Engine) error { +func AddBlockOnOfficialReviewRequests(x db.EngineMigration) error { type ProtectedBranch struct { BlockOnOfficialReviewRequests bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_14/v161.go b/models/migrations/v1_14/v161.go index eb92dee77cb..78ef19c34d3 100644 --- a/models/migrations/v1_14/v161.go +++ b/models/migrations/v1_14/v161.go @@ -6,12 +6,11 @@ package v1_14 import ( "context" - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func ConvertTaskTypeToString(x *xorm.Engine) error { +func ConvertTaskTypeToString(x db.EngineMigration) error { const ( GOGS int = iota + 1 SLACK diff --git a/models/migrations/v1_14/v162.go b/models/migrations/v1_14/v162.go index a0ddd36d55f..02bc48938ed 100644 --- a/models/migrations/v1_14/v162.go +++ b/models/migrations/v1_14/v162.go @@ -4,12 +4,11 @@ package v1_14 import ( - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func ConvertWebhookTaskTypeToString(x *xorm.Engine) error { +func ConvertWebhookTaskTypeToString(x db.EngineMigration) error { const ( GOGS int = iota + 1 SLACK diff --git a/models/migrations/v1_14/v163.go b/models/migrations/v1_14/v163.go index 84c35190b7b..08819d2dc56 100644 --- a/models/migrations/v1_14/v163.go +++ b/models/migrations/v1_14/v163.go @@ -4,12 +4,11 @@ package v1_14 import ( - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func ConvertTopicNameFrom25To50(x *xorm.Engine) error { +func ConvertTopicNameFrom25To50(x db.EngineMigration) error { type Topic struct { ID int64 `xorm:"pk autoincr"` Name string `xorm:"UNIQUE VARCHAR(50)"` diff --git a/models/migrations/v1_14/v164.go b/models/migrations/v1_14/v164.go index d2fd9b8464a..58325ca4044 100644 --- a/models/migrations/v1_14/v164.go +++ b/models/migrations/v1_14/v164.go @@ -6,7 +6,7 @@ package v1_14 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) // OAuth2Grant here is a snapshot of models.OAuth2Grant for this version @@ -29,7 +29,7 @@ func (grant *OAuth2Grant) TableName() string { return "oauth2_grant" } -func AddScopeAndNonceColumnsToOAuth2Grant(x *xorm.Engine) error { +func AddScopeAndNonceColumnsToOAuth2Grant(x db.EngineMigration) error { if err := x.Sync(new(OAuth2Grant)); err != nil { return fmt.Errorf("Sync: %w", err) } diff --git a/models/migrations/v1_14/v165.go b/models/migrations/v1_14/v165.go index 6e1b34156b8..d5fa4d008d8 100644 --- a/models/migrations/v1_14/v165.go +++ b/models/migrations/v1_14/v165.go @@ -4,13 +4,13 @@ package v1_14 import ( - "code.gitea.io/gitea/models/migrations/base" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) -func ConvertHookTaskTypeToVarcharAndTrim(x *xorm.Engine) error { +func ConvertHookTaskTypeToVarcharAndTrim(x db.EngineMigration) error { dbType := x.Dialect().URI().DBType if dbType == schemas.SQLITE { // For SQLITE, varchar or char will always be represented as TEXT return nil diff --git a/models/migrations/v1_14/v166.go b/models/migrations/v1_14/v166.go index 4c106bd7daf..ca03363d558 100644 --- a/models/migrations/v1_14/v166.go +++ b/models/migrations/v1_14/v166.go @@ -7,15 +7,16 @@ import ( "crypto/sha256" "encoding/hex" + "gitea.dev/models/db" + "golang.org/x/crypto/argon2" "golang.org/x/crypto/bcrypt" "golang.org/x/crypto/pbkdf2" "golang.org/x/crypto/scrypt" "xorm.io/builder" - "xorm.io/xorm" ) -func RecalculateUserEmptyPWD(x *xorm.Engine) (err error) { +func RecalculateUserEmptyPWD(x db.EngineMigration) (err error) { const ( algoBcrypt = "bcrypt" algoScrypt = "scrypt" diff --git a/models/migrations/v1_14/v167.go b/models/migrations/v1_14/v167.go index d77bbc401e5..ac1e6c04985 100644 --- a/models/migrations/v1_14/v167.go +++ b/models/migrations/v1_14/v167.go @@ -6,10 +6,10 @@ package v1_14 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddUserRedirect(x *xorm.Engine) (err error) { +func AddUserRedirect(x db.EngineMigration) (err error) { type UserRedirect struct { ID int64 `xorm:"pk autoincr"` LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"` diff --git a/models/migrations/v1_14/v168.go b/models/migrations/v1_14/v168.go index aa93eec19b0..f8eda53fd87 100644 --- a/models/migrations/v1_14/v168.go +++ b/models/migrations/v1_14/v168.go @@ -3,8 +3,8 @@ package v1_14 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func RecreateUserTableToFixDefaultValues(_ *xorm.Engine) error { +func RecreateUserTableToFixDefaultValues(_ db.EngineMigration) error { return nil } diff --git a/models/migrations/v1_14/v169.go b/models/migrations/v1_14/v169.go index 4f9df0d96f2..3bb542516b5 100644 --- a/models/migrations/v1_14/v169.go +++ b/models/migrations/v1_14/v169.go @@ -3,11 +3,9 @@ package v1_14 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func CommentTypeDeleteBranchUseOldRef(x *xorm.Engine) error { +func CommentTypeDeleteBranchUseOldRef(x db.EngineMigration) error { _, err := x.Exec("UPDATE comment SET old_ref = commit_sha, commit_sha = '' WHERE type = 11") return err } diff --git a/models/migrations/v1_14/v170.go b/models/migrations/v1_14/v170.go index a2ff4623e14..1626316a20c 100644 --- a/models/migrations/v1_14/v170.go +++ b/models/migrations/v1_14/v170.go @@ -6,10 +6,10 @@ package v1_14 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddDismissedReviewColumn(x *xorm.Engine) error { +func AddDismissedReviewColumn(x db.EngineMigration) error { type Review struct { Dismissed bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_14/v171.go b/models/migrations/v1_14/v171.go index 7b200e960ad..4e6577592aa 100644 --- a/models/migrations/v1_14/v171.go +++ b/models/migrations/v1_14/v171.go @@ -6,10 +6,10 @@ package v1_14 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddSortingColToProjectBoard(x *xorm.Engine) error { +func AddSortingColToProjectBoard(x db.EngineMigration) error { type ProjectBoard struct { Sorting int8 `xorm:"NOT NULL DEFAULT 0"` } diff --git a/models/migrations/v1_14/v172.go b/models/migrations/v1_14/v172.go index bbd61d87b28..d912ba3b78d 100644 --- a/models/migrations/v1_14/v172.go +++ b/models/migrations/v1_14/v172.go @@ -4,12 +4,11 @@ package v1_14 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddSessionTable(x *xorm.Engine) error { +func AddSessionTable(x db.EngineMigration) error { type Session struct { Key string `xorm:"pk CHAR(16)"` Data []byte `xorm:"BLOB"` diff --git a/models/migrations/v1_14/v173.go b/models/migrations/v1_14/v173.go index 7752fbe9664..51278211b5e 100644 --- a/models/migrations/v1_14/v173.go +++ b/models/migrations/v1_14/v173.go @@ -6,10 +6,10 @@ package v1_14 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddTimeIDCommentColumn(x *xorm.Engine) error { +func AddTimeIDCommentColumn(x db.EngineMigration) error { type Comment struct { TimeID int64 } diff --git a/models/migrations/v1_14/v174.go b/models/migrations/v1_14/v174.go index 4049e43070d..4e88e892c9b 100644 --- a/models/migrations/v1_14/v174.go +++ b/models/migrations/v1_14/v174.go @@ -6,10 +6,10 @@ package v1_14 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddRepoTransfer(x *xorm.Engine) error { +func AddRepoTransfer(x db.EngineMigration) error { type RepoTransfer struct { ID int64 `xorm:"pk autoincr"` DoerID int64 diff --git a/models/migrations/v1_14/v175.go b/models/migrations/v1_14/v175.go index 92ed1304734..556996e9726 100644 --- a/models/migrations/v1_14/v175.go +++ b/models/migrations/v1_14/v175.go @@ -7,13 +7,12 @@ import ( "fmt" "regexp" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" ) -func FixPostgresIDSequences(x *xorm.Engine) error { +func FixPostgresIDSequences(x db.EngineMigration) error { if !setting.Database.Type.IsPostgreSQL() { return nil } diff --git a/models/migrations/v1_14/v176.go b/models/migrations/v1_14/v176.go index ef5dce9a027..a464ed56ec6 100644 --- a/models/migrations/v1_14/v176.go +++ b/models/migrations/v1_14/v176.go @@ -3,14 +3,12 @@ package v1_14 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" // RemoveInvalidLabels looks through the database to look for comments and issue_labels // that refer to labels do not belong to the repository or organization that repository // that the issue is in -func RemoveInvalidLabels(x *xorm.Engine) error { +func RemoveInvalidLabels(x db.EngineMigration) error { type Comment struct { ID int64 `xorm:"pk autoincr"` Type int `xorm:"INDEX"` diff --git a/models/migrations/v1_14/v176_test.go b/models/migrations/v1_14/v176_test.go index aa57b5ad1d9..7a830d8d512 100644 --- a/models/migrations/v1_14/v176_test.go +++ b/models/migrations/v1_14/v176_test.go @@ -6,7 +6,7 @@ package v1_14 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_14/v177.go b/models/migrations/v1_14/v177.go index 96676bf8d94..7230693909b 100644 --- a/models/migrations/v1_14/v177.go +++ b/models/migrations/v1_14/v177.go @@ -6,11 +6,11 @@ package v1_14 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) // DeleteOrphanedIssueLabels looks through the database for issue_labels where the label no longer exists and deletes them. -func DeleteOrphanedIssueLabels(x *xorm.Engine) error { +func DeleteOrphanedIssueLabels(x db.EngineMigration) error { type IssueLabel struct { ID int64 `xorm:"pk autoincr"` IssueID int64 `xorm:"UNIQUE(s)"` diff --git a/models/migrations/v1_14/v177_test.go b/models/migrations/v1_14/v177_test.go index a86fb98830c..4b80dc7d6aa 100644 --- a/models/migrations/v1_14/v177_test.go +++ b/models/migrations/v1_14/v177_test.go @@ -6,8 +6,8 @@ package v1_14 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_15/main_test.go b/models/migrations/v1_15/main_test.go index 768bbd310b0..87b10d3b76d 100644 --- a/models/migrations/v1_15/main_test.go +++ b/models/migrations/v1_15/main_test.go @@ -6,7 +6,7 @@ package v1_15 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_15/v178.go b/models/migrations/v1_15/v178.go index ca3a5c262e4..35bbf74f419 100644 --- a/models/migrations/v1_15/v178.go +++ b/models/migrations/v1_15/v178.go @@ -3,11 +3,9 @@ package v1_15 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddLFSMirrorColumns(x *xorm.Engine) error { +func AddLFSMirrorColumns(x db.EngineMigration) error { type Mirror struct { LFS bool `xorm:"lfs_enabled NOT NULL DEFAULT false"` LFSEndpoint string `xorm:"lfs_endpoint TEXT"` diff --git a/models/migrations/v1_15/v179.go b/models/migrations/v1_15/v179.go index d6fb86ffecc..4380bc560aa 100644 --- a/models/migrations/v1_15/v179.go +++ b/models/migrations/v1_15/v179.go @@ -4,13 +4,13 @@ package v1_15 import ( - "code.gitea.io/gitea/models/migrations/base" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) -func ConvertAvatarURLToText(x *xorm.Engine) error { +func ConvertAvatarURLToText(x db.EngineMigration) error { dbType := x.Dialect().URI().DBType if dbType == schemas.SQLITE { // For SQLITE, varchar or char will always be represented as TEXT return nil diff --git a/models/migrations/v1_15/v180.go b/models/migrations/v1_15/v180.go index dd132f83306..b5247b1a333 100644 --- a/models/migrations/v1_15/v180.go +++ b/models/migrations/v1_15/v180.go @@ -4,14 +4,14 @@ package v1_15 import ( - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/json" + "gitea.dev/modules/util" "xorm.io/builder" - "xorm.io/xorm" ) -func DeleteMigrationCredentials(x *xorm.Engine) (err error) { +func DeleteMigrationCredentials(x db.EngineMigration) (err error) { // Task represents a task type Task struct { ID int64 diff --git a/models/migrations/v1_15/v181.go b/models/migrations/v1_15/v181.go index fb1d3d7a75f..841a8a85e56 100644 --- a/models/migrations/v1_15/v181.go +++ b/models/migrations/v1_15/v181.go @@ -6,10 +6,10 @@ package v1_15 import ( "strings" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddPrimaryEmail2EmailAddress(x *xorm.Engine) error { +func AddPrimaryEmail2EmailAddress(x db.EngineMigration) error { type User struct { ID int64 `xorm:"pk autoincr"` Email string `xorm:"NOT NULL"` diff --git a/models/migrations/v1_15/v181_test.go b/models/migrations/v1_15/v181_test.go index e230c684eab..4e004abcb0c 100644 --- a/models/migrations/v1_15/v181_test.go +++ b/models/migrations/v1_15/v181_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_15/v182.go b/models/migrations/v1_15/v182.go index f53ff11df9c..2fc8f06225e 100644 --- a/models/migrations/v1_15/v182.go +++ b/models/migrations/v1_15/v182.go @@ -3,11 +3,9 @@ package v1_15 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddIssueResourceIndexTable(x *xorm.Engine) error { +func AddIssueResourceIndexTable(x db.EngineMigration) error { type ResourceIndex struct { GroupID int64 `xorm:"pk"` MaxIndex int64 `xorm:"index"` diff --git a/models/migrations/v1_15/v182_test.go b/models/migrations/v1_15/v182_test.go index c0a1378534c..049f9a17850 100644 --- a/models/migrations/v1_15/v182_test.go +++ b/models/migrations/v1_15/v182_test.go @@ -6,7 +6,7 @@ package v1_15 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_15/v183.go b/models/migrations/v1_15/v183.go index 5d0582f03d4..dee388a961b 100644 --- a/models/migrations/v1_15/v183.go +++ b/models/migrations/v1_15/v183.go @@ -7,12 +7,11 @@ import ( "fmt" "time" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func CreatePushMirrorTable(x *xorm.Engine) error { +func CreatePushMirrorTable(x db.EngineMigration) error { type PushMirror struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` diff --git a/models/migrations/v1_15/v184.go b/models/migrations/v1_15/v184.go index 2823bc1f7af..21ae3395222 100644 --- a/models/migrations/v1_15/v184.go +++ b/models/migrations/v1_15/v184.go @@ -7,13 +7,12 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/setting" ) -func RenameTaskErrorsToMessage(x *xorm.Engine) error { +func RenameTaskErrorsToMessage(x db.EngineMigration) error { type Task struct { Errors string `xorm:"TEXT"` // if task failed, saved the error reason Type int diff --git a/models/migrations/v1_15/v185.go b/models/migrations/v1_15/v185.go index 60af59edca4..1a6d84afff1 100644 --- a/models/migrations/v1_15/v185.go +++ b/models/migrations/v1_15/v185.go @@ -3,11 +3,9 @@ package v1_15 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddRepoArchiver(x *xorm.Engine) error { +func AddRepoArchiver(x db.EngineMigration) error { // RepoArchiver represents all archivers type RepoArchiver struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_15/v186.go b/models/migrations/v1_15/v186.go index 67dc97d13d7..44e096fecb9 100644 --- a/models/migrations/v1_15/v186.go +++ b/models/migrations/v1_15/v186.go @@ -4,12 +4,11 @@ package v1_15 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func CreateProtectedTagTable(x *xorm.Engine) error { +func CreateProtectedTagTable(x db.EngineMigration) error { type ProtectedTag struct { ID int64 `xorm:"pk autoincr"` RepoID int64 diff --git a/models/migrations/v1_15/v187.go b/models/migrations/v1_15/v187.go index 5fd90c65fbf..e8c388554b5 100644 --- a/models/migrations/v1_15/v187.go +++ b/models/migrations/v1_15/v187.go @@ -4,12 +4,11 @@ package v1_15 import ( - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func DropWebhookColumns(x *xorm.Engine) error { +func DropWebhookColumns(x db.EngineMigration) error { // Make sure the columns exist before dropping them type Webhook struct { Signature string `xorm:"TEXT"` diff --git a/models/migrations/v1_15/v188.go b/models/migrations/v1_15/v188.go index 4494e6ff055..d3f9de33618 100644 --- a/models/migrations/v1_15/v188.go +++ b/models/migrations/v1_15/v188.go @@ -3,9 +3,9 @@ package v1_15 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddKeyIsVerified(x *xorm.Engine) error { +func AddKeyIsVerified(x db.EngineMigration) error { type GPGKey struct { Verified bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_16/main_test.go b/models/migrations/v1_16/main_test.go index c54424788d6..aac2609f0e0 100644 --- a/models/migrations/v1_16/main_test.go +++ b/models/migrations/v1_16/main_test.go @@ -6,7 +6,7 @@ package v1_16 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_16/v189.go b/models/migrations/v1_16/v189.go index 6bc99e58ab7..419135c8818 100644 --- a/models/migrations/v1_16/v189.go +++ b/models/migrations/v1_16/v189.go @@ -7,13 +7,12 @@ import ( "encoding/binary" "fmt" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/json" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/json" ) -func UnwrapLDAPSourceCfg(x *xorm.Engine) error { +func UnwrapLDAPSourceCfg(x db.EngineMigration) error { jsonUnmarshalHandleDoubleEncode := func(bs []byte, v any) error { err := json.Unmarshal(bs, v) if err != nil { diff --git a/models/migrations/v1_16/v189_test.go b/models/migrations/v1_16/v189_test.go index 44424dd3691..382b4972080 100644 --- a/models/migrations/v1_16/v189_test.go +++ b/models/migrations/v1_16/v189_test.go @@ -6,8 +6,8 @@ package v1_16 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/json" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/json" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_16/v190.go b/models/migrations/v1_16/v190.go index 1eb6b6ddb4f..8dcb09b657e 100644 --- a/models/migrations/v1_16/v190.go +++ b/models/migrations/v1_16/v190.go @@ -6,10 +6,10 @@ package v1_16 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddAgitFlowPullRequest(x *xorm.Engine) error { +func AddAgitFlowPullRequest(x db.EngineMigration) error { type PullRequestFlow int type PullRequest struct { diff --git a/models/migrations/v1_16/v191.go b/models/migrations/v1_16/v191.go index 957c82e484c..fc0ab2e08c9 100644 --- a/models/migrations/v1_16/v191.go +++ b/models/migrations/v1_16/v191.go @@ -4,12 +4,11 @@ package v1_16 import ( - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) -func AlterIssueAndCommentTextFieldsToLongText(x *xorm.Engine) error { +func AlterIssueAndCommentTextFieldsToLongText(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() if err := sess.Begin(); err != nil { diff --git a/models/migrations/v1_16/v192.go b/models/migrations/v1_16/v192.go index 9d03fbe3c8f..1daf229b27e 100644 --- a/models/migrations/v1_16/v192.go +++ b/models/migrations/v1_16/v192.go @@ -4,12 +4,11 @@ package v1_16 import ( - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func RecreateIssueResourceIndexTable(x *xorm.Engine) error { +func RecreateIssueResourceIndexTable(x db.EngineMigration) error { type IssueIndex struct { GroupID int64 `xorm:"pk"` MaxIndex int64 `xorm:"index"` diff --git a/models/migrations/v1_16/v193.go b/models/migrations/v1_16/v193.go index a5af2de3805..b015f61e3a1 100644 --- a/models/migrations/v1_16/v193.go +++ b/models/migrations/v1_16/v193.go @@ -3,11 +3,9 @@ package v1_16 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddRepoIDForAttachment(x *xorm.Engine) error { +func AddRepoIDForAttachment(x db.EngineMigration) error { type Attachment struct { ID int64 `xorm:"pk autoincr"` UUID string `xorm:"uuid UNIQUE"` diff --git a/models/migrations/v1_16/v193_test.go b/models/migrations/v1_16/v193_test.go index f68dd6d92d8..a8359acb8ef 100644 --- a/models/migrations/v1_16/v193_test.go +++ b/models/migrations/v1_16/v193_test.go @@ -6,7 +6,7 @@ package v1_16 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_16/v194.go b/models/migrations/v1_16/v194.go index 2e4ed8340e6..baf19df95fd 100644 --- a/models/migrations/v1_16/v194.go +++ b/models/migrations/v1_16/v194.go @@ -6,10 +6,10 @@ package v1_16 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddBranchProtectionUnprotectedFilesColumn(x *xorm.Engine) error { +func AddBranchProtectionUnprotectedFilesColumn(x db.EngineMigration) error { type ProtectedBranch struct { UnprotectedFilePatterns string `xorm:"TEXT"` } diff --git a/models/migrations/v1_16/v195.go b/models/migrations/v1_16/v195.go index 4fd42b7bd23..515e30eb8a5 100644 --- a/models/migrations/v1_16/v195.go +++ b/models/migrations/v1_16/v195.go @@ -6,10 +6,10 @@ package v1_16 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddTableCommitStatusIndex(x *xorm.Engine) error { +func AddTableCommitStatusIndex(x db.EngineMigration) error { // CommitStatusIndex represents a table for commit status index type CommitStatusIndex struct { ID int64 diff --git a/models/migrations/v1_16/v195_test.go b/models/migrations/v1_16/v195_test.go index bbfa5e162a8..4b4ffb5cb32 100644 --- a/models/migrations/v1_16/v195_test.go +++ b/models/migrations/v1_16/v195_test.go @@ -6,7 +6,7 @@ package v1_16 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_16/v196.go b/models/migrations/v1_16/v196.go index 6c9caa100f1..8eb13cd024c 100644 --- a/models/migrations/v1_16/v196.go +++ b/models/migrations/v1_16/v196.go @@ -6,10 +6,10 @@ package v1_16 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddColorColToProjectBoard(x *xorm.Engine) error { +func AddColorColToProjectBoard(x db.EngineMigration) error { type ProjectBoard struct { Color string `xorm:"VARCHAR(7)"` } diff --git a/models/migrations/v1_16/v197.go b/models/migrations/v1_16/v197.go index 862bdfdcbdb..5f89635a0a5 100644 --- a/models/migrations/v1_16/v197.go +++ b/models/migrations/v1_16/v197.go @@ -3,11 +3,9 @@ package v1_16 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddRenamedBranchTable(x *xorm.Engine) error { +func AddRenamedBranchTable(x db.EngineMigration) error { type RenamedBranch struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX NOT NULL"` diff --git a/models/migrations/v1_16/v198.go b/models/migrations/v1_16/v198.go index f35ede138a0..0cabb239885 100644 --- a/models/migrations/v1_16/v198.go +++ b/models/migrations/v1_16/v198.go @@ -6,12 +6,11 @@ package v1_16 import ( "fmt" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddTableIssueContentHistory(x *xorm.Engine) error { +func AddTableIssueContentHistory(x db.EngineMigration) error { type IssueContentHistory struct { ID int64 `xorm:"pk autoincr"` PosterID int64 diff --git a/models/migrations/v1_16/v200.go b/models/migrations/v1_16/v200.go index de57fad8fe7..b6f65fc5c06 100644 --- a/models/migrations/v1_16/v200.go +++ b/models/migrations/v1_16/v200.go @@ -6,10 +6,10 @@ package v1_16 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddTableAppState(x *xorm.Engine) error { +func AddTableAppState(x db.EngineMigration) error { type AppState struct { ID string `xorm:"pk varchar(200)"` Revision int64 diff --git a/models/migrations/v1_16/v201.go b/models/migrations/v1_16/v201.go index 2c43698b0c9..f5e1422413d 100644 --- a/models/migrations/v1_16/v201.go +++ b/models/migrations/v1_16/v201.go @@ -3,11 +3,9 @@ package v1_16 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func DropTableRemoteVersion(x *xorm.Engine) error { +func DropTableRemoteVersion(x db.EngineMigration) error { // drop the orphaned table introduced in `v199`, now the update checker also uses AppState, do not need this table _ = x.DropTables("remote_version") return nil diff --git a/models/migrations/v1_16/v202.go b/models/migrations/v1_16/v202.go index d8c8fdcadc3..0f1647054b0 100644 --- a/models/migrations/v1_16/v202.go +++ b/models/migrations/v1_16/v202.go @@ -6,10 +6,10 @@ package v1_16 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func CreateUserSettingsTable(x *xorm.Engine) error { +func CreateUserSettingsTable(x db.EngineMigration) error { type UserSetting struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"index unique(key_userid)"` // to load all of someone's settings diff --git a/models/migrations/v1_16/v203.go b/models/migrations/v1_16/v203.go index c3241cba576..b91c4da6567 100644 --- a/models/migrations/v1_16/v203.go +++ b/models/migrations/v1_16/v203.go @@ -3,11 +3,9 @@ package v1_16 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddProjectIssueSorting(x *xorm.Engine) error { +func AddProjectIssueSorting(x db.EngineMigration) error { // ProjectIssue saves relation from issue to a project type ProjectIssue struct { Sorting int64 `xorm:"NOT NULL DEFAULT 0"` diff --git a/models/migrations/v1_16/v204.go b/models/migrations/v1_16/v204.go index 4d375307e76..3a882fd56f0 100644 --- a/models/migrations/v1_16/v204.go +++ b/models/migrations/v1_16/v204.go @@ -3,9 +3,9 @@ package v1_16 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddSSHKeyIsVerified(x *xorm.Engine) error { +func AddSSHKeyIsVerified(x db.EngineMigration) error { type PublicKey struct { Verified bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_16/v205.go b/models/migrations/v1_16/v205.go index 78241bad5b2..18dda1875fb 100644 --- a/models/migrations/v1_16/v205.go +++ b/models/migrations/v1_16/v205.go @@ -4,13 +4,13 @@ package v1_16 import ( - "code.gitea.io/gitea/models/migrations/base" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) -func MigrateUserPasswordSalt(x *xorm.Engine) error { +func MigrateUserPasswordSalt(x db.EngineMigration) error { dbType := x.Dialect().URI().DBType // For SQLITE, the max length doesn't matter. if dbType == schemas.SQLITE { diff --git a/models/migrations/v1_16/v206.go b/models/migrations/v1_16/v206.go index 01a9c386eb2..b612fa106d7 100644 --- a/models/migrations/v1_16/v206.go +++ b/models/migrations/v1_16/v206.go @@ -6,10 +6,10 @@ package v1_16 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func AddAuthorizeColForTeamUnit(x *xorm.Engine) error { +func AddAuthorizeColForTeamUnit(x db.EngineMigration) error { type TeamUnit struct { ID int64 `xorm:"pk autoincr"` OrgID int64 `xorm:"INDEX"` diff --git a/models/migrations/v1_16/v207.go b/models/migrations/v1_16/v207.go index 19126ead1f4..da89c7b8bbd 100644 --- a/models/migrations/v1_16/v207.go +++ b/models/migrations/v1_16/v207.go @@ -3,11 +3,9 @@ package v1_16 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddWebAuthnCred(x *xorm.Engine) error { +func AddWebAuthnCred(x db.EngineMigration) error { // NO-OP Don't migrate here - let v210 do this. return nil diff --git a/models/migrations/v1_16/v208.go b/models/migrations/v1_16/v208.go index fb643324f48..1f4752b34a2 100644 --- a/models/migrations/v1_16/v208.go +++ b/models/migrations/v1_16/v208.go @@ -3,11 +3,9 @@ package v1_16 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func UseBase32HexForCredIDInWebAuthnCredential(x *xorm.Engine) error { +func UseBase32HexForCredIDInWebAuthnCredential(x db.EngineMigration) error { // noop return nil } diff --git a/models/migrations/v1_16/v209.go b/models/migrations/v1_16/v209.go index 230838647bb..bfa0a63d354 100644 --- a/models/migrations/v1_16/v209.go +++ b/models/migrations/v1_16/v209.go @@ -3,11 +3,9 @@ package v1_16 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func IncreaseCredentialIDTo410(x *xorm.Engine) error { +func IncreaseCredentialIDTo410(x db.EngineMigration) error { // no-op // v208 was completely wrong // So now we have to no-op again. diff --git a/models/migrations/v1_16/v210.go b/models/migrations/v1_16/v210.go index 0b94baf8e3d..4eb6a4dacc7 100644 --- a/models/migrations/v1_16/v210.go +++ b/models/migrations/v1_16/v210.go @@ -8,16 +8,16 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/timeutil" "github.com/tstranex/u2f" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) // v208 migration was completely broken -func RemigrateU2FCredentials(x *xorm.Engine) error { +func RemigrateU2FCredentials(x db.EngineMigration) error { // Create webauthnCredential table type webauthnCredential struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_16/v210_test.go b/models/migrations/v1_16/v210_test.go index 7bff2572e11..ed90e62f5a2 100644 --- a/models/migrations/v1_16/v210_test.go +++ b/models/migrations/v1_16/v210_test.go @@ -6,8 +6,8 @@ package v1_16 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" "xorm.io/xorm/schemas" diff --git a/models/migrations/v1_17/main_test.go b/models/migrations/v1_17/main_test.go index 86522018719..4e5e83d8a8d 100644 --- a/models/migrations/v1_17/main_test.go +++ b/models/migrations/v1_17/main_test.go @@ -6,7 +6,7 @@ package v1_17 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_17/v211.go b/models/migrations/v1_17/v211.go index 517cf19388d..144e52c1d07 100644 --- a/models/migrations/v1_17/v211.go +++ b/models/migrations/v1_17/v211.go @@ -3,10 +3,8 @@ package v1_17 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func CreateForeignReferenceTable(_ *xorm.Engine) error { +func CreateForeignReferenceTable(_ db.EngineMigration) error { return nil // This table was dropped in v1_19/v237.go } diff --git a/models/migrations/v1_17/v212.go b/models/migrations/v1_17/v212.go index 788792211f5..8fd4036106e 100644 --- a/models/migrations/v1_17/v212.go +++ b/models/migrations/v1_17/v212.go @@ -4,12 +4,11 @@ package v1_17 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddPackageTables(x *xorm.Engine) error { +func AddPackageTables(x db.EngineMigration) error { type Package struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"` diff --git a/models/migrations/v1_17/v213.go b/models/migrations/v1_17/v213.go index b2bbdf72795..eddb7f538da 100644 --- a/models/migrations/v1_17/v213.go +++ b/models/migrations/v1_17/v213.go @@ -3,11 +3,9 @@ package v1_17 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddAllowMaintainerEdit(x *xorm.Engine) error { +func AddAllowMaintainerEdit(x db.EngineMigration) error { // PullRequest represents relation between pull request and repositories. type PullRequest struct { AllowMaintainerEdit bool `xorm:"NOT NULL DEFAULT false"` diff --git a/models/migrations/v1_17/v214.go b/models/migrations/v1_17/v214.go index 1925324f0f1..68194fca9bd 100644 --- a/models/migrations/v1_17/v214.go +++ b/models/migrations/v1_17/v214.go @@ -3,11 +3,9 @@ package v1_17 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddAutoMergeTable(x *xorm.Engine) error { +func AddAutoMergeTable(x db.EngineMigration) error { type MergeStyle string type PullAutoMerge struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_17/v215.go b/models/migrations/v1_17/v215.go index 748539225d3..857d37f7d13 100644 --- a/models/migrations/v1_17/v215.go +++ b/models/migrations/v1_17/v215.go @@ -4,13 +4,12 @@ package v1_17 import ( - "code.gitea.io/gitea/models/pull" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/pull" + "gitea.dev/modules/timeutil" ) -func AddReviewViewedFiles(x *xorm.Engine) error { +func AddReviewViewedFiles(x db.EngineMigration) error { type ReviewState struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"NOT NULL UNIQUE(pull_commit_user)"` diff --git a/models/migrations/v1_17/v217.go b/models/migrations/v1_17/v217.go index 04626bcbc59..fd9ec96d252 100644 --- a/models/migrations/v1_17/v217.go +++ b/models/migrations/v1_17/v217.go @@ -4,12 +4,11 @@ package v1_17 import ( - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) -func AlterHookTaskTextFieldsToLongText(x *xorm.Engine) error { +func AlterHookTaskTextFieldsToLongText(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() if err := sess.Begin(); err != nil { diff --git a/models/migrations/v1_17/v218.go b/models/migrations/v1_17/v218.go index 17d4cd89d4e..17c10915178 100644 --- a/models/migrations/v1_17/v218.go +++ b/models/migrations/v1_17/v218.go @@ -4,10 +4,10 @@ package v1_17 import ( - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) @@ -47,6 +47,6 @@ func (*improveActionTableIndicesAction) TableIndices() []*schemas.Index { return indices } -func ImproveActionTableIndices(x *xorm.Engine) error { +func ImproveActionTableIndices(x db.EngineMigration) error { return x.Sync(&improveActionTableIndicesAction{}) } diff --git a/models/migrations/v1_17/v219.go b/models/migrations/v1_17/v219.go index 6e335cb813a..0605fd14fae 100644 --- a/models/migrations/v1_17/v219.go +++ b/models/migrations/v1_17/v219.go @@ -6,13 +6,12 @@ package v1_17 import ( "time" - "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/repo" + "gitea.dev/modules/timeutil" ) -func AddSyncOnCommitColForPushMirror(x *xorm.Engine) error { +func AddSyncOnCommitColForPushMirror(x db.EngineMigration) error { type PushMirror struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` diff --git a/models/migrations/v1_17/v220.go b/models/migrations/v1_17/v220.go index 4ac8c58e1ec..2157bf24d3f 100644 --- a/models/migrations/v1_17/v220.go +++ b/models/migrations/v1_17/v220.go @@ -4,14 +4,14 @@ package v1_17 import ( - packages_model "code.gitea.io/gitea/models/packages" - container_module "code.gitea.io/gitea/modules/packages/container" + "gitea.dev/models/db" + packages_model "gitea.dev/models/packages" + container_module "gitea.dev/modules/packages/container" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) -func AddContainerRepositoryProperty(x *xorm.Engine) (err error) { +func AddContainerRepositoryProperty(x db.EngineMigration) (err error) { switch x.Dialect().URI().DBType { case schemas.SQLITE: _, err = x.Exec("INSERT INTO package_property (ref_type, ref_id, name, value) SELECT ?, p.id, ?, u.lower_name || '/' || p.lower_name FROM package p JOIN `user` u ON p.owner_id = u.id WHERE p.type = ?", diff --git a/models/migrations/v1_17/v221.go b/models/migrations/v1_17/v221.go index 9e6a67eb183..a5d2dc91665 100644 --- a/models/migrations/v1_17/v221.go +++ b/models/migrations/v1_17/v221.go @@ -7,12 +7,11 @@ import ( "encoding/base32" "fmt" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func StoreWebauthnCredentialIDAsBytes(x *xorm.Engine) error { +func StoreWebauthnCredentialIDAsBytes(x db.EngineMigration) error { // Create webauthnCredential table type webauthnCredential struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_17/v221_test.go b/models/migrations/v1_17/v221_test.go index 6fda9b9980e..2c217cf02e4 100644 --- a/models/migrations/v1_17/v221_test.go +++ b/models/migrations/v1_17/v221_test.go @@ -7,7 +7,7 @@ import ( "encoding/base32" "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_17/v222.go b/models/migrations/v1_17/v222.go index a5ea537d8a4..97b36af5caa 100644 --- a/models/migrations/v1_17/v222.go +++ b/models/migrations/v1_17/v222.go @@ -8,13 +8,12 @@ import ( "errors" "fmt" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/timeutil" ) -func DropOldCredentialIDColumn(x *xorm.Engine) error { +func DropOldCredentialIDColumn(x db.EngineMigration) error { // This migration maybe rerun so that we should check if it has been run credentialIDExist, err := x.Dialect().IsColumnExist(x.DB(), context.Background(), "webauthn_credential", "credential_id") if err != nil { diff --git a/models/migrations/v1_17/v223.go b/models/migrations/v1_17/v223.go index b2bfb76551d..a97a49566d8 100644 --- a/models/migrations/v1_17/v223.go +++ b/models/migrations/v1_17/v223.go @@ -7,14 +7,13 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" ) -func RenameCredentialIDBytes(x *xorm.Engine) error { +func RenameCredentialIDBytes(x db.EngineMigration) error { // This migration maybe rerun so that we should check if it has been run credentialIDExist, err := x.Dialect().IsColumnExist(x.DB(), context.Background(), "webauthn_credential", "credential_id") if err != nil { diff --git a/models/migrations/v1_18/main_test.go b/models/migrations/v1_18/main_test.go index b8641526f3d..720784d6800 100644 --- a/models/migrations/v1_18/main_test.go +++ b/models/migrations/v1_18/main_test.go @@ -6,7 +6,7 @@ package v1_18 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_18/v224.go b/models/migrations/v1_18/v224.go index 6dc12020eaa..7e796e40a72 100644 --- a/models/migrations/v1_18/v224.go +++ b/models/migrations/v1_18/v224.go @@ -3,11 +3,9 @@ package v1_18 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func CreateUserBadgesTable(x *xorm.Engine) error { +func CreateUserBadgesTable(x db.EngineMigration) error { type Badge struct { ID int64 `xorm:"pk autoincr"` Description string diff --git a/models/migrations/v1_18/v225.go b/models/migrations/v1_18/v225.go index bc6117e38f5..3a0268e97d0 100644 --- a/models/migrations/v1_18/v225.go +++ b/models/migrations/v1_18/v225.go @@ -4,12 +4,11 @@ package v1_18 import ( - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) -func AlterPublicGPGKeyContentFieldsToMediumText(x *xorm.Engine) error { +func AlterPublicGPGKeyContentFieldsToMediumText(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() if err := sess.Begin(); err != nil { diff --git a/models/migrations/v1_18/v226.go b/models/migrations/v1_18/v226.go index 8ed9761476d..cd9e826bd05 100644 --- a/models/migrations/v1_18/v226.go +++ b/models/migrations/v1_18/v226.go @@ -4,11 +4,12 @@ package v1_18 import ( + "gitea.dev/models/db" + "xorm.io/builder" - "xorm.io/xorm" ) -func FixPackageSemverField(x *xorm.Engine) error { +func FixPackageSemverField(x db.EngineMigration) error { _, err := x.Exec(builder.Update(builder.Eq{"semver_compatible": false}).From("`package`").Where(builder.In("`type`", "conan", "generic"))) return err } diff --git a/models/migrations/v1_18/v227.go b/models/migrations/v1_18/v227.go index 3aca686d597..058f6331175 100644 --- a/models/migrations/v1_18/v227.go +++ b/models/migrations/v1_18/v227.go @@ -4,9 +4,8 @@ package v1_18 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) type SystemSetting struct { @@ -18,6 +17,6 @@ type SystemSetting struct { Updated timeutil.TimeStamp `xorm:"updated"` } -func CreateSystemSettingsTable(x *xorm.Engine) error { +func CreateSystemSettingsTable(x db.EngineMigration) error { return x.Sync(new(SystemSetting)) } diff --git a/models/migrations/v1_18/v228.go b/models/migrations/v1_18/v228.go index b13f6461bd8..558411ef473 100644 --- a/models/migrations/v1_18/v228.go +++ b/models/migrations/v1_18/v228.go @@ -4,12 +4,11 @@ package v1_18 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddTeamInviteTable(x *xorm.Engine) error { +func AddTeamInviteTable(x db.EngineMigration) error { type TeamInvite struct { ID int64 `xorm:"pk autoincr"` Token string `xorm:"UNIQUE(token) INDEX NOT NULL DEFAULT ''"` diff --git a/models/migrations/v1_18/v229.go b/models/migrations/v1_18/v229.go index 1f69724365a..be9bda66ec0 100644 --- a/models/migrations/v1_18/v229.go +++ b/models/migrations/v1_18/v229.go @@ -6,13 +6,13 @@ package v1_18 import ( "fmt" - "code.gitea.io/gitea/models/issues" + "gitea.dev/models/db" + "gitea.dev/models/issues" "xorm.io/builder" - "xorm.io/xorm" ) -func UpdateOpenMilestoneCounts(x *xorm.Engine) error { +func UpdateOpenMilestoneCounts(x db.EngineMigration) error { var openMilestoneIDs []int64 err := x.Table("milestone").Select("id").Where(builder.Neq{"is_closed": 1}).Find(&openMilestoneIDs) if err != nil { diff --git a/models/migrations/v1_18/v229_test.go b/models/migrations/v1_18/v229_test.go index 638983ad0ba..f1f3482bba9 100644 --- a/models/migrations/v1_18/v229_test.go +++ b/models/migrations/v1_18/v229_test.go @@ -6,8 +6,8 @@ package v1_18 import ( "testing" - "code.gitea.io/gitea/models/issues" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/issues" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_18/v230.go b/models/migrations/v1_18/v230.go index 078fce7643d..670b3227df7 100644 --- a/models/migrations/v1_18/v230.go +++ b/models/migrations/v1_18/v230.go @@ -3,12 +3,10 @@ package v1_18 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" // AddConfidentialColumnToOAuth2ApplicationTable: add ConfidentialClient column, setting existing rows to true -func AddConfidentialClientColumnToOAuth2ApplicationTable(x *xorm.Engine) error { +func AddConfidentialClientColumnToOAuth2ApplicationTable(x db.EngineMigration) error { type oauth2Application struct { ID int64 ConfidentialClient bool `xorm:"NOT NULL DEFAULT TRUE"` diff --git a/models/migrations/v1_18/v230_test.go b/models/migrations/v1_18/v230_test.go index e5e28ea63fc..e711a6cd595 100644 --- a/models/migrations/v1_18/v230_test.go +++ b/models/migrations/v1_18/v230_test.go @@ -6,7 +6,7 @@ package v1_18 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_19/main_test.go b/models/migrations/v1_19/main_test.go index 784ca0e46ed..383ffb93882 100644 --- a/models/migrations/v1_19/main_test.go +++ b/models/migrations/v1_19/main_test.go @@ -6,7 +6,7 @@ package v1_19 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_19/v231.go b/models/migrations/v1_19/v231.go index 8ef1e4e7438..d8fa52a1a7c 100644 --- a/models/migrations/v1_19/v231.go +++ b/models/migrations/v1_19/v231.go @@ -3,11 +3,9 @@ package v1_19 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddIndexForHookTask(x *xorm.Engine) error { +func AddIndexForHookTask(x db.EngineMigration) error { type HookTask struct { ID int64 `xorm:"pk autoincr"` HookID int64 `xorm:"index"` diff --git a/models/migrations/v1_19/v232.go b/models/migrations/v1_19/v232.go index 493dbc6df83..4e4a8ae6f00 100644 --- a/models/migrations/v1_19/v232.go +++ b/models/migrations/v1_19/v232.go @@ -4,12 +4,11 @@ package v1_19 import ( - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) -func AlterPackageVersionMetadataToLongText(x *xorm.Engine) error { +func AlterPackageVersionMetadataToLongText(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() if err := sess.Begin(); err != nil { diff --git a/models/migrations/v1_19/v233.go b/models/migrations/v1_19/v233.go index 44ced874b32..6098e7882eb 100644 --- a/models/migrations/v1_19/v233.go +++ b/models/migrations/v1_19/v233.go @@ -6,15 +6,15 @@ package v1_19 import ( "fmt" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/secret" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/json" + "gitea.dev/modules/secret" + "gitea.dev/modules/setting" "xorm.io/builder" - "xorm.io/xorm" ) -func batchProcess[T any](x *xorm.Engine, buf []T, query func(limit, start int) *xorm.Session, process func(*xorm.Session, T) error) error { +func batchProcess[T any](x db.EngineMigration, buf []T, query func(limit, start int) db.Session, process func(db.Session, T) error) error { size := cap(buf) start := 0 for { @@ -51,7 +51,7 @@ func batchProcess[T any](x *xorm.Engine, buf []T, query func(limit, start int) * } } -func AddHeaderAuthorizationEncryptedColWebhook(x *xorm.Engine) error { +func AddHeaderAuthorizationEncryptedColWebhook(x db.EngineMigration) error { // Add the column to the table type Webhook struct { ID int64 `xorm:"pk autoincr"` @@ -80,10 +80,10 @@ func AddHeaderAuthorizationEncryptedColWebhook(x *xorm.Engine) error { err = batchProcess(x, make([]*Webhook, 0, 50), - func(limit, start int) *xorm.Session { + func(limit, start int) db.Session { return x.Where("type=?", "matrix").OrderBy("id").Limit(limit, start) }, - func(sess *xorm.Session, hook *Webhook) error { + func(sess db.Session, hook *Webhook) error { // retrieve token from meta var withToken MatrixMetaWithAccessToken err := json.Unmarshal([]byte(hook.Meta), &withToken) @@ -141,13 +141,13 @@ func AddHeaderAuthorizationEncryptedColWebhook(x *xorm.Engine) error { err = batchProcess(x, make([]*HookTask, 0, 50), - func(limit, start int) *xorm.Session { + func(limit, start int) db.Session { return x.Where(builder.And( builder.In("hook_id", builder.Select("id").From("webhook").Where(builder.Eq{"type": "matrix"})), builder.Like{"payload_content", "access_token"}, )).OrderBy("id").Limit(limit, 0) // ignore the provided "start", since other payload were already converted and don't contain 'payload_content' anymore }, - func(sess *xorm.Session, hookTask *HookTask) error { + func(sess db.Session, hookTask *HookTask) error { // retrieve token from payload_content var withToken MatrixPayloadUnsafe err := json.Unmarshal([]byte(hookTask.PayloadContent), &withToken) diff --git a/models/migrations/v1_19/v233_test.go b/models/migrations/v1_19/v233_test.go index 3f7900c58f0..add19443059 100644 --- a/models/migrations/v1_19/v233_test.go +++ b/models/migrations/v1_19/v233_test.go @@ -6,11 +6,11 @@ package v1_19 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/secret" - "code.gitea.io/gitea/modules/setting" - webhook_module "code.gitea.io/gitea/modules/webhook" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/json" + "gitea.dev/modules/secret" + "gitea.dev/modules/setting" + webhook_module "gitea.dev/modules/webhook" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_19/v234.go b/models/migrations/v1_19/v234.go index 3475384d6f4..325d2c70fee 100644 --- a/models/migrations/v1_19/v234.go +++ b/models/migrations/v1_19/v234.go @@ -4,12 +4,11 @@ package v1_19 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func CreatePackageCleanupRuleTable(x *xorm.Engine) error { +func CreatePackageCleanupRuleTable(x db.EngineMigration) error { type PackageCleanupRule struct { ID int64 `xorm:"pk autoincr"` Enabled bool `xorm:"INDEX NOT NULL DEFAULT false"` diff --git a/models/migrations/v1_19/v235.go b/models/migrations/v1_19/v235.go index 297d90f65a2..5a49b3f31f1 100644 --- a/models/migrations/v1_19/v235.go +++ b/models/migrations/v1_19/v235.go @@ -3,11 +3,9 @@ package v1_19 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddIndexForAccessToken(x *xorm.Engine) error { +func AddIndexForAccessToken(x db.EngineMigration) error { type AccessToken struct { TokenLastEight string `xorm:"INDEX token_last_eight"` } diff --git a/models/migrations/v1_19/v236.go b/models/migrations/v1_19/v236.go index 0ed4d97a272..9547a949237 100644 --- a/models/migrations/v1_19/v236.go +++ b/models/migrations/v1_19/v236.go @@ -4,12 +4,11 @@ package v1_19 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func CreateSecretsTable(x *xorm.Engine) error { +func CreateSecretsTable(x db.EngineMigration) error { type Secret struct { ID int64 OwnerID int64 `xorm:"INDEX UNIQUE(owner_repo_name) NOT NULL"` diff --git a/models/migrations/v1_19/v237.go b/models/migrations/v1_19/v237.go index cf30226ccd8..f5ec09ff907 100644 --- a/models/migrations/v1_19/v237.go +++ b/models/migrations/v1_19/v237.go @@ -3,11 +3,9 @@ package v1_19 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func DropForeignReferenceTable(x *xorm.Engine) error { +func DropForeignReferenceTable(x db.EngineMigration) error { // Drop the table introduced in `v211`, it's considered badly designed and doesn't look like to be used. // See: https://github.com/go-gitea/gitea/issues/21086#issuecomment-1318217453 type ForeignReference struct{} diff --git a/models/migrations/v1_19/v238.go b/models/migrations/v1_19/v238.go index de681bfc7a4..5b2173e6a50 100644 --- a/models/migrations/v1_19/v238.go +++ b/models/migrations/v1_19/v238.go @@ -4,13 +4,12 @@ package v1_19 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) // AddUpdatedUnixToLFSMetaObject adds an updated column to the LFSMetaObject to allow for garbage collection -func AddUpdatedUnixToLFSMetaObject(x *xorm.Engine) error { +func AddUpdatedUnixToLFSMetaObject(x db.EngineMigration) error { // Drop the table introduced in `v211`, it's considered badly designed and doesn't look like to be used. // See: https://github.com/go-gitea/gitea/issues/21086#issuecomment-1318217453 // LFSMetaObject stores metadata for LFS tracked files. diff --git a/models/migrations/v1_19/v239.go b/models/migrations/v1_19/v239.go index 8f4a65be95d..826150a7237 100644 --- a/models/migrations/v1_19/v239.go +++ b/models/migrations/v1_19/v239.go @@ -3,11 +3,9 @@ package v1_19 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddScopeForAccessTokens(x *xorm.Engine) error { +func AddScopeForAccessTokens(x db.EngineMigration) error { type AccessToken struct { Scope string } diff --git a/models/migrations/v1_19/v240.go b/models/migrations/v1_19/v240.go index 7fdbaeb9dc9..b23553cc4ec 100644 --- a/models/migrations/v1_19/v240.go +++ b/models/migrations/v1_19/v240.go @@ -4,13 +4,11 @@ package v1_19 import ( - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddActionsTables(x *xorm.Engine) error { +func AddActionsTables(x db.EngineMigration) error { type ActionRunner struct { ID int64 UUID string `xorm:"CHAR(36) UNIQUE"` diff --git a/models/migrations/v1_19/v241.go b/models/migrations/v1_19/v241.go index e35801a0572..3237dc11de9 100644 --- a/models/migrations/v1_19/v241.go +++ b/models/migrations/v1_19/v241.go @@ -3,12 +3,10 @@ package v1_19 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" // AddCardTypeToProjectTable: add CardType column, setting existing rows to CardTypeTextOnly -func AddCardTypeToProjectTable(x *xorm.Engine) error { +func AddCardTypeToProjectTable(x db.EngineMigration) error { type Project struct { CardType int `xorm:"NOT NULL DEFAULT 0"` } diff --git a/models/migrations/v1_19/v242.go b/models/migrations/v1_19/v242.go index e9e759eaaa9..4015d0e1740 100644 --- a/models/migrations/v1_19/v242.go +++ b/models/migrations/v1_19/v242.go @@ -4,13 +4,12 @@ package v1_19 import ( - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) // AlterPublicGPGKeyImportContentFieldToMediumText: set GPGKeyImport Content field to MEDIUMTEXT -func AlterPublicGPGKeyImportContentFieldToMediumText(x *xorm.Engine) error { +func AlterPublicGPGKeyImportContentFieldToMediumText(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() if err := sess.Begin(); err != nil { diff --git a/models/migrations/v1_19/v243.go b/models/migrations/v1_19/v243.go index 9c3f3725949..547b591596f 100644 --- a/models/migrations/v1_19/v243.go +++ b/models/migrations/v1_19/v243.go @@ -3,11 +3,9 @@ package v1_19 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddExclusiveLabel(x *xorm.Engine) error { +func AddExclusiveLabel(x db.EngineMigration) error { type Label struct { Exclusive bool } diff --git a/models/migrations/v1_20/main_test.go b/models/migrations/v1_20/main_test.go index 3ceb9a3c66d..17437be0f91 100644 --- a/models/migrations/v1_20/main_test.go +++ b/models/migrations/v1_20/main_test.go @@ -6,7 +6,7 @@ package v1_20 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_20/v244.go b/models/migrations/v1_20/v244.go index 76cdccaca5b..722677f019f 100644 --- a/models/migrations/v1_20/v244.go +++ b/models/migrations/v1_20/v244.go @@ -3,11 +3,9 @@ package v1_20 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddNeedApprovalToActionRun(x *xorm.Engine) error { +func AddNeedApprovalToActionRun(x db.EngineMigration) error { /* New index: TriggerUserID New fields: NeedApproval, ApprovedBy diff --git a/models/migrations/v1_20/v245.go b/models/migrations/v1_20/v245.go index 4acb11416c3..52c6fa04860 100644 --- a/models/migrations/v1_20/v245.go +++ b/models/migrations/v1_20/v245.go @@ -6,13 +6,12 @@ package v1_20 import ( "context" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/setting" ) -func RenameWebhookOrgToOwner(x *xorm.Engine) error { +func RenameWebhookOrgToOwner(x db.EngineMigration) error { type Webhook struct { OrgID int64 `xorm:"INDEX"` } diff --git a/models/migrations/v1_20/v246.go b/models/migrations/v1_20/v246.go index 22bf7234043..8232d21f938 100644 --- a/models/migrations/v1_20/v246.go +++ b/models/migrations/v1_20/v246.go @@ -3,11 +3,9 @@ package v1_20 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddNewColumnForProject(x *xorm.Engine) error { +func AddNewColumnForProject(x db.EngineMigration) error { type Project struct { OwnerID int64 `xorm:"INDEX"` } diff --git a/models/migrations/v1_20/v247.go b/models/migrations/v1_20/v247.go index 4f82937e185..46daa73203b 100644 --- a/models/migrations/v1_20/v247.go +++ b/models/migrations/v1_20/v247.go @@ -4,13 +4,12 @@ package v1_20 import ( - "code.gitea.io/gitea/modules/log" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/log" ) // FixIncorrectProjectType: set individual project's type from 3(TypeOrganization) to 1(TypeIndividual) -func FixIncorrectProjectType(x *xorm.Engine) error { +func FixIncorrectProjectType(x db.EngineMigration) error { type User struct { ID int64 `xorm:"pk autoincr"` Type int diff --git a/models/migrations/v1_20/v248.go b/models/migrations/v1_20/v248.go index 4f2091e4bca..7dd7f464704 100644 --- a/models/migrations/v1_20/v248.go +++ b/models/migrations/v1_20/v248.go @@ -3,9 +3,9 @@ package v1_20 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddVersionToActionRunner(x *xorm.Engine) error { +func AddVersionToActionRunner(x db.EngineMigration) error { type ActionRunner struct { Version string `xorm:"VARCHAR(64)"` // the version of act_runner } diff --git a/models/migrations/v1_20/v249.go b/models/migrations/v1_20/v249.go index c6d3a177ca3..7db38b73e9a 100644 --- a/models/migrations/v1_20/v249.go +++ b/models/migrations/v1_20/v249.go @@ -4,9 +4,9 @@ package v1_20 import ( - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) @@ -40,6 +40,6 @@ func (a *Action) TableIndices() []*schemas.Index { return indices } -func ImproveActionTableIndices(x *xorm.Engine) error { +func ImproveActionTableIndices(x db.EngineMigration) error { return x.Sync(new(Action)) } diff --git a/models/migrations/v1_20/v250.go b/models/migrations/v1_20/v250.go index ec45e6e5c31..07662c86b22 100644 --- a/models/migrations/v1_20/v250.go +++ b/models/migrations/v1_20/v250.go @@ -6,12 +6,11 @@ package v1_20 import ( "strings" - "code.gitea.io/gitea/modules/json" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/json" ) -func ChangeContainerMetadataMultiArch(x *xorm.Engine) error { +func ChangeContainerMetadataMultiArch(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() diff --git a/models/migrations/v1_20/v251.go b/models/migrations/v1_20/v251.go index a274c22a731..609417d1054 100644 --- a/models/migrations/v1_20/v251.go +++ b/models/migrations/v1_20/v251.go @@ -4,12 +4,11 @@ package v1_20 import ( - "code.gitea.io/gitea/modules/log" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/log" ) -func FixIncorrectOwnerTeamUnitAccessMode(x *xorm.Engine) error { +func FixIncorrectOwnerTeamUnitAccessMode(x db.EngineMigration) error { type UnitType int type AccessMode int diff --git a/models/migrations/v1_20/v252.go b/models/migrations/v1_20/v252.go index d6aa6027534..2ee06ea2d2c 100644 --- a/models/migrations/v1_20/v252.go +++ b/models/migrations/v1_20/v252.go @@ -4,12 +4,11 @@ package v1_20 import ( - "code.gitea.io/gitea/modules/log" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/log" ) -func FixIncorrectAdminTeamUnitAccessMode(x *xorm.Engine) error { +func FixIncorrectAdminTeamUnitAccessMode(x db.EngineMigration) error { type UnitType int type AccessMode int diff --git a/models/migrations/v1_20/v253.go b/models/migrations/v1_20/v253.go index c96454dbf92..99480ce67a0 100644 --- a/models/migrations/v1_20/v253.go +++ b/models/migrations/v1_20/v253.go @@ -4,12 +4,11 @@ package v1_20 import ( - "code.gitea.io/gitea/modules/log" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/log" ) -func FixExternalTrackerAndExternalWikiAccessModeInOwnerAndAdminTeam(x *xorm.Engine) error { +func FixExternalTrackerAndExternalWikiAccessModeInOwnerAndAdminTeam(x db.EngineMigration) error { type UnitType int type AccessMode int diff --git a/models/migrations/v1_20/v254.go b/models/migrations/v1_20/v254.go index 9cdbfb39164..50fcf267af8 100644 --- a/models/migrations/v1_20/v254.go +++ b/models/migrations/v1_20/v254.go @@ -3,11 +3,9 @@ package v1_20 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddActionTaskOutputTable(x *xorm.Engine) error { +func AddActionTaskOutputTable(x db.EngineMigration) error { type ActionTaskOutput struct { ID int64 TaskID int64 `xorm:"INDEX UNIQUE(task_id_output_key)"` diff --git a/models/migrations/v1_20/v255.go b/models/migrations/v1_20/v255.go index caf198700e0..7e3305ac053 100644 --- a/models/migrations/v1_20/v255.go +++ b/models/migrations/v1_20/v255.go @@ -4,12 +4,11 @@ package v1_20 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddArchivedUnixToRepository(x *xorm.Engine) error { +func AddArchivedUnixToRepository(x db.EngineMigration) error { type Repository struct { ArchivedUnix timeutil.TimeStamp `xorm:"DEFAULT 0"` } diff --git a/models/migrations/v1_20/v256.go b/models/migrations/v1_20/v256.go index 7b84c1e1544..28130f89056 100644 --- a/models/migrations/v1_20/v256.go +++ b/models/migrations/v1_20/v256.go @@ -3,11 +3,9 @@ package v1_20 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddIsInternalColumnToPackage(x *xorm.Engine) error { +func AddIsInternalColumnToPackage(x db.EngineMigration) error { type Package struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"` diff --git a/models/migrations/v1_20/v257.go b/models/migrations/v1_20/v257.go index 9d5f7c07dfc..96169c94d26 100644 --- a/models/migrations/v1_20/v257.go +++ b/models/migrations/v1_20/v257.go @@ -4,12 +4,11 @@ package v1_20 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func CreateActionArtifactTable(x *xorm.Engine) error { +func CreateActionArtifactTable(x db.EngineMigration) error { // ActionArtifact is a file that is stored in the artifact storage. type ActionArtifact struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_20/v258.go b/models/migrations/v1_20/v258.go index 1d3faffdaed..a8773d06384 100644 --- a/models/migrations/v1_20/v258.go +++ b/models/migrations/v1_20/v258.go @@ -3,11 +3,9 @@ package v1_20 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddPinOrderToIssue(x *xorm.Engine) error { +func AddPinOrderToIssue(x db.EngineMigration) error { type Issue struct { PinOrder int `xorm:"DEFAULT 0"` } diff --git a/models/migrations/v1_20/v259.go b/models/migrations/v1_20/v259.go index 9e0dc9b61d9..d6200a69502 100644 --- a/models/migrations/v1_20/v259.go +++ b/models/migrations/v1_20/v259.go @@ -7,9 +7,8 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/modules/log" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/log" ) // unknownAccessTokenScope represents the scope for an access token that isn't @@ -319,7 +318,7 @@ type AccessToken struct { Scope string } -func ConvertScopedAccessTokens(x *xorm.Engine) error { +func ConvertScopedAccessTokens(x db.EngineMigration) error { var tokens []*AccessToken if err := x.Find(&tokens); err != nil { diff --git a/models/migrations/v1_20/v259_test.go b/models/migrations/v1_20/v259_test.go index 3864eecb78a..7c596579e50 100644 --- a/models/migrations/v1_20/v259_test.go +++ b/models/migrations/v1_20/v259_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_21/main_test.go b/models/migrations/v1_21/main_test.go index daf98d40f4c..058e7af59f3 100644 --- a/models/migrations/v1_21/main_test.go +++ b/models/migrations/v1_21/main_test.go @@ -6,7 +6,7 @@ package v1_21 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_21/v260.go b/models/migrations/v1_21/v260.go index 8540c58ae86..320c38fde0a 100644 --- a/models/migrations/v1_21/v260.go +++ b/models/migrations/v1_21/v260.go @@ -4,12 +4,11 @@ package v1_21 import ( - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func DropCustomLabelsColumnOfActionRunner(x *xorm.Engine) error { +func DropCustomLabelsColumnOfActionRunner(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() diff --git a/models/migrations/v1_21/v261.go b/models/migrations/v1_21/v261.go index 122b98eb93b..5f98e8b427f 100644 --- a/models/migrations/v1_21/v261.go +++ b/models/migrations/v1_21/v261.go @@ -4,12 +4,11 @@ package v1_21 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func CreateVariableTable(x *xorm.Engine) error { +func CreateVariableTable(x db.EngineMigration) error { type ActionVariable struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"UNIQUE(owner_repo_name)"` diff --git a/models/migrations/v1_21/v262.go b/models/migrations/v1_21/v262.go index 6e88e29b9db..ab057842087 100644 --- a/models/migrations/v1_21/v262.go +++ b/models/migrations/v1_21/v262.go @@ -3,11 +3,9 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddTriggerEventToActionRun(x *xorm.Engine) error { +func AddTriggerEventToActionRun(x db.EngineMigration) error { type ActionRun struct { TriggerEvent string } diff --git a/models/migrations/v1_21/v263.go b/models/migrations/v1_21/v263.go index 55c418bde0d..18af1caed4e 100644 --- a/models/migrations/v1_21/v263.go +++ b/models/migrations/v1_21/v263.go @@ -6,11 +6,11 @@ package v1_21 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) // AddGitSizeAndLFSSizeToRepositoryTable: add GitSize and LFSSize columns to Repository -func AddGitSizeAndLFSSizeToRepositoryTable(x *xorm.Engine) error { +func AddGitSizeAndLFSSizeToRepositoryTable(x db.EngineMigration) error { type Repository struct { GitSize int64 `xorm:"NOT NULL DEFAULT 0"` LFSSize int64 `xorm:"NOT NULL DEFAULT 0"` diff --git a/models/migrations/v1_21/v264.go b/models/migrations/v1_21/v264.go index 7fc0ec60240..0353f474d46 100644 --- a/models/migrations/v1_21/v264.go +++ b/models/migrations/v1_21/v264.go @@ -7,13 +7,11 @@ import ( "context" "errors" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddBranchTable(x *xorm.Engine) error { +func AddBranchTable(x db.EngineMigration) error { type Branch struct { ID int64 RepoID int64 `xorm:"UNIQUE(s)"` diff --git a/models/migrations/v1_21/v265.go b/models/migrations/v1_21/v265.go index b6892acc277..cd991b535d2 100644 --- a/models/migrations/v1_21/v265.go +++ b/models/migrations/v1_21/v265.go @@ -3,11 +3,9 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AlterActionArtifactTable(x *xorm.Engine) error { +func AlterActionArtifactTable(x db.EngineMigration) error { // ActionArtifact is a file that is stored in the artifact storage. type ActionArtifact struct { RunID int64 `xorm:"index unique(runid_name_path)"` // The run id of the artifact diff --git a/models/migrations/v1_21/v266.go b/models/migrations/v1_21/v266.go index 440549e868b..d7ab34e57e6 100644 --- a/models/migrations/v1_21/v266.go +++ b/models/migrations/v1_21/v266.go @@ -3,11 +3,9 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func ReduceCommitStatus(x *xorm.Engine) error { +func ReduceCommitStatus(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() diff --git a/models/migrations/v1_21/v267.go b/models/migrations/v1_21/v267.go index 394139a17e2..b6a93cf1815 100644 --- a/models/migrations/v1_21/v267.go +++ b/models/migrations/v1_21/v267.go @@ -4,12 +4,11 @@ package v1_21 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func CreateActionTasksVersionTable(x *xorm.Engine) error { +func CreateActionTasksVersionTable(x db.EngineMigration) error { type ActionTasksVersion struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"UNIQUE(owner_repo)"` diff --git a/models/migrations/v1_21/v268.go b/models/migrations/v1_21/v268.go index b677d2383e9..e9f697645f7 100644 --- a/models/migrations/v1_21/v268.go +++ b/models/migrations/v1_21/v268.go @@ -3,12 +3,10 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" // UpdateActionsRefIndex updates the index of actions ref field -func UpdateActionsRefIndex(x *xorm.Engine) error { +func UpdateActionsRefIndex(x db.EngineMigration) error { type ActionRun struct { Ref string `xorm:"index"` // the commit/tag/… causing the run } diff --git a/models/migrations/v1_21/v269.go b/models/migrations/v1_21/v269.go index 042040927d4..8ea5b3fd41f 100644 --- a/models/migrations/v1_21/v269.go +++ b/models/migrations/v1_21/v269.go @@ -3,10 +3,8 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func DropDeletedBranchTable(x *xorm.Engine) error { +func DropDeletedBranchTable(x db.EngineMigration) error { return x.DropTables("deleted_branch") } diff --git a/models/migrations/v1_21/v270.go b/models/migrations/v1_21/v270.go index ab7c5660bad..5e1482b3209 100644 --- a/models/migrations/v1_21/v270.go +++ b/models/migrations/v1_21/v270.go @@ -3,11 +3,9 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func FixPackagePropertyTypo(x *xorm.Engine) error { +func FixPackagePropertyTypo(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() diff --git a/models/migrations/v1_21/v271.go b/models/migrations/v1_21/v271.go index 05e1af1351d..e24f484332c 100644 --- a/models/migrations/v1_21/v271.go +++ b/models/migrations/v1_21/v271.go @@ -4,12 +4,11 @@ package v1_21 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddArchivedUnixColumInLabelTable(x *xorm.Engine) error { +func AddArchivedUnixColumInLabelTable(x db.EngineMigration) error { type Label struct { ArchivedUnix timeutil.TimeStamp `xorm:"DEFAULT NULL"` } diff --git a/models/migrations/v1_21/v272.go b/models/migrations/v1_21/v272.go index 14c1e0c4b0f..60335e8b46b 100644 --- a/models/migrations/v1_21/v272.go +++ b/models/migrations/v1_21/v272.go @@ -3,11 +3,9 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddVersionToActionRunTable(x *xorm.Engine) error { +func AddVersionToActionRunTable(x db.EngineMigration) error { type ActionRun struct { Version int `xorm:"version default 0"` } diff --git a/models/migrations/v1_21/v273.go b/models/migrations/v1_21/v273.go index e614a56a7dc..74c3c8f9eba 100644 --- a/models/migrations/v1_21/v273.go +++ b/models/migrations/v1_21/v273.go @@ -4,12 +4,11 @@ package v1_21 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddActionScheduleTable(x *xorm.Engine) error { +func AddActionScheduleTable(x db.EngineMigration) error { type ActionSchedule struct { ID int64 Title string diff --git a/models/migrations/v1_21/v274.go b/models/migrations/v1_21/v274.go index d0b557a1519..4644154c637 100644 --- a/models/migrations/v1_21/v274.go +++ b/models/migrations/v1_21/v274.go @@ -6,12 +6,11 @@ package v1_21 import ( "time" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddExpiredUnixColumnInActionArtifactTable(x *xorm.Engine) error { +func AddExpiredUnixColumnInActionArtifactTable(x db.EngineMigration) error { type ActionArtifact struct { ExpiredUnix timeutil.TimeStamp `xorm:"index"` // time when the artifact will be expired } @@ -21,7 +20,7 @@ func AddExpiredUnixColumnInActionArtifactTable(x *xorm.Engine) error { return updateArtifactsExpiredUnixTo90Days(x) } -func updateArtifactsExpiredUnixTo90Days(x *xorm.Engine) error { +func updateArtifactsExpiredUnixTo90Days(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() diff --git a/models/migrations/v1_21/v275.go b/models/migrations/v1_21/v275.go index 2bfe5c72fa9..7d999495b67 100644 --- a/models/migrations/v1_21/v275.go +++ b/models/migrations/v1_21/v275.go @@ -3,11 +3,9 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddScheduleIDForActionRun(x *xorm.Engine) error { +func AddScheduleIDForActionRun(x db.EngineMigration) error { type ActionRun struct { ScheduleID int64 } diff --git a/models/migrations/v1_21/v276.go b/models/migrations/v1_21/v276.go index be24b31902e..1bd0157156d 100644 --- a/models/migrations/v1_21/v276.go +++ b/models/migrations/v1_21/v276.go @@ -6,14 +6,13 @@ package v1_21 import ( "context" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/gitrepo" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/gitrepo" + "gitea.dev/modules/setting" ) -func AddRemoteAddressToMirrors(x *xorm.Engine) error { +func AddRemoteAddressToMirrors(x db.EngineMigration) error { type Mirror struct { RemoteAddress string `xorm:"VARCHAR(2048)"` } @@ -33,7 +32,7 @@ func AddRemoteAddressToMirrors(x *xorm.Engine) error { return migratePushMirrors(x) } -func migratePullMirrors(x *xorm.Engine) error { +func migratePullMirrors(x db.EngineMigration) error { type Mirror struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` @@ -95,7 +94,7 @@ func migratePullMirrors(x *xorm.Engine) error { return sess.Commit() } -func migratePushMirrors(x *xorm.Engine) error { +func migratePushMirrors(x db.EngineMigration) error { type PushMirror struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` diff --git a/models/migrations/v1_21/v277.go b/models/migrations/v1_21/v277.go index 0c102edddec..74bc4c86dbe 100644 --- a/models/migrations/v1_21/v277.go +++ b/models/migrations/v1_21/v277.go @@ -3,11 +3,9 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddIndexToIssueUserIssueID(x *xorm.Engine) error { +func AddIndexToIssueUserIssueID(x db.EngineMigration) error { type IssueUser struct { IssueID int64 `xorm:"INDEX"` } diff --git a/models/migrations/v1_21/v278.go b/models/migrations/v1_21/v278.go index 846f2286780..1fd5ec7aa0c 100644 --- a/models/migrations/v1_21/v278.go +++ b/models/migrations/v1_21/v278.go @@ -3,11 +3,9 @@ package v1_21 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddIndexToCommentDependentIssueID(x *xorm.Engine) error { +func AddIndexToCommentDependentIssueID(x db.EngineMigration) error { type Comment struct { DependentIssueID int64 `xorm:"index"` } diff --git a/models/migrations/v1_21/v279.go b/models/migrations/v1_21/v279.go index beb39effe1a..8cfa6bb090a 100644 --- a/models/migrations/v1_21/v279.go +++ b/models/migrations/v1_21/v279.go @@ -4,10 +4,12 @@ package v1_21 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddIndexToActionUserID(x *xorm.Engine) error { +func AddIndexToActionUserID(x db.EngineMigration) error { type Action struct { UserID int64 `xorm:"INDEX"` } diff --git a/models/migrations/v1_22/main_test.go b/models/migrations/v1_22/main_test.go index e02c8a53282..f7f9442f21a 100644 --- a/models/migrations/v1_22/main_test.go +++ b/models/migrations/v1_22/main_test.go @@ -6,7 +6,7 @@ package v1_22 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_22/v280.go b/models/migrations/v1_22/v280.go index 2271cb60896..5dbab169178 100644 --- a/models/migrations/v1_22/v280.go +++ b/models/migrations/v1_22/v280.go @@ -3,11 +3,9 @@ package v1_22 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func RenameUserThemes(x *xorm.Engine) error { +func RenameUserThemes(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() diff --git a/models/migrations/v1_22/v281.go b/models/migrations/v1_22/v281.go index 129ec2cba09..295d6b4aa9f 100644 --- a/models/migrations/v1_22/v281.go +++ b/models/migrations/v1_22/v281.go @@ -4,12 +4,11 @@ package v1_22 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func CreateAuthTokenTable(x *xorm.Engine) error { +func CreateAuthTokenTable(x db.EngineMigration) error { type AuthToken struct { ID string `xorm:"pk"` TokenHash string diff --git a/models/migrations/v1_22/v282.go b/models/migrations/v1_22/v282.go index eed64c30f79..fca5e1d5c24 100644 --- a/models/migrations/v1_22/v282.go +++ b/models/migrations/v1_22/v282.go @@ -3,11 +3,9 @@ package v1_22 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddIndexToPullAutoMergeDoerID(x *xorm.Engine) error { +func AddIndexToPullAutoMergeDoerID(x db.EngineMigration) error { type PullAutoMerge struct { DoerID int64 `xorm:"INDEX NOT NULL"` } diff --git a/models/migrations/v1_22/v283.go b/models/migrations/v1_22/v283.go index 0eca031b654..4aca890a859 100644 --- a/models/migrations/v1_22/v283.go +++ b/models/migrations/v1_22/v283.go @@ -6,11 +6,12 @@ package v1_22 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" + "xorm.io/xorm/schemas" ) -func AddCombinedIndexToIssueUser(x *xorm.Engine) error { +func AddCombinedIndexToIssueUser(x db.EngineMigration) error { type OldIssueUser struct { IssueID int64 UID int64 diff --git a/models/migrations/v1_22/v283_test.go b/models/migrations/v1_22/v283_test.go index 8e4c9410bd7..9705c3ee2fb 100644 --- a/models/migrations/v1_22/v283_test.go +++ b/models/migrations/v1_22/v283_test.go @@ -6,7 +6,7 @@ package v1_22 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_22/v284.go b/models/migrations/v1_22/v284.go index 31b38f6aed8..55a1646973c 100644 --- a/models/migrations/v1_22/v284.go +++ b/models/migrations/v1_22/v284.go @@ -4,10 +4,12 @@ package v1_22 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddIgnoreStaleApprovalsColumnToProtectedBranchTable(x *xorm.Engine) error { +func AddIgnoreStaleApprovalsColumnToProtectedBranchTable(x db.EngineMigration) error { type ProtectedBranch struct { IgnoreStaleApprovals bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_22/v285.go b/models/migrations/v1_22/v285.go index fed89f670e0..6cd24a21481 100644 --- a/models/migrations/v1_22/v285.go +++ b/models/migrations/v1_22/v285.go @@ -6,10 +6,12 @@ package v1_22 import ( "time" + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddPreviousDurationToActionRun(x *xorm.Engine) error { +func AddPreviousDurationToActionRun(x db.EngineMigration) error { type ActionRun struct { PreviousDuration time.Duration } diff --git a/models/migrations/v1_22/v286.go b/models/migrations/v1_22/v286.go index f3ba50dbb63..3f49400c2b4 100644 --- a/models/migrations/v1_22/v286.go +++ b/models/migrations/v1_22/v286.go @@ -6,13 +6,14 @@ import ( "errors" "fmt" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" "xorm.io/xorm" ) -func expandHashReferencesToSha256(x *xorm.Engine) error { +func expandHashReferencesToSha256(x db.EngineMigration) error { alteredTables := [][2]string{ {"commit_status", "context_hash"}, {"comment", "commit_sha"}, @@ -81,7 +82,7 @@ func expandHashReferencesToSha256(x *xorm.Engine) error { return db.Commit() } -func addObjectFormatNameToRepository(x *xorm.Engine) error { +func addObjectFormatNameToRepository(x db.EngineMigration) error { type Repository struct { ObjectFormatName string `xorm:"VARCHAR(6) NOT NULL DEFAULT 'sha1'"` } @@ -99,7 +100,7 @@ func addObjectFormatNameToRepository(x *xorm.Engine) error { return err } -func AdjustDBForSha256(x *xorm.Engine) error { +func AdjustDBForSha256(x db.EngineMigration) error { if err := expandHashReferencesToSha256(x); err != nil { return err } diff --git a/models/migrations/v1_22/v286_test.go b/models/migrations/v1_22/v286_test.go index 1bd7fac2f18..1874cbe884e 100644 --- a/models/migrations/v1_22/v286_test.go +++ b/models/migrations/v1_22/v286_test.go @@ -6,13 +6,13 @@ package v1_22 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/db" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" - "xorm.io/xorm" ) -func PrepareOldRepository(t *testing.T) (*xorm.Engine, func()) { +func PrepareOldRepository(t *testing.T) (db.EngineMigration, func()) { type Repository struct { // old struct ID int64 `xorm:"pk autoincr"` } diff --git a/models/migrations/v1_22/v287.go b/models/migrations/v1_22/v287.go index 5fd901f9ded..7b3de53b779 100644 --- a/models/migrations/v1_22/v287.go +++ b/models/migrations/v1_22/v287.go @@ -3,9 +3,7 @@ package v1_22 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" type BadgeUnique struct { ID int64 `xorm:"pk autoincr"` @@ -16,7 +14,7 @@ func (BadgeUnique) TableName() string { return "badge" } -func UseSlugInsteadOfIDForBadges(x *xorm.Engine) error { +func UseSlugInsteadOfIDForBadges(x db.EngineMigration) error { type Badge struct { Slug string } diff --git a/models/migrations/v1_22/v287_test.go b/models/migrations/v1_22/v287_test.go index 21946a662ab..7ac86d5d0f8 100644 --- a/models/migrations/v1_22/v287_test.go +++ b/models/migrations/v1_22/v287_test.go @@ -7,7 +7,7 @@ import ( "strconv" "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_22/v288.go b/models/migrations/v1_22/v288.go index 26c850c2188..cb133631c39 100644 --- a/models/migrations/v1_22/v288.go +++ b/models/migrations/v1_22/v288.go @@ -4,9 +4,8 @@ package v1_22 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) type Blocking struct { @@ -21,6 +20,6 @@ func (*Blocking) TableName() string { return "user_blocking" } -func AddUserBlockingTable(x *xorm.Engine) error { +func AddUserBlockingTable(x db.EngineMigration) error { return x.Sync(&Blocking{}) } diff --git a/models/migrations/v1_22/v289.go b/models/migrations/v1_22/v289.go index 78689a4ffae..e32e5b2a7f9 100644 --- a/models/migrations/v1_22/v289.go +++ b/models/migrations/v1_22/v289.go @@ -3,9 +3,13 @@ package v1_22 -import "xorm.io/xorm" +import ( + "gitea.dev/models/db" -func AddDefaultWikiBranch(x *xorm.Engine) error { + "xorm.io/xorm" +) + +func AddDefaultWikiBranch(x db.EngineMigration) error { type Repository struct { ID int64 DefaultWikiBranch string diff --git a/models/migrations/v1_22/v290.go b/models/migrations/v1_22/v290.go index 0f4d78410c1..55d1c192a74 100644 --- a/models/migrations/v1_22/v290.go +++ b/models/migrations/v1_22/v290.go @@ -4,6 +4,8 @@ package v1_22 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) @@ -11,7 +13,7 @@ type HookTask struct { PayloadVersion int `xorm:"DEFAULT 1"` } -func AddPayloadVersionToHookTaskTable(x *xorm.Engine) error { +func AddPayloadVersionToHookTaskTable(x db.EngineMigration) error { // create missing column if _, err := x.SyncWithOptions(xorm.SyncOptions{ IgnoreIndices: true, diff --git a/models/migrations/v1_22/v291.go b/models/migrations/v1_22/v291.go index 823a644a955..316fc1675ff 100644 --- a/models/migrations/v1_22/v291.go +++ b/models/migrations/v1_22/v291.go @@ -3,9 +3,13 @@ package v1_22 -import "xorm.io/xorm" +import ( + "gitea.dev/models/db" -func AddCommentIDIndexofAttachment(x *xorm.Engine) error { + "xorm.io/xorm" +) + +func AddCommentIDIndexofAttachment(x db.EngineMigration) error { type Attachment struct { CommentID int64 `xorm:"INDEX"` } diff --git a/models/migrations/v1_22/v293.go b/models/migrations/v1_22/v293.go index 5299b8618f0..8c082cea3bc 100644 --- a/models/migrations/v1_22/v293.go +++ b/models/migrations/v1_22/v293.go @@ -4,14 +4,13 @@ package v1_22 import ( - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" ) // CheckProjectColumnsConsistency ensures there is exactly one default board per project present -func CheckProjectColumnsConsistency(x *xorm.Engine) error { +func CheckProjectColumnsConsistency(x db.EngineMigration) error { sess := x.NewSession() defer sess.Close() @@ -79,7 +78,7 @@ func CheckProjectColumnsConsistency(x *xorm.Engine) error { return removeDuplicatedBoardDefault(x) } -func removeDuplicatedBoardDefault(x *xorm.Engine) error { +func removeDuplicatedBoardDefault(x db.EngineMigration) error { type ProjectInfo struct { ProjectID int64 DefaultNum int diff --git a/models/migrations/v1_22/v293_test.go b/models/migrations/v1_22/v293_test.go index bc3a33055cc..c19d0a4aa50 100644 --- a/models/migrations/v1_22/v293_test.go +++ b/models/migrations/v1_22/v293_test.go @@ -6,8 +6,8 @@ package v1_22 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/models/project" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/models/project" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_22/v294.go b/models/migrations/v1_22/v294.go index 8776e51a165..2c8f1744933 100644 --- a/models/migrations/v1_22/v294.go +++ b/models/migrations/v1_22/v294.go @@ -6,12 +6,13 @@ package v1_22 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" + "xorm.io/xorm/schemas" ) // AddUniqueIndexForProjectIssue adds unique indexes for project issue table -func AddUniqueIndexForProjectIssue(x *xorm.Engine) error { +func AddUniqueIndexForProjectIssue(x db.EngineMigration) error { // remove possible duplicated records in table project_issue type result struct { IssueID int64 diff --git a/models/migrations/v1_22/v294_test.go b/models/migrations/v1_22/v294_test.go index a711b5ec5f0..6a21b0adc50 100644 --- a/models/migrations/v1_22/v294_test.go +++ b/models/migrations/v1_22/v294_test.go @@ -6,7 +6,7 @@ package v1_22 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" "xorm.io/xorm/schemas" diff --git a/models/migrations/v1_22/v295.go b/models/migrations/v1_22/v295.go index 319b1a399b3..7595460281b 100644 --- a/models/migrations/v1_22/v295.go +++ b/models/migrations/v1_22/v295.go @@ -3,9 +3,9 @@ package v1_22 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddCommitStatusSummary(x *xorm.Engine) error { +func AddCommitStatusSummary(x db.EngineMigration) error { type CommitStatusSummary struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX UNIQUE(repo_id_sha)"` @@ -14,5 +14,5 @@ func AddCommitStatusSummary(x *xorm.Engine) error { } // there is no migrations because if there is no data on this table, it will fall back to get data // from commit status - return x.Sync2(new(CommitStatusSummary)) + return x.Sync(new(CommitStatusSummary)) } diff --git a/models/migrations/v1_22/v296.go b/models/migrations/v1_22/v296.go index 75350f9f654..79134dea011 100644 --- a/models/migrations/v1_22/v296.go +++ b/models/migrations/v1_22/v296.go @@ -3,9 +3,9 @@ package v1_22 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddCommitStatusSummary2(x *xorm.Engine) error { +func AddCommitStatusSummary2(x db.EngineMigration) error { type CommitStatusSummary struct { ID int64 `xorm:"pk autoincr"` TargetURL string `xorm:"TEXT"` diff --git a/models/migrations/v1_22/v297.go b/models/migrations/v1_22/v297.go index 9a4405f2666..9912434e44c 100644 --- a/models/migrations/v1_22/v297.go +++ b/models/migrations/v1_22/v297.go @@ -4,12 +4,11 @@ package v1_22 import ( - "code.gitea.io/gitea/models/perm" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/perm" ) -func AddRepoUnitEveryoneAccessMode(x *xorm.Engine) error { +func AddRepoUnitEveryoneAccessMode(x db.EngineMigration) error { type RepoUnit struct { //revive:disable-line:exported EveryoneAccessMode perm.AccessMode `xorm:"NOT NULL DEFAULT 0"` } diff --git a/models/migrations/v1_22/v298.go b/models/migrations/v1_22/v298.go index 7700173a004..d334ff4142a 100644 --- a/models/migrations/v1_22/v298.go +++ b/models/migrations/v1_22/v298.go @@ -3,8 +3,8 @@ package v1_22 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func DropWronglyCreatedTable(x *xorm.Engine) error { +func DropWronglyCreatedTable(x db.EngineMigration) error { return x.DropTables("o_auth2_application") } diff --git a/models/migrations/v1_23/main_test.go b/models/migrations/v1_23/main_test.go index ffccac0fd3d..03a2a2d048e 100644 --- a/models/migrations/v1_23/main_test.go +++ b/models/migrations/v1_23/main_test.go @@ -6,7 +6,7 @@ package v1_23 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_23/v299.go b/models/migrations/v1_23/v299.go index 11021d8855f..cb6fd97c924 100644 --- a/models/migrations/v1_23/v299.go +++ b/models/migrations/v1_23/v299.go @@ -3,9 +3,13 @@ package v1_23 -import "xorm.io/xorm" +import ( + "gitea.dev/models/db" -func AddContentVersionToIssueAndComment(x *xorm.Engine) error { + "xorm.io/xorm" +) + +func AddContentVersionToIssueAndComment(x db.EngineMigration) error { type Issue struct { ContentVersion int `xorm:"NOT NULL DEFAULT 0"` } diff --git a/models/migrations/v1_23/v300.go b/models/migrations/v1_23/v300.go index 13c6489c5e4..06c6c161b62 100644 --- a/models/migrations/v1_23/v300.go +++ b/models/migrations/v1_23/v300.go @@ -3,9 +3,13 @@ package v1_23 -import "xorm.io/xorm" +import ( + "gitea.dev/models/db" -func AddForcePushBranchProtection(x *xorm.Engine) error { + "xorm.io/xorm" +) + +func AddForcePushBranchProtection(x db.EngineMigration) error { type ProtectedBranch struct { CanForcePush bool `xorm:"NOT NULL DEFAULT false"` EnableForcePushAllowlist bool `xorm:"NOT NULL DEFAULT false"` diff --git a/models/migrations/v1_23/v301.go b/models/migrations/v1_23/v301.go index ed8e9ef0599..03f6f2012a5 100644 --- a/models/migrations/v1_23/v301.go +++ b/models/migrations/v1_23/v301.go @@ -3,10 +3,14 @@ package v1_23 -import "xorm.io/xorm" +import ( + "gitea.dev/models/db" + + "xorm.io/xorm" +) // AddSkipSeconderyAuthToOAuth2ApplicationTable: add SkipSecondaryAuthorization column, setting existing rows to false -func AddSkipSecondaryAuthColumnToOAuth2ApplicationTable(x *xorm.Engine) error { +func AddSkipSecondaryAuthColumnToOAuth2ApplicationTable(x db.EngineMigration) error { type oauth2Application struct { SkipSecondaryAuthorization bool `xorm:"NOT NULL DEFAULT FALSE"` } diff --git a/models/migrations/v1_23/v302.go b/models/migrations/v1_23/v302.go index e4a50b3ec88..c347a0a0687 100644 --- a/models/migrations/v1_23/v302.go +++ b/models/migrations/v1_23/v302.go @@ -4,12 +4,13 @@ package v1_23 import ( - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" "xorm.io/xorm" ) -func AddIndexToActionTaskStoppedLogExpired(x *xorm.Engine) error { +func AddIndexToActionTaskStoppedLogExpired(x db.EngineMigration) error { type ActionTask struct { Stopped timeutil.TimeStamp `xorm:"index(stopped_log_expired)"` LogExpired bool `xorm:"index(stopped_log_expired)"` diff --git a/models/migrations/v1_23/v302_test.go b/models/migrations/v1_23/v302_test.go index 1832adf39ab..c0af662fc98 100644 --- a/models/migrations/v1_23/v302_test.go +++ b/models/migrations/v1_23/v302_test.go @@ -6,8 +6,8 @@ package v1_23 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_23/v303.go b/models/migrations/v1_23/v303.go index dc541a9535a..c11e23b2f33 100644 --- a/models/migrations/v1_23/v303.go +++ b/models/migrations/v1_23/v303.go @@ -4,6 +4,8 @@ package v1_23 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) @@ -14,7 +16,7 @@ type CommentMetaData struct { ProjectTitle string `json:"project_title"` } -func AddCommentMetaDataColumn(x *xorm.Engine) error { +func AddCommentMetaDataColumn(x db.EngineMigration) error { type Comment struct { CommentMetaData *CommentMetaData `xorm:"JSON TEXT"` // put all non-index metadata in a single field } diff --git a/models/migrations/v1_23/v304.go b/models/migrations/v1_23/v304.go index 35d4d4881a9..2920c712a82 100644 --- a/models/migrations/v1_23/v304.go +++ b/models/migrations/v1_23/v304.go @@ -3,9 +3,13 @@ package v1_23 -import "xorm.io/xorm" +import ( + "gitea.dev/models/db" -func AddIndexForReleaseSha1(x *xorm.Engine) error { + "xorm.io/xorm" +) + +func AddIndexForReleaseSha1(x db.EngineMigration) error { type Release struct { Sha1 string `xorm:"INDEX VARCHAR(64)"` } diff --git a/models/migrations/v1_23/v304_test.go b/models/migrations/v1_23/v304_test.go index 9af84cd257f..2cd550d395b 100644 --- a/models/migrations/v1_23/v304_test.go +++ b/models/migrations/v1_23/v304_test.go @@ -6,8 +6,8 @@ package v1_23 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_23/v305.go b/models/migrations/v1_23/v305.go index 3762279de1b..9832fd17b61 100644 --- a/models/migrations/v1_23/v305.go +++ b/models/migrations/v1_23/v305.go @@ -4,12 +4,11 @@ package v1_23 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddRepositoryLicenses(x *xorm.Engine) error { +func AddRepositoryLicenses(x db.EngineMigration) error { type RepoLicense struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"UNIQUE(s) NOT NULL"` diff --git a/models/migrations/v1_23/v306.go b/models/migrations/v1_23/v306.go index c5c89dbeb8f..7da7b548f3b 100644 --- a/models/migrations/v1_23/v306.go +++ b/models/migrations/v1_23/v306.go @@ -3,9 +3,13 @@ package v1_23 -import "xorm.io/xorm" +import ( + "gitea.dev/models/db" -func AddBlockAdminMergeOverrideBranchProtection(x *xorm.Engine) error { + "xorm.io/xorm" +) + +func AddBlockAdminMergeOverrideBranchProtection(x db.EngineMigration) error { type ProtectedBranch struct { BlockAdminMergeOverride bool `xorm:"NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_23/v307.go b/models/migrations/v1_23/v307.go index 54a69d250b7..f87257b21e5 100644 --- a/models/migrations/v1_23/v307.go +++ b/models/migrations/v1_23/v307.go @@ -4,12 +4,11 @@ package v1_23 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func FixMilestoneNoDueDate(x *xorm.Engine) error { +func FixMilestoneNoDueDate(x db.EngineMigration) error { type Milestone struct { DeadlineUnix timeutil.TimeStamp } diff --git a/models/migrations/v1_23/v308.go b/models/migrations/v1_23/v308.go index 695fdfcc2de..8a511aae77e 100644 --- a/models/migrations/v1_23/v308.go +++ b/models/migrations/v1_23/v308.go @@ -4,9 +4,9 @@ package v1_23 import ( - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) @@ -47,6 +47,6 @@ func (a *improveActionTableIndicesAction) TableIndices() []*schemas.Index { return indices } -func AddNewIndexForUserDashboard(x *xorm.Engine) error { +func AddNewIndexForUserDashboard(x db.EngineMigration) error { return x.Sync(new(improveActionTableIndicesAction)) } diff --git a/models/migrations/v1_23/v309.go b/models/migrations/v1_23/v309.go index e629b718a80..432ae62e3c6 100644 --- a/models/migrations/v1_23/v309.go +++ b/models/migrations/v1_23/v309.go @@ -4,9 +4,9 @@ package v1_23 import ( - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) @@ -72,6 +72,6 @@ func (*improveNotificationTableIndicesAction) TableIndices() []*schemas.Index { return indices } -func ImproveNotificationTableIndices(x *xorm.Engine) error { +func ImproveNotificationTableIndices(x db.EngineMigration) error { return x.Sync(&improveNotificationTableIndicesAction{}) } diff --git a/models/migrations/v1_23/v310.go b/models/migrations/v1_23/v310.go index 074b1c54d35..845eaf19bad 100644 --- a/models/migrations/v1_23/v310.go +++ b/models/migrations/v1_23/v310.go @@ -4,10 +4,12 @@ package v1_23 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddPriorityToProtectedBranch(x *xorm.Engine) error { +func AddPriorityToProtectedBranch(x db.EngineMigration) error { type ProtectedBranch struct { Priority int64 `xorm:"NOT NULL DEFAULT 0"` } diff --git a/models/migrations/v1_23/v311.go b/models/migrations/v1_23/v311.go index ef48085c79b..8b9c0e78a35 100644 --- a/models/migrations/v1_23/v311.go +++ b/models/migrations/v1_23/v311.go @@ -4,10 +4,12 @@ package v1_23 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddTimeEstimateColumnToIssueTable(x *xorm.Engine) error { +func AddTimeEstimateColumnToIssueTable(x db.EngineMigration) error { type Issue struct { TimeEstimate int64 `xorm:"NOT NULL DEFAULT 0"` } diff --git a/models/migrations/v1_24/v312.go b/models/migrations/v1_24/v312.go index 823b0eae403..c3f0c5635d1 100644 --- a/models/migrations/v1_24/v312.go +++ b/models/migrations/v1_24/v312.go @@ -4,6 +4,8 @@ package v1_24 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) @@ -16,7 +18,7 @@ func (pullAutoMerge) TableName() string { return "pull_auto_merge" } -func AddDeleteBranchAfterMergeForAutoMerge(x *xorm.Engine) error { +func AddDeleteBranchAfterMergeForAutoMerge(x db.EngineMigration) error { _, err := x.SyncWithOptions(xorm.SyncOptions{ IgnoreConstrains: true, IgnoreIndices: true, diff --git a/models/migrations/v1_24/v313.go b/models/migrations/v1_24/v313.go index 7e6cda6bfd3..69bfda106e8 100644 --- a/models/migrations/v1_24/v313.go +++ b/models/migrations/v1_24/v313.go @@ -4,12 +4,11 @@ package v1_24 import ( - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func MovePinOrderToTableIssuePin(x *xorm.Engine) error { +func MovePinOrderToTableIssuePin(x db.EngineMigration) error { type IssuePin struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"UNIQUE(s) NOT NULL"` diff --git a/models/migrations/v1_24/v314.go b/models/migrations/v1_24/v314.go index 51cb2e34aa9..502dce9c2a8 100644 --- a/models/migrations/v1_24/v314.go +++ b/models/migrations/v1_24/v314.go @@ -3,11 +3,9 @@ package v1_24 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func UpdateOwnerIDOfRepoLevelActionsTables(x *xorm.Engine) error { +func UpdateOwnerIDOfRepoLevelActionsTables(x db.EngineMigration) error { if _, err := x.Exec("UPDATE `action_runner` SET `owner_id` = 0 WHERE `repo_id` > 0 AND `owner_id` > 0"); err != nil { return err } diff --git a/models/migrations/v1_24/v315.go b/models/migrations/v1_24/v315.go index 52b9b447856..168b9efb320 100644 --- a/models/migrations/v1_24/v315.go +++ b/models/migrations/v1_24/v315.go @@ -4,10 +4,12 @@ package v1_24 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddEphemeralToActionRunner(x *xorm.Engine) error { +func AddEphemeralToActionRunner(x db.EngineMigration) error { type ActionRunner struct { Ephemeral bool `xorm:"ephemeral NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_24/v316.go b/models/migrations/v1_24/v316.go index 14e888f9eea..9539ee8a998 100644 --- a/models/migrations/v1_24/v316.go +++ b/models/migrations/v1_24/v316.go @@ -4,10 +4,12 @@ package v1_24 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddDescriptionForSecretsAndVariables(x *xorm.Engine) error { +func AddDescriptionForSecretsAndVariables(x db.EngineMigration) error { type Secret struct { Description string `xorm:"TEXT"` } diff --git a/models/migrations/v1_24/v317.go b/models/migrations/v1_24/v317.go index a13db2dd27e..622f9e03ddb 100644 --- a/models/migrations/v1_24/v317.go +++ b/models/migrations/v1_24/v317.go @@ -4,9 +4,9 @@ package v1_24 import ( - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) @@ -51,6 +51,6 @@ func (a *improveActionTableIndicesAction) TableIndices() []*schemas.Index { return indices } -func AddNewIndexForUserDashboard(x *xorm.Engine) error { +func AddNewIndexForUserDashboard(x db.EngineMigration) error { return x.Sync(new(improveActionTableIndicesAction)) } diff --git a/models/migrations/v1_24/v318.go b/models/migrations/v1_24/v318.go index 9b4a5409609..cad0ca397d1 100644 --- a/models/migrations/v1_24/v318.go +++ b/models/migrations/v1_24/v318.go @@ -4,12 +4,13 @@ package v1_24 import ( - "code.gitea.io/gitea/models/perm" + "gitea.dev/models/db" + "gitea.dev/models/perm" "xorm.io/xorm" ) -func AddRepoUnitAnonymousAccessMode(x *xorm.Engine) error { +func AddRepoUnitAnonymousAccessMode(x db.EngineMigration) error { type RepoUnit struct { //revive:disable-line:exported AnonymousAccessMode perm.AccessMode `xorm:"NOT NULL DEFAULT 0"` } diff --git a/models/migrations/v1_24/v319.go b/models/migrations/v1_24/v319.go index 648081f74e0..a26ac0ce710 100644 --- a/models/migrations/v1_24/v319.go +++ b/models/migrations/v1_24/v319.go @@ -4,10 +4,12 @@ package v1_24 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddExclusiveOrderColumnToLabelTable(x *xorm.Engine) error { +func AddExclusiveOrderColumnToLabelTable(x db.EngineMigration) error { type Label struct { ExclusiveOrder int `xorm:"DEFAULT 0"` } diff --git a/models/migrations/v1_24/v320.go b/models/migrations/v1_24/v320.go index ebef71939c2..7ff7a78033e 100644 --- a/models/migrations/v1_24/v320.go +++ b/models/migrations/v1_24/v320.go @@ -4,12 +4,13 @@ package v1_24 import ( - "code.gitea.io/gitea/modules/json" + "gitea.dev/models/db" + "gitea.dev/modules/json" "xorm.io/xorm" ) -func MigrateSkipTwoFactor(x *xorm.Engine) error { +func MigrateSkipTwoFactor(x db.EngineMigration) error { type LoginSource struct { TwoFactorPolicy string `xorm:"two_factor_policy NOT NULL DEFAULT ''"` } diff --git a/models/migrations/v1_25/main_test.go b/models/migrations/v1_25/main_test.go index 33c981edb97..a4fbc0e6ab8 100644 --- a/models/migrations/v1_25/main_test.go +++ b/models/migrations/v1_25/main_test.go @@ -6,7 +6,7 @@ package v1_25 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_25/v321.go b/models/migrations/v1_25/v321.go index 73ef180f485..dfea8f0d44b 100644 --- a/models/migrations/v1_25/v321.go +++ b/models/migrations/v1_25/v321.go @@ -4,14 +4,14 @@ package v1_25 import ( - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/setting" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) -func UseLongTextInSomeColumnsAndFixBugs(x *xorm.Engine) error { +func UseLongTextInSomeColumnsAndFixBugs(x db.EngineMigration) error { if !setting.Database.Type.IsMySQL() { return nil // Only mysql need to change from text to long text, for other databases, they are the same } diff --git a/models/migrations/v1_25/v321_test.go b/models/migrations/v1_25/v321_test.go index 0749a20e20e..a20b4c916dd 100644 --- a/models/migrations/v1_25/v321_test.go +++ b/models/migrations/v1_25/v321_test.go @@ -6,9 +6,9 @@ package v1_25 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/migrations/v1_25/v322.go b/models/migrations/v1_25/v322.go index 32dae9945ae..16eabace322 100644 --- a/models/migrations/v1_25/v322.go +++ b/models/migrations/v1_25/v322.go @@ -4,13 +4,13 @@ package v1_25 import ( - "code.gitea.io/gitea/models/migrations/base" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" - "xorm.io/xorm" "xorm.io/xorm/schemas" ) -func ExtendCommentTreePathLength(x *xorm.Engine) error { +func ExtendCommentTreePathLength(x db.EngineMigration) error { dbType := x.Dialect().URI().DBType if dbType == schemas.SQLITE { // For SQLITE, varchar or char will always be represented as TEXT return nil diff --git a/models/migrations/v1_25/v322_test.go b/models/migrations/v1_25/v322_test.go index 19646140351..2e5f9a87d9b 100644 --- a/models/migrations/v1_25/v322_test.go +++ b/models/migrations/v1_25/v322_test.go @@ -6,8 +6,8 @@ package v1_25 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/setting" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/migrations/v1_26/main_test.go b/models/migrations/v1_26/main_test.go index 0b271b9bbcf..9befeee38f5 100644 --- a/models/migrations/v1_26/main_test.go +++ b/models/migrations/v1_26/main_test.go @@ -6,7 +6,7 @@ package v1_26 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_26/v323.go b/models/migrations/v1_26/v323.go index b116f73bf0e..f2a701cb8fb 100644 --- a/models/migrations/v1_26/v323.go +++ b/models/migrations/v1_26/v323.go @@ -4,10 +4,12 @@ package v1_26 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddActionsConcurrency(x *xorm.Engine) error { +func AddActionsConcurrency(x db.EngineMigration) error { type ActionRun struct { RepoID int64 `xorm:"index(repo_concurrency)"` RawConcurrency string diff --git a/models/migrations/v1_26/v324.go b/models/migrations/v1_26/v324.go index 5d96bfa3cae..cca28e1241c 100644 --- a/models/migrations/v1_26/v324.go +++ b/models/migrations/v1_26/v324.go @@ -6,10 +6,10 @@ package v1_26 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" ) -func FixClosedMilestoneCompleteness(x *xorm.Engine) error { +func FixClosedMilestoneCompleteness(x db.EngineMigration) error { // Update all milestones to recalculate completeness with the new logic: // - Closed milestones with 0 issues should show 100% // - All other milestones should calculate based on closed/total ratio diff --git a/models/migrations/v1_26/v325.go b/models/migrations/v1_26/v325.go index d81540f44e9..e7bac3e02d5 100644 --- a/models/migrations/v1_26/v325.go +++ b/models/migrations/v1_26/v325.go @@ -3,11 +3,9 @@ package v1_26 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func FixMissedRepoIDWhenMigrateAttachments(x *xorm.Engine) error { +func FixMissedRepoIDWhenMigrateAttachments(x db.EngineMigration) error { _, err := x.Exec("UPDATE `attachment` SET `repo_id` = (SELECT `repo_id` FROM `issue` WHERE `issue`.`id` = `attachment`.`issue_id`) WHERE `issue_id` > 0 AND (`repo_id` IS NULL OR `repo_id` = 0);") if err != nil { return err diff --git a/models/migrations/v1_26/v325_test.go b/models/migrations/v1_26/v325_test.go index 3fd658e01b9..b18b9544692 100644 --- a/models/migrations/v1_26/v325_test.go +++ b/models/migrations/v1_26/v325_test.go @@ -6,8 +6,8 @@ package v1_26 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/require" ) diff --git a/models/migrations/v1_26/v326.go b/models/migrations/v1_26/v326.go index dcf548bec0e..b2c28f06d9a 100644 --- a/models/migrations/v1_26/v326.go +++ b/models/migrations/v1_26/v326.go @@ -10,12 +10,11 @@ import ( "strconv" "strings" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - webhook_module "code.gitea.io/gitea/modules/webhook" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/json" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + webhook_module "gitea.dev/modules/webhook" ) const ( @@ -92,7 +91,7 @@ type commitSHAAndRuns struct { // Only rows whose resolved run ID is below legacyURLIDThreshold are rewritten. // This is because smaller legacy run indexes are more likely to collide with run ID URLs during runtime resolution, // so this migration prioritizes that lower range and leaves the remaining legacy target URLs to the web compatibility logic. -func FixCommitStatusTargetURLToUseRunAndJobID(x *xorm.Engine) error { +func FixCommitStatusTargetURLToUseRunAndJobID(x db.EngineMigration) error { jobsByRunIDCache := make(map[int64][]int64) repoLinkCache := make(map[int64]string) groups, err := loadLegacyMigrationRunGroups(x) @@ -113,7 +112,7 @@ func FixCommitStatusTargetURLToUseRunAndJobID(x *xorm.Engine) error { return nil } -func loadLegacyMigrationRunGroups(x *xorm.Engine) (map[int64]map[string]*commitSHAAndRuns, error) { +func loadLegacyMigrationRunGroups(x db.EngineMigration) (map[int64]map[string]*commitSHAAndRuns, error) { var runs []migrationActionRun if err := x.Table("action_run"). Where("id < ?", legacyURLIDThreshold). @@ -149,7 +148,7 @@ func loadLegacyMigrationRunGroups(x *xorm.Engine) (map[int64]map[string]*commitS } func migrateCommitStatusTargetURLForGroup( - x *xorm.Engine, + x db.EngineMigration, table string, repoID int64, sha string, @@ -210,7 +209,7 @@ func migrateCommitStatusTargetURLForGroup( return nil } -func getRepoLinkCached(x *xorm.Engine, cache map[int64]string, repoID int64) (string, error) { +func getRepoLinkCached(x db.EngineMigration, cache map[int64]string, repoID int64) (string, error) { if link, ok := cache[repoID]; ok { return link, nil } @@ -228,7 +227,7 @@ func getRepoLinkCached(x *xorm.Engine, cache map[int64]string, repoID int64) (st return link, nil } -func getJobIDByIndexCached(x *xorm.Engine, cache map[int64][]int64, runID, jobIndex int64) (int64, bool, error) { +func getJobIDByIndexCached(x db.EngineMigration, cache map[int64][]int64, runID, jobIndex int64) (int64, bool, error) { jobIDs, ok := cache[runID] if !ok { var jobs []migrationActionRunJob diff --git a/models/migrations/v1_26/v326_test.go b/models/migrations/v1_26/v326_test.go index a0225eb774c..09f3c3ab5c7 100644 --- a/models/migrations/v1_26/v326_test.go +++ b/models/migrations/v1_26/v326_test.go @@ -6,16 +6,16 @@ package v1_26 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/test" + "gitea.dev/models/db" + "gitea.dev/models/migrations/migrationtest" + "gitea.dev/modules/setting" + "gitea.dev/modules/test" - _ "code.gitea.io/gitea/models/actions" - _ "code.gitea.io/gitea/models/git" - _ "code.gitea.io/gitea/models/repo" + _ "gitea.dev/models/actions" + _ "gitea.dev/models/git" + _ "gitea.dev/models/repo" "github.com/stretchr/testify/require" - "xorm.io/xorm" ) func Test_FixCommitStatusTargetURLToUseRunAndJobID(t *testing.T) { @@ -100,7 +100,7 @@ func Test_FixCommitStatusTargetURLToUseRunAndJobID(t *testing.T) { } } -func assertTargetURL(t *testing.T, x *xorm.Engine, table string, id int64, want string) { +func assertTargetURL(t *testing.T, x db.EngineMigration, table string, id int64, want string) { t.Helper() var row struct { diff --git a/models/migrations/v1_26/v327.go b/models/migrations/v1_26/v327.go index 51af567650d..19c1eae725f 100644 --- a/models/migrations/v1_26/v327.go +++ b/models/migrations/v1_26/v327.go @@ -3,9 +3,13 @@ package v1_26 -import "xorm.io/xorm" +import ( + "gitea.dev/models/db" -func AddDisabledToActionRunner(x *xorm.Engine) error { + "xorm.io/xorm" +) + +func AddDisabledToActionRunner(x db.EngineMigration) error { type ActionRunner struct { IsDisabled bool `xorm:"is_disabled NOT NULL DEFAULT false"` } diff --git a/models/migrations/v1_26/v327_test.go b/models/migrations/v1_26/v327_test.go index 98e948cf05c..f93c2cbc20f 100644 --- a/models/migrations/v1_26/v327_test.go +++ b/models/migrations/v1_26/v327_test.go @@ -6,7 +6,7 @@ package v1_26 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/require" ) diff --git a/models/migrations/v1_26/v328.go b/models/migrations/v1_26/v328.go index 81047305289..b7ca9930496 100644 --- a/models/migrations/v1_26/v328.go +++ b/models/migrations/v1_26/v328.go @@ -4,10 +4,12 @@ package v1_26 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddTokenPermissionsToActionRunJob(x *xorm.Engine) error { +func AddTokenPermissionsToActionRunJob(x db.EngineMigration) error { type ActionRunJob struct { TokenPermissions string `xorm:"JSON TEXT"` } diff --git a/models/migrations/v1_26/v329.go b/models/migrations/v1_26/v329.go index 1afd155f05e..15754e28665 100644 --- a/models/migrations/v1_26/v329.go +++ b/models/migrations/v1_26/v329.go @@ -6,7 +6,8 @@ package v1_26 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" + "xorm.io/xorm/schemas" ) @@ -27,7 +28,7 @@ func (n *UserBadge) TableIndices() []*schemas.Index { // AddUniqueIndexForUserBadge adds a compound unique indexes for user badge table // and it replaces an old index on user_id -func AddUniqueIndexForUserBadge(x *xorm.Engine) error { +func AddUniqueIndexForUserBadge(x db.EngineMigration) error { // remove possible duplicated records in table user_badge type result struct { UserID int64 diff --git a/models/migrations/v1_26/v329_test.go b/models/migrations/v1_26/v329_test.go index e4bebfb71dc..4b20273e7b5 100644 --- a/models/migrations/v1_26/v329_test.go +++ b/models/migrations/v1_26/v329_test.go @@ -6,7 +6,7 @@ package v1_26 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" ) diff --git a/models/migrations/v1_26/v330.go b/models/migrations/v1_26/v330.go index 9f77331090b..341da864bd6 100644 --- a/models/migrations/v1_26/v330.go +++ b/models/migrations/v1_26/v330.go @@ -4,10 +4,12 @@ package v1_26 import ( + "gitea.dev/models/db" + "xorm.io/xorm" ) -func AddNameToWebhook(x *xorm.Engine) error { +func AddNameToWebhook(x db.EngineMigration) error { type Webhook struct { Name string `xorm:"VARCHAR(255) NOT NULL DEFAULT ''"` } diff --git a/models/migrations/v1_27/main_test.go b/models/migrations/v1_27/main_test.go index 0c6a6a24401..949c88c23fb 100644 --- a/models/migrations/v1_27/main_test.go +++ b/models/migrations/v1_27/main_test.go @@ -6,7 +6,7 @@ package v1_27 import ( "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" ) func TestMain(m *testing.M) { diff --git a/models/migrations/v1_27/v331.go b/models/migrations/v1_27/v331.go index 204b7b661e9..09d94929d0d 100644 --- a/models/migrations/v1_27/v331.go +++ b/models/migrations/v1_27/v331.go @@ -7,8 +7,9 @@ import ( "context" "time" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/timeutil" "xorm.io/xorm" ) @@ -90,7 +91,7 @@ func (actionRun) TableName() string { } // AddActionRunAttemptModel adds the ActionRunAttempt table and the supporting ActionRun/ActionRunJob fields. -func AddActionRunAttemptModel(x *xorm.Engine) error { +func AddActionRunAttemptModel(x db.EngineMigration) error { // add "action_run_attempt" if _, err := x.SyncWithOptions(xorm.SyncOptions{ IgnoreDropIndices: true, diff --git a/models/migrations/v1_27/v331_test.go b/models/migrations/v1_27/v331_test.go index 2302fee024f..d86f9d943ff 100644 --- a/models/migrations/v1_27/v331_test.go +++ b/models/migrations/v1_27/v331_test.go @@ -8,7 +8,7 @@ import ( "slices" "testing" - "code.gitea.io/gitea/models/migrations/migrationtest" + "gitea.dev/models/migrations/migrationtest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/migrations/v1_27/v332.go b/models/migrations/v1_27/v332.go new file mode 100644 index 00000000000..e0fc6a6c0f6 --- /dev/null +++ b/models/migrations/v1_27/v332.go @@ -0,0 +1,25 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_27 + +import ( + "gitea.dev/models/db" + + "xorm.io/xorm" +) + +type mirrorWithLastSyncUnix struct { + LastSyncUnix int64 `xorm:"INDEX"` +} + +func (mirrorWithLastSyncUnix) TableName() string { + return "mirror" +} + +func AddLastSyncUnixToMirror(x db.EngineMigration) error { + _, err := x.SyncWithOptions(xorm.SyncOptions{ + IgnoreDropIndices: true, + }, new(mirrorWithLastSyncUnix)) + return err +} diff --git a/models/migrations/v1_27/v333.go b/models/migrations/v1_27/v333.go new file mode 100644 index 00000000000..e019313d1e7 --- /dev/null +++ b/models/migrations/v1_27/v333.go @@ -0,0 +1,24 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_27 + +import ( + "gitea.dev/models/db" + + "xorm.io/xorm" +) + +func AddBranchProtectionBypassAllowlist(x db.EngineMigration) error { + type ProtectedBranch struct { + EnableBypassAllowlist bool `xorm:"NOT NULL DEFAULT false"` + BypassAllowlistUserIDs []int64 `xorm:"JSON TEXT"` + BypassAllowlistTeamIDs []int64 `xorm:"JSON TEXT"` + } + + _, err := x.SyncWithOptions(xorm.SyncOptions{ + IgnoreConstrains: true, + IgnoreIndices: true, + }, new(ProtectedBranch)) + return err +} diff --git a/models/migrations/v1_27/v333_test.go b/models/migrations/v1_27/v333_test.go new file mode 100644 index 00000000000..901831fb1ec --- /dev/null +++ b/models/migrations/v1_27/v333_test.go @@ -0,0 +1,60 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_27 + +import ( + "testing" + + "gitea.dev/models/migrations/migrationtest" + + "github.com/stretchr/testify/require" +) + +func Test_AddBranchProtectionBypassAllowlist(t *testing.T) { + type ProtectedBranch struct { + ID int64 `xorm:"pk autoincr"` + RepoID int64 `xorm:"INDEX"` + BranchName string `xorm:"INDEX"` + EnableBypassAllowlist bool `xorm:"NOT NULL DEFAULT false"` + BypassAllowlistUserIDs []int64 `xorm:"JSON TEXT"` + BypassAllowlistTeamIDs []int64 `xorm:"JSON TEXT"` + } + + x, deferable := migrationtest.PrepareTestEnv(t, 0, new(ProtectedBranch)) + defer deferable() + + // Test with default values + _, err := x.Insert(&ProtectedBranch{RepoID: 1, BranchName: "main"}) + require.NoError(t, err) + + // Test with populated allowlist + _, err = x.Insert(&ProtectedBranch{ + RepoID: 1, + BranchName: "develop", + EnableBypassAllowlist: true, + BypassAllowlistUserIDs: []int64{1, 2, 3}, + BypassAllowlistTeamIDs: []int64{10, 20}, + }) + require.NoError(t, err) + + require.NoError(t, AddBranchProtectionBypassAllowlist(x)) + + // Verify the default values record + var pb ProtectedBranch + has, err := x.Where("repo_id = ? AND branch_name = ?", 1, "main").Get(&pb) + require.NoError(t, err) + require.True(t, has) + require.False(t, pb.EnableBypassAllowlist) + require.Nil(t, pb.BypassAllowlistUserIDs) + require.Nil(t, pb.BypassAllowlistTeamIDs) + + // Verify the populated allowlist record + var pb2 ProtectedBranch + has, err = x.Where("repo_id = ? AND branch_name = ?", 1, "develop").Get(&pb2) + require.NoError(t, err) + require.True(t, has) + require.True(t, pb2.EnableBypassAllowlist) + require.Equal(t, []int64{1, 2, 3}, pb2.BypassAllowlistUserIDs) + require.Equal(t, []int64{10, 20}, pb2.BypassAllowlistTeamIDs) +} diff --git a/models/migrations/v1_27/v334.go b/models/migrations/v1_27/v334.go new file mode 100644 index 00000000000..a39a3ecf844 --- /dev/null +++ b/models/migrations/v1_27/v334.go @@ -0,0 +1,22 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_27 + +import ( + "gitea.dev/models/db" + + "xorm.io/xorm" +) + +func AddCancellingSupportToActionRunner(x db.EngineMigration) error { + type ActionRunner struct { + HasCancellingSupport bool `xorm:"has_cancelling_support NOT NULL DEFAULT false"` + } + + _, err := x.SyncWithOptions(xorm.SyncOptions{ + IgnoreConstrains: true, + IgnoreDropIndices: true, + }, new(ActionRunner)) + return err +} diff --git a/models/migrations/v1_27/v334_test.go b/models/migrations/v1_27/v334_test.go new file mode 100644 index 00000000000..8bcb82e4751 --- /dev/null +++ b/models/migrations/v1_27/v334_test.go @@ -0,0 +1,36 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_27 + +import ( + "testing" + + "gitea.dev/models/migrations/migrationtest" + + "github.com/stretchr/testify/require" +) + +func TestAddCancellingSupportToActionRunner(t *testing.T) { + type ActionRunner struct { + ID int64 `xorm:"pk autoincr"` + Name string + } + + x, deferable := migrationtest.PrepareTestEnv(t, 0, new(ActionRunner)) + defer deferable() + if x == nil || t.Failed() { + return + } + + _, err := x.Insert(&ActionRunner{Name: "runner"}) + require.NoError(t, err) + + require.NoError(t, AddCancellingSupportToActionRunner(x)) + + var hasCancellingSupport bool + has, err := x.SQL("SELECT has_cancelling_support FROM action_runner WHERE id = ?", 1).Get(&hasCancellingSupport) + require.NoError(t, err) + require.True(t, has) + require.False(t, hasCancellingSupport) +} diff --git a/models/migrations/v1_27/v335.go b/models/migrations/v1_27/v335.go new file mode 100644 index 00000000000..c14488e343e --- /dev/null +++ b/models/migrations/v1_27/v335.go @@ -0,0 +1,33 @@ +// Copyright 2026 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_27 + +import ( + "gitea.dev/models/db" + + "xorm.io/xorm" +) + +// AddReusableWorkflowFieldsToActionRunJob adds the ActionRunJob columns that describe the reusable workflow caller hierarchy, +// and the ActionRunAttemptJobIDIndex table backing run-wide AttemptJobID allocation. +func AddReusableWorkflowFieldsToActionRunJob(x db.EngineMigration) error { + type ActionRunJob struct { + WorkflowSourceRepoID int64 `xorm:"NOT NULL DEFAULT 0"` + WorkflowSourceCommitSHA string `xorm:"VARCHAR(64) NOT NULL DEFAULT ''"` + IsReusableCaller bool `xorm:"index NOT NULL DEFAULT FALSE"` + ParentJobID int64 `xorm:"index NOT NULL DEFAULT 0"` + CallUses string `xorm:"VARCHAR(512) NOT NULL DEFAULT ''"` + CallSecrets string `xorm:"LONGTEXT"` + CallPayload string `xorm:"LONGTEXT"` + IsExpanded bool `xorm:"NOT NULL DEFAULT FALSE"` + ReusableWorkflowContent []byte `xorm:"LONGBLOB"` + } + + type ActionRunAttemptJobIDIndex db.ResourceIndex + + if _, err := x.SyncWithOptions(xorm.SyncOptions{IgnoreDropIndices: true}, new(ActionRunJob)); err != nil { + return err + } + return x.Sync(new(ActionRunAttemptJobIDIndex)) +} diff --git a/models/migrations/v1_6/v70.go b/models/migrations/v1_6/v70.go index 41f09669423..947d27d3dd9 100644 --- a/models/migrations/v1_6/v70.go +++ b/models/migrations/v1_6/v70.go @@ -7,12 +7,11 @@ import ( "fmt" "time" - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) -func AddIssueDependencies(x *xorm.Engine) (err error) { +func AddIssueDependencies(x db.EngineMigration) (err error) { type IssueDependency struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"NOT NULL"` diff --git a/models/migrations/v1_6/v71.go b/models/migrations/v1_6/v71.go index b4dcd87ebae..ba2fbb6f179 100644 --- a/models/migrations/v1_6/v71.go +++ b/models/migrations/v1_6/v71.go @@ -6,14 +6,13 @@ package v1_6 import ( "fmt" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" ) -func AddScratchHash(x *xorm.Engine) error { +func AddScratchHash(x db.EngineMigration) error { // TwoFactor see models/twofactor.go type TwoFactor struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_6/v72.go b/models/migrations/v1_6/v72.go index 9fad88a1b61..5aa74402f54 100644 --- a/models/migrations/v1_6/v72.go +++ b/models/migrations/v1_6/v72.go @@ -6,12 +6,11 @@ package v1_6 import ( "fmt" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddReview(x *xorm.Engine) error { +func AddReview(x db.EngineMigration) error { // Review see models/review.go type Review struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_7/v73.go b/models/migrations/v1_7/v73.go index e0b7a285375..6f068cc9d9c 100644 --- a/models/migrations/v1_7/v73.go +++ b/models/migrations/v1_7/v73.go @@ -3,11 +3,9 @@ package v1_7 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddMustChangePassword(x *xorm.Engine) error { +func AddMustChangePassword(x db.EngineMigration) error { // User see models/user.go type User struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_7/v74.go b/models/migrations/v1_7/v74.go index 376be37a246..774602317e2 100644 --- a/models/migrations/v1_7/v74.go +++ b/models/migrations/v1_7/v74.go @@ -3,9 +3,9 @@ package v1_7 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddApprovalWhitelistsToProtectedBranches(x *xorm.Engine) error { +func AddApprovalWhitelistsToProtectedBranches(x db.EngineMigration) error { type ProtectedBranch struct { ApprovalsWhitelistUserIDs []int64 `xorm:"JSON TEXT"` ApprovalsWhitelistTeamIDs []int64 `xorm:"JSON TEXT"` diff --git a/models/migrations/v1_7/v75.go b/models/migrations/v1_7/v75.go index ef115754664..2da93264c30 100644 --- a/models/migrations/v1_7/v75.go +++ b/models/migrations/v1_7/v75.go @@ -4,11 +4,12 @@ package v1_7 import ( + "gitea.dev/models/db" + "xorm.io/builder" - "xorm.io/xorm" ) -func ClearNonusedData(x *xorm.Engine) error { +func ClearNonusedData(x db.EngineMigration) error { condDelete := func(colName string) builder.Cond { return builder.NotIn(colName, builder.Select("id").From("`user`")) } diff --git a/models/migrations/v1_8/v76.go b/models/migrations/v1_8/v76.go index 81e93075497..d2afd23ffe2 100644 --- a/models/migrations/v1_8/v76.go +++ b/models/migrations/v1_8/v76.go @@ -6,12 +6,11 @@ package v1_8 import ( "fmt" - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddPullRequestRebaseWithMerge(x *xorm.Engine) error { +func AddPullRequestRebaseWithMerge(x db.EngineMigration) error { // RepoUnit describes all units of a repository type RepoUnit struct { ID int64 diff --git a/models/migrations/v1_8/v77.go b/models/migrations/v1_8/v77.go index 4fe5ebe6350..8f91891cfe3 100644 --- a/models/migrations/v1_8/v77.go +++ b/models/migrations/v1_8/v77.go @@ -3,11 +3,9 @@ package v1_8 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddUserDefaultTheme(x *xorm.Engine) error { +func AddUserDefaultTheme(x db.EngineMigration) error { type User struct { Theme string `xorm:"VARCHAR(30) NOT NULL DEFAULT ''"` } diff --git a/models/migrations/v1_8/v78.go b/models/migrations/v1_8/v78.go index e67f4641312..b41bbbed7e1 100644 --- a/models/migrations/v1_8/v78.go +++ b/models/migrations/v1_8/v78.go @@ -4,12 +4,11 @@ package v1_8 import ( - "code.gitea.io/gitea/models/migrations/base" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" ) -func RenameRepoIsBareToIsEmpty(x *xorm.Engine) error { +func RenameRepoIsBareToIsEmpty(x db.EngineMigration) error { type Repository struct { ID int64 `xorm:"pk autoincr"` IsBare bool diff --git a/models/migrations/v1_8/v79.go b/models/migrations/v1_8/v79.go index 3f50114d5a5..b29f973c871 100644 --- a/models/migrations/v1_8/v79.go +++ b/models/migrations/v1_8/v79.go @@ -4,12 +4,11 @@ package v1_8 import ( - "code.gitea.io/gitea/modules/setting" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/setting" ) -func AddCanCloseIssuesViaCommitInAnyBranch(x *xorm.Engine) error { +func AddCanCloseIssuesViaCommitInAnyBranch(x db.EngineMigration) error { type Repository struct { ID int64 `xorm:"pk autoincr"` CloseIssuesViaCommitInAnyBranch bool `xorm:"NOT NULL DEFAULT false"` diff --git a/models/migrations/v1_8/v80.go b/models/migrations/v1_8/v80.go index 6f9df47a933..7e8855cb222 100644 --- a/models/migrations/v1_8/v80.go +++ b/models/migrations/v1_8/v80.go @@ -3,9 +3,9 @@ package v1_8 -import "xorm.io/xorm" +import "gitea.dev/models/db" -func AddIsLockedToIssues(x *xorm.Engine) error { +func AddIsLockedToIssues(x db.EngineMigration) error { // Issue see models/issue.go type Issue struct { ID int64 `xorm:"pk autoincr"` diff --git a/models/migrations/v1_8/v81.go b/models/migrations/v1_8/v81.go index 3c2acc64584..406ea973bc2 100644 --- a/models/migrations/v1_8/v81.go +++ b/models/migrations/v1_8/v81.go @@ -6,11 +6,12 @@ package v1_8 import ( "fmt" - "xorm.io/xorm" + "gitea.dev/models/db" + "xorm.io/xorm/schemas" ) -func ChangeU2FCounterType(x *xorm.Engine) error { +func ChangeU2FCounterType(x db.EngineMigration) error { var err error switch x.Dialect().URI().DBType { diff --git a/models/migrations/v1_9/v82.go b/models/migrations/v1_9/v82.go index 8796b0563db..9e8b47e8829 100644 --- a/models/migrations/v1_9/v82.go +++ b/models/migrations/v1_9/v82.go @@ -7,14 +7,13 @@ import ( "context" "fmt" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/gitrepo" - - "xorm.io/xorm" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/git" + "gitea.dev/modules/gitrepo" ) -func FixReleaseSha1OnReleaseTable(ctx context.Context, x *xorm.Engine) error { +func FixReleaseSha1OnReleaseTable(ctx context.Context, x db.EngineMigration) error { type Release struct { ID int64 RepoID int64 diff --git a/models/migrations/v1_9/v83.go b/models/migrations/v1_9/v83.go index a0cd57f7c5f..84da3f5a5c8 100644 --- a/models/migrations/v1_9/v83.go +++ b/models/migrations/v1_9/v83.go @@ -4,12 +4,11 @@ package v1_9 import ( - "code.gitea.io/gitea/modules/timeutil" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" ) -func AddUploaderIDForAttachment(x *xorm.Engine) error { +func AddUploaderIDForAttachment(x db.EngineMigration) error { type Attachment struct { ID int64 `xorm:"pk autoincr"` UUID string `xorm:"uuid UNIQUE"` diff --git a/models/migrations/v1_9/v84.go b/models/migrations/v1_9/v84.go index 423915ae57c..9e7347b3a39 100644 --- a/models/migrations/v1_9/v84.go +++ b/models/migrations/v1_9/v84.go @@ -3,11 +3,9 @@ package v1_9 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddGPGKeyImport(x *xorm.Engine) error { +func AddGPGKeyImport(x db.EngineMigration) error { type GPGKeyImport struct { KeyID string `xorm:"pk CHAR(16) NOT NULL"` Content string `xorm:"TEXT NOT NULL"` diff --git a/models/migrations/v1_9/v85.go b/models/migrations/v1_9/v85.go index 0e95a71f929..6d7c05cb0d6 100644 --- a/models/migrations/v1_9/v85.go +++ b/models/migrations/v1_9/v85.go @@ -6,15 +6,14 @@ package v1_9 import ( "fmt" - "code.gitea.io/gitea/models/migrations/base" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" - - "xorm.io/xorm" + "gitea.dev/models/db" + "gitea.dev/models/migrations/base" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" ) -func HashAppToken(x *xorm.Engine) error { +func HashAppToken(x db.EngineMigration) error { // AccessToken see models/token.go type AccessToken struct { ID int64 `xorm:"pk autoincr"` @@ -98,7 +97,7 @@ func HashAppToken(x *xorm.Engine) error { return resyncHashAppTokenWithUniqueHash(x) } -func resyncHashAppTokenWithUniqueHash(x *xorm.Engine) error { +func resyncHashAppTokenWithUniqueHash(x db.EngineMigration) error { // AccessToken see models/token.go type AccessToken struct { TokenHash string `xorm:"UNIQUE"` // sha256 of token - we will ensure UNIQUE later diff --git a/models/migrations/v1_9/v86.go b/models/migrations/v1_9/v86.go index 9464ff0cf68..08bf2795e03 100644 --- a/models/migrations/v1_9/v86.go +++ b/models/migrations/v1_9/v86.go @@ -3,11 +3,9 @@ package v1_9 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddHTTPMethodToWebhook(x *xorm.Engine) error { +func AddHTTPMethodToWebhook(x db.EngineMigration) error { type Webhook struct { HTTPMethod string `xorm:"http_method DEFAULT 'POST'"` } diff --git a/models/migrations/v1_9/v87.go b/models/migrations/v1_9/v87.go index 81a4ebf80d0..478d5496418 100644 --- a/models/migrations/v1_9/v87.go +++ b/models/migrations/v1_9/v87.go @@ -3,11 +3,9 @@ package v1_9 -import ( - "xorm.io/xorm" -) +import "gitea.dev/models/db" -func AddAvatarFieldToRepository(x *xorm.Engine) error { +func AddAvatarFieldToRepository(x db.EngineMigration) error { type Repository struct { // ID(10-20)-md5(32) - must fit into 64 symbols Avatar string `xorm:"VARCHAR(64)"` diff --git a/models/organization/main_test.go b/models/organization/main_test.go index c35898a465d..f06678cd03d 100644 --- a/models/organization/main_test.go +++ b/models/organization/main_test.go @@ -6,14 +6,14 @@ package organization_test import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" - _ "code.gitea.io/gitea/models" - _ "code.gitea.io/gitea/models/actions" - _ "code.gitea.io/gitea/models/activities" - _ "code.gitea.io/gitea/models/organization" - _ "code.gitea.io/gitea/models/repo" - _ "code.gitea.io/gitea/models/user" + _ "gitea.dev/models" + _ "gitea.dev/models/actions" + _ "gitea.dev/models/activities" + _ "gitea.dev/models/organization" + _ "gitea.dev/models/repo" + _ "gitea.dev/models/user" ) func TestMain(m *testing.M) { diff --git a/models/organization/org.go b/models/organization/org.go index 10a2c330e56..d9390fc147f 100644 --- a/models/organization/org.go +++ b/models/organization/org.go @@ -9,14 +9,14 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/perm" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/models/perm" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/structs" + "gitea.dev/modules/util" "xorm.io/builder" "xorm.io/xorm" @@ -181,17 +181,49 @@ func (org *Organization) HomeLink() string { // FindOrgMembersOpts represents find org members conditions type FindOrgMembersOpts struct { db.ListOptions - Doer *user_model.User - IsDoerMember bool - OrgID int64 + Doer *user_model.User + IsDoerMember bool + OrgID int64 + Keyword string + SearchByEmail bool } func (opts FindOrgMembersOpts) PublicOnly() bool { return opts.Doer == nil || !(opts.IsDoerMember || opts.Doer.IsAdmin) } +func (opts FindOrgMembersOpts) applyKeywordFilter(sess *xorm.Session) (*xorm.Session, bool) { + if opts.Keyword == "" { + return sess, false + } + + lowerKeyword := strings.ToLower(opts.Keyword) + keywordCond := builder.Or( + builder.Like{"`user`.lower_name", lowerKeyword}, + builder.Like{"LOWER(`user`.full_name)", lowerKeyword}, + ) + if opts.SearchByEmail { + var emailCond builder.Cond = builder.Like{"LOWER(`user`.email)", lowerKeyword} + switch { + case opts.Doer == nil: + emailCond = emailCond.And(builder.Eq{"`user`.keep_email_private": false}) + case !opts.Doer.IsAdmin: + emailCond = emailCond.And( + builder.Or( + builder.Eq{"`user`.keep_email_private": false}, + builder.Eq{"`user`.id": opts.Doer.ID}, + ), + ) + } + keywordCond = keywordCond.Or(emailCond) + } + + sess = sess.Join("INNER", "`user`", "org_user.uid = `user`.id").And(keywordCond) + return sess, true +} + // applyTeamMatesOnlyFilter make sure restricted users only see public team members and there own team mates -func (opts FindOrgMembersOpts) applyTeamMatesOnlyFilter(sess *xorm.Session) { +func (opts FindOrgMembersOpts) applyTeamMatesOnlyFilter(sess db.Session) { if opts.Doer != nil && opts.IsDoerMember && opts.Doer.IsRestricted { teamMates := builder.Select("DISTINCT team_user.uid"). From("team_user"). @@ -213,6 +245,7 @@ func CountOrgMembers(ctx context.Context, opts *FindOrgMembersOpts) (int64, erro } else { opts.applyTeamMatesOnlyFilter(sess) } + sess, _ = opts.applyKeywordFilter(sess) return sess.Count(new(OrgUser)) } @@ -461,9 +494,13 @@ func GetOrgUsersByOrgID(ctx context.Context, opts *FindOrgMembersOpts) ([]*OrgUs } else { opts.applyTeamMatesOnlyFilter(sess) } + if keywordSess, hasKeyword := opts.applyKeywordFilter(sess); hasKeyword { + sess = keywordSess.Select("org_user.*") + } + sess = sess.OrderBy("org_user.uid ASC") if opts.ListOptions.PageSize > 0 { - sess = db.SetSessionPagination(sess, opts) + db.SetSessionPagination(sess, opts) ous := make([]*OrgUser, 0, opts.PageSize) return ous, sess.Find(&ous) diff --git a/models/organization/org_list.go b/models/organization/org_list.go index f37961b5f62..73de7db824b 100644 --- a/models/organization/org_list.go +++ b/models/organization/org_list.go @@ -8,10 +8,10 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/perm" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/structs" + "gitea.dev/models/db" + "gitea.dev/models/perm" + user_model "gitea.dev/models/user" + "gitea.dev/modules/structs" "xorm.io/builder" ) @@ -54,6 +54,12 @@ type FindOrgOptions struct { IncludeVisibility structs.VisibleType } +func (opts *FindOrgOptions) ApplyPublicOnly(publicOnly bool) { + if publicOnly { + opts.IncludeVisibility = structs.VisibleTypePublic + } +} + func queryUserOrgIDs(userID int64, includePrivate bool) *builder.Builder { cond := builder.Eq{"uid": userID} if !includePrivate { diff --git a/models/organization/org_list_test.go b/models/organization/org_list_test.go index b2a10444225..a3a8b1e2b05 100644 --- a/models/organization/org_list_test.go +++ b/models/organization/org_list_test.go @@ -6,11 +6,11 @@ package organization_test import ( "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/structs" + "gitea.dev/models/db" + "gitea.dev/models/organization" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/structs" "github.com/stretchr/testify/assert" ) diff --git a/models/organization/org_test.go b/models/organization/org_test.go index 7a74c5f5fcc..8fe4b792976 100644 --- a/models/organization/org_test.go +++ b/models/organization/org_test.go @@ -8,14 +8,14 @@ import ( "sort" "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/test" + "gitea.dev/models/db" + "gitea.dev/models/organization" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/structs" + "gitea.dev/modules/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -288,6 +288,80 @@ func TestGetOrgUsersByOrgID(t *testing.T) { assert.Empty(t, orgUsers) } +func TestOrgMembersSearch(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + + member := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 4}) + admin := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 1}) + + testCases := []struct { + name string + opts *organization.FindOrgMembersOpts + expectedUIDs []int64 + }{ + { + name: "match by username", + opts: &organization.FindOrgMembersOpts{ + OrgID: 3, + Doer: member, + IsDoerMember: true, + Keyword: "user4", + SearchByEmail: true, + }, + expectedUIDs: []int64{4}, + }, + { + name: "match by full name", + opts: &organization.FindOrgMembersOpts{ + OrgID: 3, + Doer: member, + IsDoerMember: true, + Keyword: "user27", + SearchByEmail: true, + }, + expectedUIDs: []int64{28}, + }, + { + name: "private email hidden", + opts: &organization.FindOrgMembersOpts{ + OrgID: 3, + Doer: member, + IsDoerMember: true, + Keyword: "user2@example.com", + SearchByEmail: true, + }, + expectedUIDs: []int64{}, + }, + { + name: "admin can search private email", + opts: &organization.FindOrgMembersOpts{ + OrgID: 3, + Doer: admin, + Keyword: "user2@example.com", + SearchByEmail: true, + }, + expectedUIDs: []int64{2}, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + count, err := organization.CountOrgMembers(t.Context(), tc.opts) + assert.NoError(t, err) + assert.EqualValues(t, len(tc.expectedUIDs), count) + + members, err := organization.GetOrgUsersByOrgID(t.Context(), tc.opts) + assert.NoError(t, err) + memberUIDs := make([]int64, 0, len(members)) + for _, member := range members { + memberUIDs = append(memberUIDs, member.UID) + } + slices.Sort(memberUIDs) + assert.Equal(t, tc.expectedUIDs, memberUIDs) + }) + } +} + func TestChangeOrgUserStatus(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) @@ -456,6 +530,22 @@ func TestGetUsersWhoCanCreateOrgRepo(t *testing.T) { assert.NotNil(t, users[5]) } +func TestCanCreateOrgRepoByOwnerTeamWithoutFlag(t *testing.T) { + assert.NoError(t, unittest.PrepareTestDatabase()) + + org := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 3}) + ownerTeam, err := org.GetOwnerTeam(t.Context()) + require.NoError(t, err) + + ownerTeam.CanCreateOrgRepo = false + _, err = db.GetEngine(t.Context()).ID(ownerTeam.ID).Cols("can_create_org_repo").Update(ownerTeam) + require.NoError(t, err) + + ok, err := organization.CanCreateOrgRepo(t.Context(), org.ID, 2) + require.NoError(t, err) + assert.True(t, ok) +} + func TestUser_RemoveOrgRepo(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) org := unittest.AssertExistsAndLoadBean(t, &organization.Organization{ID: 3}) diff --git a/models/organization/org_user.go b/models/organization/org_user.go index 627c1c2edf0..61102501af2 100644 --- a/models/organization/org_user.go +++ b/models/organization/org_user.go @@ -7,9 +7,10 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/log" + "gitea.dev/models/db" + "gitea.dev/models/perm" + user_model "gitea.dev/models/user" + "gitea.dev/modules/log" "xorm.io/builder" ) @@ -104,7 +105,7 @@ func IsPublicMembership(ctx context.Context, orgID, uid int64) (bool, error) { // CanCreateOrgRepo returns true if user can create repo in organization func CanCreateOrgRepo(ctx context.Context, orgID, uid int64) (bool, error) { return db.GetEngine(ctx). - Where(builder.Eq{"team.can_create_org_repo": true}). + Where(builder.Eq{"team.can_create_org_repo": true}.Or(builder.Eq{"team.authorize": perm.AccessModeOwner})). Join("INNER", "team_user", "team_user.team_id = team.id"). And("team_user.uid = ?", uid). And("team_user.org_id = ?", orgID). diff --git a/models/organization/org_user_test.go b/models/organization/org_user_test.go index d21df4b474c..c16def2dbbd 100644 --- a/models/organization/org_user_test.go +++ b/models/organization/org_user_test.go @@ -7,10 +7,10 @@ import ( "fmt" "testing" - "code.gitea.io/gitea/models/organization" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/organization" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" "github.com/stretchr/testify/assert" ) diff --git a/models/organization/org_worktime.go b/models/organization/org_worktime.go index 3ef3e512adc..f80b741c5df 100644 --- a/models/organization/org_worktime.go +++ b/models/organization/org_worktime.go @@ -7,7 +7,7 @@ import ( "context" "sort" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" "xorm.io/builder" ) diff --git a/models/organization/team.go b/models/organization/team.go index 7f3a9b38295..fd6365e7319 100644 --- a/models/organization/team.go +++ b/models/organization/team.go @@ -9,12 +9,12 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/perm" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/models/perm" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/log" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/organization/team_invite.go b/models/organization/team_invite.go index 186ae5f6e82..409ca7529bf 100644 --- a/models/organization/team_invite.go +++ b/models/organization/team_invite.go @@ -7,10 +7,10 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/organization/team_invite_test.go b/models/organization/team_invite_test.go index e9fabed1db5..200e80e4995 100644 --- a/models/organization/team_invite_test.go +++ b/models/organization/team_invite_test.go @@ -6,9 +6,9 @@ package organization_test import ( "testing" - "code.gitea.io/gitea/models/organization" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + "gitea.dev/models/organization" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" ) diff --git a/models/organization/team_list.go b/models/organization/team_list.go index 5629cec3661..64b084eaaaf 100644 --- a/models/organization/team_list.go +++ b/models/organization/team_list.go @@ -7,9 +7,9 @@ import ( "context" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/perm" - "code.gitea.io/gitea/models/unit" + "gitea.dev/models/db" + "gitea.dev/models/perm" + "gitea.dev/models/unit" "xorm.io/builder" ) @@ -85,7 +85,7 @@ func SearchTeam(ctx context.Context, opts *SearchTeamOptions) (TeamList, int64, if opts.UserID > 0 { sess = sess.Join("INNER", "team_user", "team_user.team_id = team.id") } - sess = db.SetSessionPagination(sess, opts) + db.SetSessionPagination(sess, opts) teams := make([]*Team, 0, opts.PageSize) count, err := sess.Where(cond).OrderBy("CASE WHEN name=? THEN '' ELSE lower_name END", OwnerTeamName).FindAndCount(&teams) diff --git a/models/organization/team_list_test.go b/models/organization/team_list_test.go index df73f958986..553f1f1c91f 100644 --- a/models/organization/team_list_test.go +++ b/models/organization/team_list_test.go @@ -6,8 +6,8 @@ package organization_test import ( "testing" - org_model "code.gitea.io/gitea/models/organization" - "code.gitea.io/gitea/models/unittest" + org_model "gitea.dev/models/organization" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/organization/team_repo.go b/models/organization/team_repo.go index 2652b34c6f7..b4974199796 100644 --- a/models/organization/team_repo.go +++ b/models/organization/team_repo.go @@ -6,9 +6,9 @@ package organization import ( "context" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/perm" - "code.gitea.io/gitea/models/unit" + "gitea.dev/models/db" + "gitea.dev/models/perm" + "gitea.dev/models/unit" "xorm.io/builder" ) diff --git a/models/organization/team_repo_test.go b/models/organization/team_repo_test.go index af959f46585..91d5e6f569a 100644 --- a/models/organization/team_repo_test.go +++ b/models/organization/team_repo_test.go @@ -6,11 +6,11 @@ package organization_test import ( "testing" - "code.gitea.io/gitea/models/organization" - "code.gitea.io/gitea/models/perm" - "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/organization" + "gitea.dev/models/perm" + "gitea.dev/models/repo" + "gitea.dev/models/unit" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/organization/team_test.go b/models/organization/team_test.go index fea5e8990ab..aa1cc90caa3 100644 --- a/models/organization/team_test.go +++ b/models/organization/team_test.go @@ -6,10 +6,10 @@ package organization_test import ( "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/db" + "gitea.dev/models/organization" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/organization/team_unit.go b/models/organization/team_unit.go index b5237c2c587..0741d28ff1f 100644 --- a/models/organization/team_unit.go +++ b/models/organization/team_unit.go @@ -6,9 +6,9 @@ package organization import ( "context" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/perm" - "code.gitea.io/gitea/models/unit" + "gitea.dev/models/db" + "gitea.dev/models/perm" + "gitea.dev/models/unit" ) // TeamUnit describes all units of a repository diff --git a/models/organization/team_user.go b/models/organization/team_user.go index d24a4c51263..069f85c0dc3 100644 --- a/models/organization/team_user.go +++ b/models/organization/team_user.go @@ -6,8 +6,8 @@ package organization import ( "context" - "code.gitea.io/gitea/models/db" - user_model "code.gitea.io/gitea/models/user" + "gitea.dev/models/db" + user_model "gitea.dev/models/user" "xorm.io/builder" ) diff --git a/models/packages/alpine/search.go b/models/packages/alpine/search.go index 77eccb90ed5..c196c6eff6a 100644 --- a/models/packages/alpine/search.go +++ b/models/packages/alpine/search.go @@ -6,8 +6,8 @@ package alpine import ( "context" - packages_model "code.gitea.io/gitea/models/packages" - alpine_module "code.gitea.io/gitea/modules/packages/alpine" + packages_model "gitea.dev/models/packages" + alpine_module "gitea.dev/modules/packages/alpine" ) // GetBranches gets all available branches diff --git a/models/packages/arch/search.go b/models/packages/arch/search.go index f35c037b23a..fd4e8d15638 100644 --- a/models/packages/arch/search.go +++ b/models/packages/arch/search.go @@ -6,8 +6,8 @@ package arch import ( "context" - packages_model "code.gitea.io/gitea/models/packages" - arch_module "code.gitea.io/gitea/modules/packages/arch" + packages_model "gitea.dev/models/packages" + arch_module "gitea.dev/modules/packages/arch" ) // GetRepositories gets all available repositories diff --git a/models/packages/conan/references.go b/models/packages/conan/references.go index 0d888a1ec88..0a040bdb3f8 100644 --- a/models/packages/conan/references.go +++ b/models/packages/conan/references.go @@ -8,11 +8,11 @@ import ( "strconv" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/packages" - conan_module "code.gitea.io/gitea/modules/packages/conan" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/models/packages" + conan_module "gitea.dev/modules/packages/conan" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/packages/conan/search.go b/models/packages/conan/search.go index ab0bff59689..b40d0537b81 100644 --- a/models/packages/conan/search.go +++ b/models/packages/conan/search.go @@ -9,10 +9,10 @@ import ( "strconv" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/packages" - "code.gitea.io/gitea/modules/container" - conan_module "code.gitea.io/gitea/modules/packages/conan" + "gitea.dev/models/db" + "gitea.dev/models/packages" + "gitea.dev/modules/container" + conan_module "gitea.dev/modules/packages/conan" "xorm.io/builder" ) diff --git a/models/packages/conda/search.go b/models/packages/conda/search.go index 887441e3b2b..5b4973fa749 100644 --- a/models/packages/conda/search.go +++ b/models/packages/conda/search.go @@ -7,9 +7,9 @@ import ( "context" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/packages" - conda_module "code.gitea.io/gitea/modules/packages/conda" + "gitea.dev/models/db" + "gitea.dev/models/packages" + conda_module "gitea.dev/modules/packages/conda" "xorm.io/builder" ) diff --git a/models/packages/container/search.go b/models/packages/container/search.go index 9321d9eb410..df9a2d5537b 100644 --- a/models/packages/container/search.go +++ b/models/packages/container/search.go @@ -8,11 +8,11 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/packages" - user_model "code.gitea.io/gitea/models/user" - container_module "code.gitea.io/gitea/modules/packages/container" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/models/packages" + user_model "gitea.dev/models/user" + container_module "gitea.dev/modules/packages/container" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -223,7 +223,7 @@ func SearchImageTags(ctx context.Context, opts *ImageTagsSearchOptions) ([]*pack opts.configureOrderBy(sess) if opts.Paginator != nil { - sess = db.SetSessionPagination(sess, opts) + db.SetSessionPagination(sess, opts) } pvs := make([]*packages.PackageVersion, 0, 10) diff --git a/models/packages/cran/search.go b/models/packages/cran/search.go index 8a8b52a35ec..0ff1c31edef 100644 --- a/models/packages/cran/search.go +++ b/models/packages/cran/search.go @@ -8,9 +8,9 @@ import ( "strconv" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/packages" - cran_module "code.gitea.io/gitea/modules/packages/cran" + "gitea.dev/models/db" + "gitea.dev/models/packages" + cran_module "gitea.dev/modules/packages/cran" "xorm.io/builder" ) diff --git a/models/packages/debian/search.go b/models/packages/debian/search.go index 5333d0c6e48..165e8b8a02e 100644 --- a/models/packages/debian/search.go +++ b/models/packages/debian/search.go @@ -7,9 +7,9 @@ import ( "context" "strconv" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/packages" - debian_module "code.gitea.io/gitea/modules/packages/debian" + "gitea.dev/models/db" + "gitea.dev/models/packages" + debian_module "gitea.dev/modules/packages/debian" "xorm.io/builder" ) diff --git a/models/packages/descriptor.go b/models/packages/descriptor.go index 2ef27051eea..b5b8634846c 100644 --- a/models/packages/descriptor.go +++ b/models/packages/descriptor.go @@ -9,32 +9,32 @@ import ( "fmt" "net/url" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/cache" - "code.gitea.io/gitea/modules/json" - "code.gitea.io/gitea/modules/packages/alpine" - "code.gitea.io/gitea/modules/packages/arch" - "code.gitea.io/gitea/modules/packages/cargo" - "code.gitea.io/gitea/modules/packages/chef" - "code.gitea.io/gitea/modules/packages/composer" - "code.gitea.io/gitea/modules/packages/conan" - "code.gitea.io/gitea/modules/packages/conda" - "code.gitea.io/gitea/modules/packages/container" - "code.gitea.io/gitea/modules/packages/cran" - "code.gitea.io/gitea/modules/packages/debian" - "code.gitea.io/gitea/modules/packages/helm" - "code.gitea.io/gitea/modules/packages/maven" - "code.gitea.io/gitea/modules/packages/npm" - "code.gitea.io/gitea/modules/packages/nuget" - "code.gitea.io/gitea/modules/packages/pub" - "code.gitea.io/gitea/modules/packages/pypi" - "code.gitea.io/gitea/modules/packages/rpm" - "code.gitea.io/gitea/modules/packages/rubygems" - "code.gitea.io/gitea/modules/packages/swift" - "code.gitea.io/gitea/modules/packages/vagrant" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/cache" + "gitea.dev/modules/json" + "gitea.dev/modules/packages/alpine" + "gitea.dev/modules/packages/arch" + "gitea.dev/modules/packages/cargo" + "gitea.dev/modules/packages/chef" + "gitea.dev/modules/packages/composer" + "gitea.dev/modules/packages/conan" + "gitea.dev/modules/packages/conda" + "gitea.dev/modules/packages/container" + "gitea.dev/modules/packages/cran" + "gitea.dev/modules/packages/debian" + "gitea.dev/modules/packages/helm" + "gitea.dev/modules/packages/maven" + "gitea.dev/modules/packages/npm" + "gitea.dev/modules/packages/nuget" + "gitea.dev/modules/packages/pub" + "gitea.dev/modules/packages/pypi" + "gitea.dev/modules/packages/rpm" + "gitea.dev/modules/packages/rubygems" + "gitea.dev/modules/packages/swift" + "gitea.dev/modules/packages/vagrant" + "gitea.dev/modules/util" "github.com/hashicorp/go-version" ) diff --git a/models/packages/nuget/search.go b/models/packages/nuget/search.go index a4b23f31d55..1ec0cece682 100644 --- a/models/packages/nuget/search.go +++ b/models/packages/nuget/search.go @@ -7,8 +7,8 @@ import ( "context" "strings" - "code.gitea.io/gitea/models/db" - packages_model "code.gitea.io/gitea/models/packages" + "gitea.dev/models/db" + packages_model "gitea.dev/models/packages" "xorm.io/builder" ) diff --git a/models/packages/package.go b/models/packages/package.go index 17e5d4eee35..c4cfcdd39c9 100644 --- a/models/packages/package.go +++ b/models/packages/package.go @@ -8,8 +8,8 @@ import ( "fmt" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/packages/package_blob.go b/models/packages/package_blob.go index e765bbf0c21..db3288a4be3 100644 --- a/models/packages/package_blob.go +++ b/models/packages/package_blob.go @@ -8,13 +8,13 @@ import ( "strconv" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/perm" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/structs" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/models/perm" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/structs" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/packages/package_blob_test.go b/models/packages/package_blob_test.go index 8b636b4ee00..b73328d26b2 100644 --- a/models/packages/package_blob_test.go +++ b/models/packages/package_blob_test.go @@ -6,7 +6,7 @@ package packages import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/packages/package_blob_upload.go b/models/packages/package_blob_upload.go index 60a55805a8b..07afd0591b0 100644 --- a/models/packages/package_blob_upload.go +++ b/models/packages/package_blob_upload.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" ) // ErrPackageBlobUploadNotExist indicates a package blob upload not exist error diff --git a/models/packages/package_cleanup_rule.go b/models/packages/package_cleanup_rule.go index fa12dec4060..6aca8060511 100644 --- a/models/packages/package_cleanup_rule.go +++ b/models/packages/package_cleanup_rule.go @@ -8,9 +8,9 @@ import ( "fmt" "regexp" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/packages/package_file.go b/models/packages/package_file.go index 64bd08f0b21..d4e6e82d056 100644 --- a/models/packages/package_file.go +++ b/models/packages/package_file.go @@ -9,9 +9,9 @@ import ( "strings" "time" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) @@ -232,7 +232,7 @@ func SearchFiles(ctx context.Context, opts *PackageFileSearchOptions) ([]*Packag Where(opts.toConds()) if opts.Paginator != nil { - sess = db.SetSessionPagination(sess, opts) + db.SetSessionPagination(sess, opts) } pfs := make([]*PackageFile, 0, 10) diff --git a/models/packages/package_property.go b/models/packages/package_property.go index 30794ad73c3..52815a9e431 100644 --- a/models/packages/package_property.go +++ b/models/packages/package_property.go @@ -7,7 +7,7 @@ import ( "context" "errors" - "code.gitea.io/gitea/models/db" + "gitea.dev/models/db" "xorm.io/builder" ) diff --git a/models/packages/package_test.go b/models/packages/package_test.go index 9c71f2980d1..f6eb5b1184c 100644 --- a/models/packages/package_test.go +++ b/models/packages/package_test.go @@ -6,13 +6,13 @@ package packages_test import ( "testing" - packages_model "code.gitea.io/gitea/models/packages" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + packages_model "gitea.dev/models/packages" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" - _ "code.gitea.io/gitea/models" - _ "code.gitea.io/gitea/models/actions" - _ "code.gitea.io/gitea/models/activities" + _ "gitea.dev/models" + _ "gitea.dev/models/actions" + _ "gitea.dev/models/activities" "github.com/stretchr/testify/assert" ) diff --git a/models/packages/package_version.go b/models/packages/package_version.go index 3e0e1899ea4..77b1da43de7 100644 --- a/models/packages/package_version.go +++ b/models/packages/package_version.go @@ -8,13 +8,12 @@ import ( "strconv" "strings" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/optional" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" - "xorm.io/xorm" ) // ErrDuplicatePackageVersion indicates a duplicated package version error @@ -297,11 +296,11 @@ func (opts *PackageSearchOptions) configureOrderBy(e db.Engine) { e.Desc("package_version.id") // Sort by id for stable order with duplicates in the other field } -func searchVersionsBySession(sess *xorm.Session, opts *PackageSearchOptions) ([]*PackageVersion, int64, error) { +func searchVersionsBySession(sess db.Session, opts *PackageSearchOptions) ([]*PackageVersion, int64, error) { opts.configureOrderBy(sess) pvs := make([]*PackageVersion, 0, 10) if opts.Paginator != nil { - sess = db.SetSessionPagination(sess, opts.Paginator) + db.SetSessionPagination(sess, opts.Paginator) count, err := sess.FindAndCount(&pvs) return pvs, count, err } diff --git a/models/packages/rpm/search.go b/models/packages/rpm/search.go index e697421b494..3c37443ead9 100644 --- a/models/packages/rpm/search.go +++ b/models/packages/rpm/search.go @@ -6,8 +6,8 @@ package rpm import ( "context" - packages_model "code.gitea.io/gitea/models/packages" - rpm_module "code.gitea.io/gitea/modules/packages/rpm" + packages_model "gitea.dev/models/packages" + rpm_module "gitea.dev/modules/packages/rpm" ) // GetGroups gets all available groups diff --git a/models/perm/access/access.go b/models/perm/access/access.go index acc34c434ea..53d14fca1b5 100644 --- a/models/perm/access/access.go +++ b/models/perm/access/access.go @@ -8,13 +8,13 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - "code.gitea.io/gitea/models/perm" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/structs" + "gitea.dev/models/db" + "gitea.dev/models/organization" + "gitea.dev/models/perm" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" + "gitea.dev/modules/structs" "xorm.io/builder" ) diff --git a/models/perm/access/access_test.go b/models/perm/access/access_test.go index 148a02efa33..eb2c58caf5f 100644 --- a/models/perm/access/access_test.go +++ b/models/perm/access/access_test.go @@ -6,13 +6,13 @@ package access_test import ( "testing" - "code.gitea.io/gitea/models/db" - perm_model "code.gitea.io/gitea/models/perm" - access_model "code.gitea.io/gitea/models/perm/access" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/setting" + "gitea.dev/models/db" + perm_model "gitea.dev/models/perm" + access_model "gitea.dev/models/perm/access" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" + "gitea.dev/modules/setting" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/perm/access/actions_repo_permission_test.go b/models/perm/access/actions_repo_permission_test.go index 442f6cf2fc2..aee097cf93e 100644 --- a/models/perm/access/actions_repo_permission_test.go +++ b/models/perm/access/actions_repo_permission_test.go @@ -6,13 +6,13 @@ package access import ( "testing" - actions_model "code.gitea.io/gitea/models/actions" - "code.gitea.io/gitea/models/db" - perm_model "code.gitea.io/gitea/models/perm" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + actions_model "gitea.dev/models/actions" + "gitea.dev/models/db" + perm_model "gitea.dev/models/perm" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/perm/access/main_test.go b/models/perm/access/main_test.go index 0a350dc41ea..e4804124e8a 100644 --- a/models/perm/access/main_test.go +++ b/models/perm/access/main_test.go @@ -6,13 +6,13 @@ package access_test import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" - _ "code.gitea.io/gitea/models" - _ "code.gitea.io/gitea/models/actions" - _ "code.gitea.io/gitea/models/activities" - _ "code.gitea.io/gitea/models/repo" - _ "code.gitea.io/gitea/models/user" + _ "gitea.dev/models" + _ "gitea.dev/models/actions" + _ "gitea.dev/models/activities" + _ "gitea.dev/models/repo" + _ "gitea.dev/models/user" ) func TestMain(m *testing.M) { diff --git a/models/perm/access/repo_permission.go b/models/perm/access/repo_permission.go index 21821f17466..6e52177f0a6 100644 --- a/models/perm/access/repo_permission.go +++ b/models/perm/access/repo_permission.go @@ -11,17 +11,17 @@ import ( "slices" "strings" - actions_model "code.gitea.io/gitea/models/actions" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - perm_model "code.gitea.io/gitea/models/perm" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/container" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/util" + actions_model "gitea.dev/models/actions" + "gitea.dev/models/db" + "gitea.dev/models/organization" + perm_model "gitea.dev/models/perm" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + user_model "gitea.dev/models/user" + "gitea.dev/modules/container" + "gitea.dev/modules/log" + "gitea.dev/modules/setting" + "gitea.dev/modules/util" ) // Permission contains all the permissions related variables to a repository for a user @@ -655,3 +655,37 @@ func CheckRepoUnitUser(ctx context.Context, repo *repo_model.Repository, user *u func PermissionNoAccess() Permission { return Permission{AccessMode: perm_model.AccessModeNone} } + +// CanReadWorkflowCrossRepo checks whether the run can read workflow files from targetRepo. +func CanReadWorkflowCrossRepo(ctx context.Context, targetRepo *repo_model.Repository, run *actions_model.ActionRun) (bool, error) { + if err := run.LoadRepo(ctx); err != nil { + return false, err + } + + // (1) Same owner: always allowed (fork-PR scrubbing handled inside). + if checkSameOwnerCrossRepoAccess(ctx, run.Repo, targetRepo, run.IsForkPullRequest) { + return true, nil + } + + // (2) Cross-owner: respect the target repo's collaborative-owner allowlist on its Actions unit. + // The caller (run.Repo) must itself be private. The collaborative-owner grant is owner-level, so without this + // guard a public caller owned by a grantee could pull a private reusable workflow and expose its definition and + // logs in a publicly visible run; requiring a private caller keeps private content flowing private -> private. + // This is intentionally stricter than GitHub, which gates on the target repo's access setting (introduced in #32562): + // https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-a-private-repository + if run.Repo.IsPrivate { + if actionsUnit, err := targetRepo.GetUnit(ctx, unit.TypeActions); err == nil { + if actionsUnit.ActionsConfig().IsCollaborativeOwner(run.Repo.OwnerID) { + return true, nil + } + } + } + + // (3) Public target: the Actions user's individual permission gives read on any public repo, so `uses:` to a public reusable-workflow library is permitted by default. + // Matches GitHub's behavior: public reusable workflows are universally readable. + botPerm, err := GetIndividualUserRepoPermission(ctx, targetRepo, user_model.NewActionsUser()) + if err != nil { + return false, err + } + return botPerm.AccessMode >= perm_model.AccessModeRead, nil +} diff --git a/models/perm/access/repo_permission_test.go b/models/perm/access/repo_permission_test.go index 29a8dac71d4..b5c82afb297 100644 --- a/models/perm/access/repo_permission_test.go +++ b/models/perm/access/repo_permission_test.go @@ -6,14 +6,14 @@ package access import ( "testing" - actions_model "code.gitea.io/gitea/models/actions" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/organization" - perm_model "code.gitea.io/gitea/models/perm" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unit" - "code.gitea.io/gitea/models/unittest" - user_model "code.gitea.io/gitea/models/user" + actions_model "gitea.dev/models/actions" + "gitea.dev/models/db" + "gitea.dev/models/organization" + perm_model "gitea.dev/models/perm" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unit" + "gitea.dev/models/unittest" + user_model "gitea.dev/models/user" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/models/perm/access_mode.go b/models/perm/access_mode.go index 6baeb5531a5..3be195b48d4 100644 --- a/models/perm/access_mode.go +++ b/models/perm/access_mode.go @@ -7,7 +7,7 @@ import ( "fmt" "slices" - "code.gitea.io/gitea/modules/util" + "gitea.dev/modules/util" ) // AccessMode specifies the users access mode diff --git a/models/project/column.go b/models/project/column.go index 9c9abb4599d..06b59897f84 100644 --- a/models/project/column.go +++ b/models/project/column.go @@ -9,10 +9,10 @@ import ( "fmt" "regexp" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/project/column_test.go b/models/project/column_test.go index 6437a764ed3..ef6016a50d6 100644 --- a/models/project/column_test.go +++ b/models/project/column_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" "github.com/stretchr/testify/assert" ) diff --git a/models/project/issue.go b/models/project/issue.go index c89f5243054..cf1619a7738 100644 --- a/models/project/issue.go +++ b/models/project/issue.go @@ -7,8 +7,8 @@ import ( "context" "errors" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + "gitea.dev/modules/util" ) // ProjectIssue saves relation from issue to a project diff --git a/models/project/main_test.go b/models/project/main_test.go index f4b2d6fedac..f52242c98af 100644 --- a/models/project/main_test.go +++ b/models/project/main_test.go @@ -6,9 +6,9 @@ package project import ( "testing" - "code.gitea.io/gitea/models/unittest" + "gitea.dev/models/unittest" - _ "code.gitea.io/gitea/models/repo" + _ "gitea.dev/models/repo" ) func TestMain(m *testing.M) { diff --git a/models/project/project.go b/models/project/project.go index 7fcef430f26..546409c5d5c 100644 --- a/models/project/project.go +++ b/models/project/project.go @@ -8,14 +8,14 @@ import ( "fmt" "html/template" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/optional" - "code.gitea.io/gitea/modules/setting" - "code.gitea.io/gitea/modules/timeutil" - "code.gitea.io/gitea/modules/util" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/log" + "gitea.dev/modules/optional" + "gitea.dev/modules/setting" + "gitea.dev/modules/timeutil" + "gitea.dev/modules/util" "xorm.io/builder" ) diff --git a/models/project/project_test.go b/models/project/project_test.go index 4b24615979b..b28bca92565 100644 --- a/models/project/project_test.go +++ b/models/project/project_test.go @@ -6,9 +6,9 @@ package project import ( "testing" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/models/unittest" + "gitea.dev/modules/timeutil" "github.com/stretchr/testify/assert" ) diff --git a/models/pull/automerge.go b/models/pull/automerge.go index d32dc847d2d..5415009fdea 100644 --- a/models/pull/automerge.go +++ b/models/pull/automerge.go @@ -7,10 +7,10 @@ import ( "context" "fmt" - "code.gitea.io/gitea/models/db" - repo_model "code.gitea.io/gitea/models/repo" - user_model "code.gitea.io/gitea/models/user" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + repo_model "gitea.dev/models/repo" + user_model "gitea.dev/models/user" + "gitea.dev/modules/timeutil" ) // AutoMerge represents a pull request scheduled for merging when checks succeed diff --git a/models/pull/review_state.go b/models/pull/review_state.go index a0f5548dd44..241a79d1dfb 100644 --- a/models/pull/review_state.go +++ b/models/pull/review_state.go @@ -8,9 +8,9 @@ import ( "fmt" "maps" - "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/modules/log" - "code.gitea.io/gitea/modules/timeutil" + "gitea.dev/models/db" + "gitea.dev/modules/log" + "gitea.dev/modules/timeutil" ) // ViewedState stores for a file in which state it is currently viewed diff --git a/models/renderhelper/commit_checker.go b/models/renderhelper/commit_checker.go index 407e45fb543..faf2d94eb0a 100644 --- a/models/renderhelper/commit_checker.go +++ b/models/renderhelper/commit_checker.go @@ -7,9 +7,9 @@ import ( "context" "io" - "code.gitea.io/gitea/modules/git" - "code.gitea.io/gitea/modules/gitrepo" - "code.gitea.io/gitea/modules/log" + "gitea.dev/modules/git" + "gitea.dev/modules/gitrepo" + "gitea.dev/modules/log" ) type commitChecker struct { diff --git a/models/renderhelper/main_test.go b/models/renderhelper/main_test.go index 331450172a6..ebca1132199 100644 --- a/models/renderhelper/main_test.go +++ b/models/renderhelper/main_test.go @@ -5,12 +5,19 @@ package renderhelper import ( "context" + "strings" "testing" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/markup" + "gitea.dev/models/unittest" + "gitea.dev/modules/markup" ) +func testRenderString(ctx *markup.RenderContext, content string) (string, error) { + var buf strings.Builder + err := markup.Render(ctx, strings.NewReader(content), &buf) + return buf.String(), err +} + func TestMain(m *testing.M) { unittest.MainTest(m, &unittest.TestOptions{ FixtureFiles: []string{"repository.yml", "user.yml"}, diff --git a/models/renderhelper/repo_comment.go b/models/renderhelper/repo_comment.go index d1c587671b7..16e130a776b 100644 --- a/models/renderhelper/repo_comment.go +++ b/models/renderhelper/repo_comment.go @@ -7,9 +7,9 @@ import ( "context" "fmt" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/markup" - "code.gitea.io/gitea/modules/util" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/markup" + "gitea.dev/modules/util" ) type RepoComment struct { diff --git a/models/renderhelper/repo_comment_test.go b/models/renderhelper/repo_comment_test.go index 1443f8b3c02..03b3fcfae6d 100644 --- a/models/renderhelper/repo_comment_test.go +++ b/models/renderhelper/repo_comment_test.go @@ -6,10 +6,9 @@ package renderhelper import ( "testing" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/markup" - "code.gitea.io/gitea/modules/markup/markdown" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + "gitea.dev/modules/markup/markdown" "github.com/stretchr/testify/assert" ) @@ -21,7 +20,7 @@ func TestRepoComment(t *testing.T) { t.Run("AutoLink", func(t *testing.T) { rctx := NewRenderContextRepoComment(t.Context(), repo1).WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` 65f1bf27bc3bf70f64657658635e66094edbcb4d #1 @user2 @@ -39,7 +38,7 @@ func TestRepoComment(t *testing.T) { // It is Gitea's old behavior, the relative path is resolved to the repo path // It is different from GitHub, GitHub resolves relative links to current page's path - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` [/test](/test) [./test](./test) ![/image](/image) @@ -59,7 +58,7 @@ func TestRepoComment(t *testing.T) { WithMarkupType(markdown.MarkupName) // the ref path is only used to render commit message: a commit message is rendered at the commit page with its commit ID path - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` [/test](/test) [./test](./test) ![/image](/image) @@ -75,7 +74,7 @@ func TestRepoComment(t *testing.T) { t.Run("NoRepo", func(t *testing.T) { rctx := NewRenderContextRepoComment(t.Context(), nil).WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, "any") + rendered, err := testRenderString(rctx, "any") assert.NoError(t, err) assert.Equal(t, "

any

\n", rendered) }) diff --git a/models/renderhelper/repo_file.go b/models/renderhelper/repo_file.go index d9aa71b7270..0251de8da32 100644 --- a/models/renderhelper/repo_file.go +++ b/models/renderhelper/repo_file.go @@ -8,9 +8,9 @@ import ( "fmt" "path" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/modules/markup" - "code.gitea.io/gitea/modules/util" + repo_model "gitea.dev/models/repo" + "gitea.dev/modules/markup" + "gitea.dev/modules/util" ) type RepoFile struct { diff --git a/models/renderhelper/repo_file_test.go b/models/renderhelper/repo_file_test.go index 72d98efc66e..bb95501bec4 100644 --- a/models/renderhelper/repo_file_test.go +++ b/models/renderhelper/repo_file_test.go @@ -6,12 +6,11 @@ package renderhelper import ( "testing" - repo_model "code.gitea.io/gitea/models/repo" - "code.gitea.io/gitea/models/unittest" - "code.gitea.io/gitea/modules/markup" - "code.gitea.io/gitea/modules/markup/markdown" + repo_model "gitea.dev/models/repo" + "gitea.dev/models/unittest" + "gitea.dev/modules/markup/markdown" - _ "code.gitea.io/gitea/modules/markup/orgmode" + _ "gitea.dev/modules/markup/orgmode" "github.com/stretchr/testify/assert" ) @@ -22,7 +21,7 @@ func TestRepoFile(t *testing.T) { t.Run("AutoLink", func(t *testing.T) { rctx := NewRenderContextRepoFile(t.Context(), repo1).WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` 65f1bf27bc3bf70f64657658635e66094edbcb4d #1 @user2 @@ -38,7 +37,7 @@ func TestRepoFile(t *testing.T) { t.Run("AbsoluteAndRelative", func(t *testing.T) { rctx := NewRenderContextRepoFile(t.Context(), repo1, RepoFileOptions{CurrentRefSubURL: "branch/main"}). WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` [/test](/test) [./test](./test) ![/image](/image) @@ -56,7 +55,7 @@ func TestRepoFile(t *testing.T) { t.Run("WithCurrentRefSubURL", func(t *testing.T) { rctx := NewRenderContextRepoFile(t.Context(), repo1, RepoFileOptions{CurrentRefSubURL: "/commit/1234"}). WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, ` [/test](/test) ![/image](/image) `) @@ -72,7 +71,7 @@ func TestRepoFile(t *testing.T) { CurrentTreePath: "my-dir", }). WithMarkupType(markdown.MarkupName) - rendered, err := markup.RenderString(rctx, ` + rendered, err := testRenderString(rctx, `