diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 799cc97577..9adff6198a 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -24,6 +24,13 @@ jobs: name: Lint runs-on: linux-latest steps: + - name: Get latest vault version + id: vault + run: | + VERSION=$(curl -sf "https://direct.git.marketally.com/api/v1/repos/gitcaddy/gitcaddy-vault/releases/latest" | grep -o '"tag_name":"[^"]*"' | cut -d'"' -f4) + echo "version=$VERSION" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + - name: Checkout code uses: actions/checkout@v4 @@ -33,6 +40,14 @@ jobs: go-version: ${{ env.GO_VERSION }} cache: false + - name: Update vault dependency + run: | + VAULT_VERSION="${{ steps.vault.outputs.version }}" + echo "Building with vault $VAULT_VERSION" + sed -i "s|replace git.marketally.com/gitcaddy/vault => ../gitcaddy-vault|replace git.marketally.com/gitcaddy/vault => git.marketally.com/gitcaddy/vault $VAULT_VERSION|" go.mod + cat go.mod | grep -A2 "gitcaddy/vault" + go mod tidy + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -56,6 +71,12 @@ jobs: name: Unit Tests runs-on: linux-latest steps: + - name: Get latest vault version + id: vault + run: | + VERSION=$(curl -sf "https://direct.git.marketally.com/api/v1/repos/gitcaddy/gitcaddy-vault/releases/latest" | grep -o '"tag_name":"[^"]*"' | cut -d'"' -f4) + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + - name: Checkout code uses: actions/checkout@v4 @@ -65,6 +86,12 @@ jobs: go-version: ${{ env.GO_VERSION }} cache: false + - name: Update vault dependency + run: | + VAULT_VERSION="${{ steps.vault.outputs.version }}" + sed -i "s|replace git.marketally.com/gitcaddy/vault => ../gitcaddy-vault|replace git.marketally.com/gitcaddy/vault => git.marketally.com/gitcaddy/vault $VAULT_VERSION|" go.mod + go mod tidy + - name: Install dependencies run: go mod download @@ -97,6 +124,12 @@ jobs: ports: - 5432:5432 steps: + - name: Get latest vault version + id: vault + run: | + VERSION=$(curl -sf "https://direct.git.marketally.com/api/v1/repos/gitcaddy/gitcaddy-vault/releases/latest" | grep -o '"tag_name":"[^"]*"' | cut -d'"' -f4) + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + - name: Checkout code uses: actions/checkout@v4 @@ -106,6 +139,12 @@ jobs: go-version: ${{ env.GO_VERSION }} cache: false + - name: Update vault dependency + run: | + VAULT_VERSION="${{ steps.vault.outputs.version }}" + sed -i "s|replace git.marketally.com/gitcaddy/vault => ../gitcaddy-vault|replace git.marketally.com/gitcaddy/vault => git.marketally.com/gitcaddy/vault $VAULT_VERSION|" go.mod + go mod tidy + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -216,6 +255,24 @@ jobs: goarch: amd64 runs-on: windows-latest steps: + - name: Get latest vault version (Unix) + if: matrix.goos != 'windows' + id: vault + run: | + VERSION=$(curl -sf "https://direct.git.marketally.com/api/v1/repos/gitcaddy/gitcaddy-vault/releases/latest" | grep -o '"tag_name":"[^"]*"' | cut -d'"' -f4) + echo "version=$VERSION" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Get latest vault version (Windows) + if: matrix.goos == 'windows' + id: vault-win + shell: pwsh + run: | + $response = Invoke-RestMethod -Uri "https://direct.git.marketally.com/api/v1/repos/gitcaddy/gitcaddy-vault/releases/latest" + $version = $response.tag_name + Write-Host "version=$version" + "version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append + - name: Checkout code uses: actions/checkout@v4 with: @@ -227,6 +284,27 @@ jobs: go-version: ${{ env.GO_VERSION }} cache: false + - name: Update vault dependency (Unix) + if: matrix.goos != 'windows' + run: | + VAULT_VERSION="${{ steps.vault.outputs.version }}" + echo "Building with vault $VAULT_VERSION" + sed -i "s|replace git.marketally.com/gitcaddy/vault => ../gitcaddy-vault|replace git.marketally.com/gitcaddy/vault => git.marketally.com/gitcaddy/vault $VAULT_VERSION|" go.mod + cat go.mod | grep -A2 "gitcaddy/vault" + go mod tidy + + - name: Update vault dependency (Windows) + if: matrix.goos == 'windows' + shell: pwsh + run: | + $vaultVersion = "${{ steps.vault-win.outputs.version }}" + Write-Host "Building with vault $vaultVersion" + $content = Get-Content go.mod -Raw + $content = $content -replace 'replace git.marketally.com/gitcaddy/vault => ../gitcaddy-vault', "replace git.marketally.com/gitcaddy/vault => git.marketally.com/gitcaddy/vault $vaultVersion" + Set-Content go.mod $content -NoNewline + Get-Content go.mod | Select-String "gitcaddy/vault" -Context 0,2 + go mod tidy + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -438,6 +516,13 @@ jobs: apt-get update apt-get install -y build-essential curl ca-certificates + - name: Get latest vault version + id: vault + run: | + VERSION=$(curl -sf "https://direct.git.marketally.com/api/v1/repos/gitcaddy/gitcaddy-vault/releases/latest" | grep -o '"tag_name":"[^"]*"' | cut -d'"' -f4) + echo "version=$VERSION" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + - name: Install Go run: | curl -fsSL "https://go.dev/dl/go${{ env.GO_VERSION }}.linux-arm64.tar.gz" -o go.tar.gz @@ -450,6 +535,14 @@ jobs: with: fetch-depth: 0 + - name: Update vault dependency + run: | + VAULT_VERSION="${{ steps.vault.outputs.version }}" + echo "Building with vault $VAULT_VERSION" + sed -i "s|replace git.marketally.com/gitcaddy/vault => ../gitcaddy-vault|replace git.marketally.com/gitcaddy/vault => git.marketally.com/gitcaddy/vault $VAULT_VERSION|" go.mod + cat go.mod | grep -A2 "gitcaddy/vault" + /usr/local/go/bin/go mod tidy + - name: Install pnpm run: npm install -g pnpm diff --git a/go.mod b/go.mod index a7532e68c5..72a84d691e 100644 --- a/go.mod +++ b/go.mod @@ -14,6 +14,9 @@ require ( code.gitea.io/sdk/gitea v0.22.0 codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570 connectrpc.com/connect v1.18.1 + + // GitCaddy Vault plugin (compiled-in) + git.marketally.com/gitcaddy/vault v1.0.17 gitea.com/go-chi/binding v0.0.0-20240430071103-39a851e106ed gitea.com/go-chi/cache v0.2.1 gitea.com/go-chi/captcha v0.0.0-20240315150714-fb487f629098 @@ -316,6 +319,9 @@ replace git.sr.ht/~mariusor/go-xsd-duration => gitea.com/gitea/go-xsd-duration v // Use GitCaddy fork with capability support replace code.gitea.io/actions-proto-go => git.marketally.com/gitcaddy/actions-proto-go v0.5.8 +// Vault plugin - use local directory for development +replace git.marketally.com/gitcaddy/vault => ../gitcaddy-vault + exclude github.com/gofrs/uuid v3.2.0+incompatible exclude github.com/gofrs/uuid v4.0.0+incompatible diff --git a/go.sum b/go.sum index b1f11de173..019869da78 100644 --- a/go.sum +++ b/go.sum @@ -620,8 +620,9 @@ github.com/niklasfasching/go-org v1.9.1/go.mod h1:ZAGFFkWvUQcpazmi/8nHqwvARpr1xp github.com/nwaples/rardecode/v2 v2.2.0 h1:4ufPGHiNe1rYJxYfehALLjup4Ls3ck42CWwjKiOqu0A= github.com/nwaples/rardecode/v2 v2.2.0/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw= 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/nxadm/tail v1.4.11 h1:8feyoE3OzPrcshW5/MJ4sGESc5cqmGkGCWlco4l0bqY= +github.com/nxadm/tail v1.4.11/go.mod h1:OTaG3NK980DZzxbRq6lEuzgU+mug70nY11sMd4JXXHc= github.com/olekukonko/cat v0.0.0-20250817074551-3280053e4e00 h1:ZCnkxe9GgWqqBxAk3cIKlQJuaqgOUF/nUtQs8flVTHM= github.com/olekukonko/cat v0.0.0-20250817074551-3280053e4e00/go.mod h1:rEKTHC9roVVicUIfZK7DYrdIoM0EOr8mK1Hj5s3JjH0= github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM= diff --git a/routers/init.go b/routers/init.go index 80a9cbdf17..111048992c 100644 --- a/routers/init.go +++ b/routers/init.go @@ -9,6 +9,9 @@ import ( "reflect" "runtime" + // Compiled-in plugins (auto-register via init()) + _ "git.marketally.com/gitcaddy/vault" + "code.gitcaddy.com/server/v3/models" ai_model "code.gitcaddy.com/server/v3/models/ai" authmodel "code.gitcaddy.com/server/v3/models/auth"