Compare commits
1 Commits
fix/module
...
54fd0bdcb3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54fd0bdcb3 |
@@ -10,7 +10,17 @@ jobs:
|
|||||||
check:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4, 2024-10-13
|
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||||
|
|
||||||
- name: Build (runs make check inside Dockerfile)
|
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
|
||||||
run: docker build .
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
|
||||||
|
- name: Install golangci-lint
|
||||||
|
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@5d1e709b7be35cb2025444e19de266b056b7b7ee # v2.10.1
|
||||||
|
|
||||||
|
- name: Install goimports
|
||||||
|
run: go install golang.org/x/tools/cmd/goimports@009367f5c17a8d4c45a961a3a509277190a9a6f0 # v0.42.0
|
||||||
|
|
||||||
|
- name: Run make check
|
||||||
|
run: make check
|
||||||
|
|||||||
26
Dockerfile
26
Dockerfile
@@ -2,23 +2,23 @@
|
|||||||
# golang:1.25-alpine
|
# golang:1.25-alpine
|
||||||
FROM golang@sha256:f6751d823c26342f9506c03797d2527668d095b0a15f1862cddb4d927a7a4ced AS builder
|
FROM golang@sha256:f6751d823c26342f9506c03797d2527668d095b0a15f1862cddb4d927a7a4ced AS builder
|
||||||
|
|
||||||
RUN apk add --no-cache git make gcc musl-dev
|
RUN apk add --no-cache git make gcc musl-dev curl
|
||||||
|
|
||||||
# Install golangci-lint v2 (pre-built binary — go install fails in alpine due to missing linker)
|
# Install golangci-lint v2.10.1 (prebuilt binary, multi-arch)
|
||||||
RUN set -e; \
|
RUN set -e; \
|
||||||
GOLANGCI_VERSION="2.10.1"; \
|
ARCH="$(uname -m)"; \
|
||||||
case "$(uname -m)" in \
|
case "$ARCH" in \
|
||||||
x86_64) ARCH="amd64"; SHA256="dfa775874cf0561b404a02a8f4481fc69b28091da95aa697259820d429b09c99" ;; \
|
x86_64) ARCH=amd64; SHA256="dfa775874cf0561b404a02a8f4481fc69b28091da95aa697259820d429b09c99" ;; \
|
||||||
aarch64) ARCH="arm64"; SHA256="6652b42ae02915eb2f9cb2a2e0cac99514c8eded8388d88ae3e06e1a52c00de8" ;; \
|
aarch64) ARCH=arm64; SHA256="6652b42ae02915eb2f9cb2a2e0cac99514c8eded8388d88ae3e06e1a52c00de8" ;; \
|
||||||
*) echo "unsupported arch: $(uname -m)" >&2; exit 1 ;; \
|
*) echo "Unsupported arch: $ARCH" >&2; exit 1 ;; \
|
||||||
esac; \
|
esac; \
|
||||||
wget -q -O /tmp/golangci-lint.tar.gz \
|
curl -fsSL "https://github.com/golangci/golangci-lint/releases/download/v2.10.1/golangci-lint-2.10.1-linux-${ARCH}.tar.gz" -o /tmp/golangci-lint.tar.gz; \
|
||||||
"https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_VERSION}/golangci-lint-${GOLANGCI_VERSION}-linux-${ARCH}.tar.gz"; \
|
|
||||||
echo "${SHA256} /tmp/golangci-lint.tar.gz" | sha256sum -c -; \
|
echo "${SHA256} /tmp/golangci-lint.tar.gz" | sha256sum -c -; \
|
||||||
tar -xzf /tmp/golangci-lint.tar.gz -C /usr/local/bin --strip-components=1 "golangci-lint-${GOLANGCI_VERSION}-linux-${ARCH}/golangci-lint"; \
|
tar -xzf /tmp/golangci-lint.tar.gz -C /usr/local/bin --strip-components=1 "golangci-lint-2.10.1-linux-${ARCH}/golangci-lint"; \
|
||||||
rm /tmp/golangci-lint.tar.gz; \
|
rm /tmp/golangci-lint.tar.gz
|
||||||
golangci-lint version
|
|
||||||
RUN go install golang.org/x/tools/cmd/goimports@009367f5c17a8d4c45a961a3a509277190a9a6f0 # v0.42.0
|
# Install goimports v0.42.0
|
||||||
|
RUN go install golang.org/x/tools/cmd/goimports@009367f5c17a8d4c45a961a3a509277190a9a6f0
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
|
|||||||
@@ -4,20 +4,20 @@ package main
|
|||||||
import (
|
import (
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/docker"
|
"git.eeqj.de/sneak/upaas/internal/docker"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/handlers"
|
"git.eeqj.de/sneak/upaas/internal/handlers"
|
||||||
"sneak.berlin/go/upaas/internal/healthcheck"
|
"git.eeqj.de/sneak/upaas/internal/healthcheck"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/middleware"
|
"git.eeqj.de/sneak/upaas/internal/middleware"
|
||||||
"sneak.berlin/go/upaas/internal/server"
|
"git.eeqj.de/sneak/upaas/internal/server"
|
||||||
"sneak.berlin/go/upaas/internal/service/app"
|
"git.eeqj.de/sneak/upaas/internal/service/app"
|
||||||
"sneak.berlin/go/upaas/internal/service/auth"
|
"git.eeqj.de/sneak/upaas/internal/service/auth"
|
||||||
"sneak.berlin/go/upaas/internal/service/deploy"
|
"git.eeqj.de/sneak/upaas/internal/service/deploy"
|
||||||
"sneak.berlin/go/upaas/internal/service/notify"
|
"git.eeqj.de/sneak/upaas/internal/service/notify"
|
||||||
"sneak.berlin/go/upaas/internal/service/webhook"
|
"git.eeqj.de/sneak/upaas/internal/service/webhook"
|
||||||
|
|
||||||
_ "github.com/joho/godotenv/autoload"
|
_ "github.com/joho/godotenv/autoload"
|
||||||
)
|
)
|
||||||
|
|||||||
4
go.mod
4
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module sneak.berlin/go/upaas
|
module git.eeqj.de/sneak/upaas
|
||||||
|
|
||||||
go 1.25
|
go 1.25
|
||||||
|
|
||||||
@@ -19,7 +19,6 @@ require (
|
|||||||
github.com/stretchr/testify v1.11.1
|
github.com/stretchr/testify v1.11.1
|
||||||
go.uber.org/fx v1.24.0
|
go.uber.org/fx v1.24.0
|
||||||
golang.org/x/crypto v0.46.0
|
golang.org/x/crypto v0.46.0
|
||||||
golang.org/x/time v0.12.0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -75,6 +74,7 @@ require (
|
|||||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||||
golang.org/x/sys v0.39.0 // indirect
|
golang.org/x/sys v0.39.0 // indirect
|
||||||
golang.org/x/text v0.32.0 // indirect
|
golang.org/x/text v0.32.0 // indirect
|
||||||
|
golang.org/x/time v0.12.0 // indirect
|
||||||
google.golang.org/protobuf v1.36.10 // indirect
|
google.golang.org/protobuf v1.36.10 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
gotest.tools/v3 v3.5.2 // indirect
|
gotest.tools/v3 v3.5.2 // indirect
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// defaultPort is the default HTTP server port.
|
// defaultPort is the default HTTP server port.
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import (
|
|||||||
_ "github.com/mattn/go-sqlite3" // SQLite driver
|
_ "github.com/mattn/go-sqlite3" // SQLite driver
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// dataDirPermissions is the file permission for the data directory.
|
// dataDirPermissions is the file permission for the data directory.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestHashWebhookSecret(t *testing.T) {
|
func TestHashWebhookSecret(t *testing.T) {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewTestDatabase creates an in-memory Database for testing.
|
// NewTestDatabase creates an in-memory Database for testing.
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ import (
|
|||||||
"github.com/docker/go-connections/nat"
|
"github.com/docker/go-connections/nat"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sshKeyPermissions is the file permission for SSH private keys.
|
// sshKeyPermissions is the file permission for SSH private keys.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// apiAppResponse is the JSON representation of an app.
|
// apiAppResponse is the JSON representation of an app.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/service/app"
|
"git.eeqj.de/sneak/upaas/internal/service/app"
|
||||||
)
|
)
|
||||||
|
|
||||||
// apiRouter builds a chi router with the API routes using session auth middleware.
|
// apiRouter builds a chi router with the API routes using session auth middleware.
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ import (
|
|||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
"sneak.berlin/go/upaas/internal/service/app"
|
"git.eeqj.de/sneak/upaas/internal/service/app"
|
||||||
"sneak.berlin/go/upaas/templates"
|
"git.eeqj.de/sneak/upaas/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/templates"
|
"git.eeqj.de/sneak/upaas/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HandleLoginGET returns the login page handler.
|
// HandleLoginGET returns the login page handler.
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
"sneak.berlin/go/upaas/templates"
|
"git.eeqj.de/sneak/upaas/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AppStats holds deployment statistics for an app.
|
// AppStats holds deployment statistics for an app.
|
||||||
|
|||||||
@@ -10,16 +10,16 @@ import (
|
|||||||
"github.com/gorilla/csrf"
|
"github.com/gorilla/csrf"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/docker"
|
"git.eeqj.de/sneak/upaas/internal/docker"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/healthcheck"
|
"git.eeqj.de/sneak/upaas/internal/healthcheck"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/service/app"
|
"git.eeqj.de/sneak/upaas/internal/service/app"
|
||||||
"sneak.berlin/go/upaas/internal/service/auth"
|
"git.eeqj.de/sneak/upaas/internal/service/auth"
|
||||||
"sneak.berlin/go/upaas/internal/service/deploy"
|
"git.eeqj.de/sneak/upaas/internal/service/deploy"
|
||||||
"sneak.berlin/go/upaas/internal/service/webhook"
|
"git.eeqj.de/sneak/upaas/internal/service/webhook"
|
||||||
"sneak.berlin/go/upaas/templates"
|
"git.eeqj.de/sneak/upaas/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Params contains dependencies for Handlers.
|
// Params contains dependencies for Handlers.
|
||||||
|
|||||||
@@ -15,21 +15,21 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/docker"
|
"git.eeqj.de/sneak/upaas/internal/docker"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/handlers"
|
"git.eeqj.de/sneak/upaas/internal/handlers"
|
||||||
"sneak.berlin/go/upaas/internal/healthcheck"
|
"git.eeqj.de/sneak/upaas/internal/healthcheck"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/middleware"
|
"git.eeqj.de/sneak/upaas/internal/middleware"
|
||||||
"sneak.berlin/go/upaas/internal/service/app"
|
"git.eeqj.de/sneak/upaas/internal/service/app"
|
||||||
"sneak.berlin/go/upaas/internal/service/auth"
|
"git.eeqj.de/sneak/upaas/internal/service/auth"
|
||||||
"sneak.berlin/go/upaas/internal/service/deploy"
|
"git.eeqj.de/sneak/upaas/internal/service/deploy"
|
||||||
"sneak.berlin/go/upaas/internal/service/notify"
|
"git.eeqj.de/sneak/upaas/internal/service/notify"
|
||||||
"sneak.berlin/go/upaas/internal/service/webhook"
|
"git.eeqj.de/sneak/upaas/internal/service/webhook"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testContext struct {
|
type testContext struct {
|
||||||
@@ -404,25 +404,6 @@ func TestHandleDashboard(t *testing.T) {
|
|||||||
assert.Equal(t, http.StatusOK, recorder.Code)
|
assert.Equal(t, http.StatusOK, recorder.Code)
|
||||||
assert.Contains(t, recorder.Body.String(), "Applications")
|
assert.Contains(t, recorder.Body.String(), "Applications")
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("renders dashboard with apps without crashing on CSRFField", func(t *testing.T) {
|
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
testCtx := setupTestHandlers(t)
|
|
||||||
|
|
||||||
// Create an app so the template iterates over AppStats and hits .CSRFField
|
|
||||||
createTestApp(t, testCtx, "csrf-test-app")
|
|
||||||
|
|
||||||
request := httptest.NewRequest(http.MethodGet, "/", nil)
|
|
||||||
recorder := httptest.NewRecorder()
|
|
||||||
|
|
||||||
handler := testCtx.handlers.HandleDashboard()
|
|
||||||
handler.ServeHTTP(recorder, request)
|
|
||||||
|
|
||||||
assert.Equal(t, http.StatusOK, recorder.Code,
|
|
||||||
"dashboard should not 500 when apps exist (CSRFField must be accessible)")
|
|
||||||
assert.Contains(t, recorder.Body.String(), "csrf-test-app")
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHandleAppNew(t *testing.T) {
|
func TestHandleAppNew(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package handlers_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/handlers"
|
"git.eeqj.de/sneak/upaas/internal/handlers"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestValidateRepoURL(t *testing.T) {
|
func TestValidateRepoURL(t *testing.T) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package handlers_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/handlers"
|
"git.eeqj.de/sneak/upaas/internal/handlers"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSanitizeLogs(t *testing.T) { //nolint:funlen // table-driven tests
|
func TestSanitizeLogs(t *testing.T) { //nolint:funlen // table-driven tests
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package handlers
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/templates"
|
"git.eeqj.de/sneak/upaas/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package handlers_test
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/handlers"
|
"git.eeqj.de/sneak/upaas/internal/handlers"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSanitizeTail(t *testing.T) {
|
func TestSanitizeTail(t *testing.T) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// maxWebhookBodySize is the maximum allowed size of a webhook request body (1MB).
|
// maxWebhookBodySize is the maximum allowed size of a webhook request body (1MB).
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import (
|
|||||||
|
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Params contains dependencies for Healthcheck.
|
// Params contains dependencies for Healthcheck.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Params contains dependencies for Logger.
|
// Params contains dependencies for Logger.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
//nolint:gosec // test credentials
|
//nolint:gosec // test credentials
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ import (
|
|||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
"golang.org/x/time/rate"
|
"golang.org/x/time/rate"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/service/auth"
|
"git.eeqj.de/sneak/upaas/internal/service/auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// corsMaxAge is the maximum age for CORS preflight responses in seconds.
|
// corsMaxAge is the maximum age for CORS preflight responses in seconds.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newTestMiddleware(t *testing.T) *Middleware {
|
func newTestMiddleware(t *testing.T) *Middleware {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// appColumns is the standard column list for app queries.
|
// appColumns is the standard column list for app queries.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DeploymentStatus represents the status of a deployment.
|
// DeploymentStatus represents the status of a deployment.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnvVar represents an environment variable for an app.
|
// EnvVar represents an environment variable for an app.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Label represents a Docker label for an app container.
|
// Label represents a Docker label for an app container.
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Test constants to satisfy goconst linter.
|
// Test constants to satisfy goconst linter.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PortProtocol represents the protocol for a port mapping.
|
// PortProtocol represents the protocol for a port mapping.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// User represents a user in the system.
|
// User represents a user in the system.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Volume represents a volume mount for an app container.
|
// Volume represents a volume mount for an app container.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WebhookEvent represents a received webhook event.
|
// WebhookEvent represents a received webhook event.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
chimw "github.com/go-chi/chi/v5/middleware"
|
chimw "github.com/go-chi/chi/v5/middleware"
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/static"
|
"git.eeqj.de/sneak/upaas/static"
|
||||||
)
|
)
|
||||||
|
|
||||||
// requestTimeout is the maximum duration for handling a request.
|
// requestTimeout is the maximum duration for handling a request.
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ import (
|
|||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/handlers"
|
"git.eeqj.de/sneak/upaas/internal/handlers"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/middleware"
|
"git.eeqj.de/sneak/upaas/internal/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Params contains dependencies for Server.
|
// Params contains dependencies for Server.
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import (
|
|||||||
|
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
"sneak.berlin/go/upaas/internal/ssh"
|
"git.eeqj.de/sneak/upaas/internal/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceParams contains dependencies for Service.
|
// ServiceParams contains dependencies for Service.
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
"sneak.berlin/go/upaas/internal/service/app"
|
"git.eeqj.de/sneak/upaas/internal/service/app"
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupTestService(t *testing.T) (*app.Service, func()) {
|
func setupTestService(t *testing.T) (*app.Service, func()) {
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ import (
|
|||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
"golang.org/x/crypto/argon2"
|
"golang.org/x/crypto/argon2"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/service/auth"
|
"git.eeqj.de/sneak/upaas/internal/service/auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupTestService(t *testing.T) (*auth.Service, func()) {
|
func setupTestService(t *testing.T) (*auth.Service, func()) {
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ import (
|
|||||||
|
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/docker"
|
"git.eeqj.de/sneak/upaas/internal/docker"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
"sneak.berlin/go/upaas/internal/service/notify"
|
"git.eeqj.de/sneak/upaas/internal/service/notify"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Time constants.
|
// Time constants.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/service/deploy"
|
"git.eeqj.de/sneak/upaas/internal/service/deploy"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCancelActiveDeploy_NoExisting(t *testing.T) {
|
func TestCancelActiveDeploy_NoExisting(t *testing.T) {
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/service/deploy"
|
"git.eeqj.de/sneak/upaas/internal/service/deploy"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCleanupCancelledDeploy_RemovesBuildDir(t *testing.T) {
|
func TestCleanupCancelledDeploy_RemovesBuildDir(t *testing.T) {
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/docker"
|
"git.eeqj.de/sneak/upaas/internal/docker"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
"sneak.berlin/go/upaas/internal/service/deploy"
|
"git.eeqj.de/sneak/upaas/internal/service/deploy"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuildContainerOptionsUsesImageID(t *testing.T) {
|
func TestBuildContainerOptionsUsesImageID(t *testing.T) {
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/docker"
|
"git.eeqj.de/sneak/upaas/internal/docker"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewTestService creates a Service with minimal dependencies for testing.
|
// NewTestService creates a Service with minimal dependencies for testing.
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import (
|
|||||||
|
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HTTP client timeout.
|
// HTTP client timeout.
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import (
|
|||||||
|
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
"sneak.berlin/go/upaas/internal/service/deploy"
|
"git.eeqj.de/sneak/upaas/internal/service/deploy"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceParams contains dependencies for Service.
|
// ServiceParams contains dependencies for Service.
|
||||||
|
|||||||
@@ -12,15 +12,15 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
"sneak.berlin/go/upaas/internal/config"
|
"git.eeqj.de/sneak/upaas/internal/config"
|
||||||
"sneak.berlin/go/upaas/internal/database"
|
"git.eeqj.de/sneak/upaas/internal/database"
|
||||||
"sneak.berlin/go/upaas/internal/docker"
|
"git.eeqj.de/sneak/upaas/internal/docker"
|
||||||
"sneak.berlin/go/upaas/internal/globals"
|
"git.eeqj.de/sneak/upaas/internal/globals"
|
||||||
"sneak.berlin/go/upaas/internal/logger"
|
"git.eeqj.de/sneak/upaas/internal/logger"
|
||||||
"sneak.berlin/go/upaas/internal/models"
|
"git.eeqj.de/sneak/upaas/internal/models"
|
||||||
"sneak.berlin/go/upaas/internal/service/deploy"
|
"git.eeqj.de/sneak/upaas/internal/service/deploy"
|
||||||
"sneak.berlin/go/upaas/internal/service/notify"
|
"git.eeqj.de/sneak/upaas/internal/service/notify"
|
||||||
"sneak.berlin/go/upaas/internal/service/webhook"
|
"git.eeqj.de/sneak/upaas/internal/service/webhook"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testDeps struct {
|
type testDeps struct {
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"git.eeqj.de/sneak/upaas/internal/ssh"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"sneak.berlin/go/upaas/internal/ssh"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGenerateKeyPair(t *testing.T) {
|
func TestGenerateKeyPair(t *testing.T) {
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
<a href="/apps/{{.App.ID}}" class="btn-text text-sm py-1 px-2">View</a>
|
<a href="/apps/{{.App.ID}}" class="btn-text text-sm py-1 px-2">View</a>
|
||||||
<a href="/apps/{{.App.ID}}/edit" class="btn-secondary text-sm py-1 px-2">Edit</a>
|
<a href="/apps/{{.App.ID}}/edit" class="btn-secondary text-sm py-1 px-2">Edit</a>
|
||||||
<form method="POST" action="/apps/{{.App.ID}}/deploy" class="inline">
|
<form method="POST" action="/apps/{{.App.ID}}/deploy" class="inline">
|
||||||
{{ $.CSRFField }}
|
{{ .CSRFField }}
|
||||||
<button type="submit" class="btn-success text-sm py-1 px-2">Deploy</button>
|
<button type="submit" class="btn-success text-sm py-1 px-2">Deploy</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user