Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c7d68c742d | |||
| baf829349c | |||
| 3145acc423 | |||
| ce3fc36835 | |||
| c267bc86a8 | |||
| c790a7236c | |||
| 0ef2184204 | |||
| ca3564a1ec | |||
| e6ca9a078d | |||
| 67973b27aa | |||
| 7d90b5eb4b | |||
| faf5fc1797 |
@@ -0,0 +1,44 @@
|
|||||||
|
root = "."
|
||||||
|
testdata_dir = "testdata"
|
||||||
|
tmp_dir = "tmp"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
args_bin = []
|
||||||
|
bin = "./tmp/main"
|
||||||
|
cmd = "go build -o ./tmp/main ./cmd/server"
|
||||||
|
delay = 500
|
||||||
|
exclude_dir = ["assets", "tmp", "vendor", "testdata", ".git", "node_modules"]
|
||||||
|
exclude_file = []
|
||||||
|
exclude_regex = ["_test\\.go$"]
|
||||||
|
exclude_unchanged = false
|
||||||
|
follow_symlink = false
|
||||||
|
full_bin = ""
|
||||||
|
include_dir = []
|
||||||
|
include_ext = ["go", "html", "css", "js"]
|
||||||
|
include_file = []
|
||||||
|
kill_delay = "0s"
|
||||||
|
log = "build-errors.log"
|
||||||
|
poll = false
|
||||||
|
poll_interval = 0
|
||||||
|
rerun = false
|
||||||
|
rerun_delay = 500
|
||||||
|
send_interrupt = false
|
||||||
|
stop_on_error = false
|
||||||
|
|
||||||
|
[color]
|
||||||
|
app = ""
|
||||||
|
build = "yellow"
|
||||||
|
main = "magenta"
|
||||||
|
runner = "green"
|
||||||
|
watcher = "cyan"
|
||||||
|
|
||||||
|
[log]
|
||||||
|
main_only = false
|
||||||
|
time = false
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
clean_on_exit = true
|
||||||
|
|
||||||
|
[screen]
|
||||||
|
clear_on_rebuild = false
|
||||||
|
keep_scroll = true
|
||||||
@@ -15,6 +15,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: '1.22'
|
go-version: '1.22'
|
||||||
|
|
||||||
|
- name: Vet
|
||||||
|
run: go vet ./...
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: go test -race ./...
|
run: go test -race ./...
|
||||||
|
|
||||||
|
|||||||
+148
@@ -0,0 +1,148 @@
|
|||||||
|
# Post-Deployment Smoke Test Runbook
|
||||||
|
|
||||||
|
Smoke test procedure for verifying gitea-mobile after deployment to the Talos cluster.
|
||||||
|
|
||||||
|
## Pre-conditions
|
||||||
|
|
||||||
|
Before running the smoke test, confirm:
|
||||||
|
|
||||||
|
- [ ] FluxCD has reconciled the latest manifests: `flux get kustomizations -n flux-system`
|
||||||
|
- [ ] The gitea-mobile pod is Running: `kubectl get pods -n gitea-mobile`
|
||||||
|
- [ ] The IngressRoute is active: `kubectl get ingressroute -n gitea-mobile`
|
||||||
|
- [ ] DNS resolves `gitea-mobile.testing.leeworks.dev` to the cluster ingress
|
||||||
|
|
||||||
|
## Step 1: Pod Health
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verify the pod is running and ready
|
||||||
|
kubectl get pods -n gitea-mobile
|
||||||
|
# Expected: STATUS=Running, READY=1/1
|
||||||
|
|
||||||
|
# Check pod logs for startup errors
|
||||||
|
kubectl logs -n gitea-mobile deployment/gitea-mobile --tail=20
|
||||||
|
# Expected: JSON log line with "server starting" message
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 2: Health Endpoint
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Hit the health check endpoint from inside the cluster
|
||||||
|
kubectl exec -n gitea-mobile deployment/gitea-mobile -- wget -qO- http://localhost:8080/health
|
||||||
|
# Expected: HTTP 200
|
||||||
|
|
||||||
|
# Hit the health check endpoint from outside the cluster
|
||||||
|
curl -s -o /dev/null -w "%{http_code}" https://gitea-mobile.testing.leeworks.dev/health
|
||||||
|
# Expected: 200
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 3: TLS and Ingress
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verify TLS certificate is valid
|
||||||
|
curl -vI https://gitea-mobile.testing.leeworks.dev 2>&1 | grep "SSL certificate"
|
||||||
|
# Expected: valid certificate from Let's Encrypt or cluster CA
|
||||||
|
|
||||||
|
# Verify the app responds with HTML
|
||||||
|
curl -s https://gitea-mobile.testing.leeworks.dev | head -5
|
||||||
|
# Expected: HTML document with <html> tag
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 4: Authentication Flow
|
||||||
|
|
||||||
|
1. Open `https://gitea-mobile.testing.leeworks.dev` in a browser
|
||||||
|
2. Navigate to the Settings page (`/settings`)
|
||||||
|
3. Enter a valid Gitea API token
|
||||||
|
4. Submit the form
|
||||||
|
5. **Expected**: Token is saved, page confirms success
|
||||||
|
6. Navigate back to the Issues tab
|
||||||
|
7. **Expected**: Issues load from the Gitea API using the saved token
|
||||||
|
|
||||||
|
## Step 5: Core Functionality -- Issues
|
||||||
|
|
||||||
|
1. Navigate to the Issues tab (`/issues`)
|
||||||
|
2. **Expected**: Cross-org issues load and display with titles, labels, and timestamps
|
||||||
|
3. Tap on an issue to expand details
|
||||||
|
4. **Expected**: Issue body renders correctly
|
||||||
|
5. Use the filter dropdown to filter by repo or label
|
||||||
|
6. **Expected**: List updates via HTMX without full page reload
|
||||||
|
|
||||||
|
## Step 6: Core Functionality -- Pull Requests
|
||||||
|
|
||||||
|
1. Navigate to the PRs tab (`/pulls`)
|
||||||
|
2. **Expected**: Pull requests load with review status icons
|
||||||
|
3. Tap on a PR to see details
|
||||||
|
4. **Expected**: PR diff summary or review status displays correctly
|
||||||
|
|
||||||
|
## Step 7: Core Functionality -- Dashboard / Triage Queue
|
||||||
|
|
||||||
|
1. Navigate to the Dashboard/Triage tab (`/`)
|
||||||
|
2. **Expected**: Unassigned issues and PRs awaiting review appear sorted by priority
|
||||||
|
|
||||||
|
## Step 8: Create Issue (Write Operation)
|
||||||
|
|
||||||
|
1. Navigate to the new issue form
|
||||||
|
2. Fill in title: `[smoke-test] Automated verification`
|
||||||
|
3. Fill in body: `This issue was created during smoke testing. Safe to close.`
|
||||||
|
4. Submit the form
|
||||||
|
5. **Expected**: Issue is created successfully in Gitea
|
||||||
|
6. Verify in Gitea web UI that the issue exists
|
||||||
|
7. Close and delete the test issue after verification
|
||||||
|
|
||||||
|
## Step 9: Apply Label (Write Operation)
|
||||||
|
|
||||||
|
1. On any test issue, attempt to apply a label
|
||||||
|
2. **Expected**: Label is applied via the Gitea API and reflected in the UI
|
||||||
|
|
||||||
|
## Step 10: PWA / iPhone Safari
|
||||||
|
|
||||||
|
1. Open `https://gitea-mobile.testing.leeworks.dev` on iPhone Safari
|
||||||
|
2. **Expected**: App loads with mobile-optimized layout, no horizontal scroll
|
||||||
|
3. Tap "Add to Home Screen" from the Safari share menu
|
||||||
|
4. **Expected**: App icon appears on the home screen (apple-touch-icon)
|
||||||
|
5. Launch from the home screen
|
||||||
|
6. **Expected**: App opens in standalone mode (no Safari browser chrome)
|
||||||
|
7. Verify bottom navigation does not overlap with iPhone home indicator
|
||||||
|
8. Toggle device dark mode in Settings
|
||||||
|
9. **Expected**: App switches between dark and light themes via `prefers-color-scheme`
|
||||||
|
10. See issue #93 for the full PWA validation checklist
|
||||||
|
|
||||||
|
## Expected Results Summary
|
||||||
|
|
||||||
|
| Step | Check | Expected |
|
||||||
|
|------|-------|----------|
|
||||||
|
| 1 | Pod status | Running, Ready 1/1 |
|
||||||
|
| 2 | `/health` | HTTP 200 |
|
||||||
|
| 3 | TLS | Valid cert, HTML response |
|
||||||
|
| 4 | Auth | Token saved, API calls work |
|
||||||
|
| 5 | Issues | List loads, filter works |
|
||||||
|
| 6 | PRs | List loads with review status |
|
||||||
|
| 7 | Dashboard/Triage | Queue displays correctly at `/` |
|
||||||
|
| 8 | Create issue | Issue created in Gitea |
|
||||||
|
| 9 | Apply label | Label applied via API |
|
||||||
|
| 10 | PWA | Standalone mode, safe areas, dark mode |
|
||||||
|
|
||||||
|
## Rollback Procedure
|
||||||
|
|
||||||
|
If the deployment is broken or the app is not functioning:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Roll back to the previous deployment revision
|
||||||
|
kubectl rollout undo deployment/gitea-mobile -n gitea-mobile
|
||||||
|
|
||||||
|
# Verify the rollback
|
||||||
|
kubectl rollout status deployment/gitea-mobile -n gitea-mobile
|
||||||
|
# Expected: "deployment successfully rolled out"
|
||||||
|
|
||||||
|
# Check that the previous image tag is running
|
||||||
|
kubectl get deployment gitea-mobile -n gitea-mobile -o jsonpath='{.spec.template.spec.containers[0].image}'
|
||||||
|
```
|
||||||
|
|
||||||
|
If FluxCD keeps reconciling back to the broken version, suspend reconciliation temporarily:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Suspend Flux reconciliation
|
||||||
|
flux suspend kustomization gitea-mobile -n flux-system
|
||||||
|
|
||||||
|
# After fixing the issue, resume
|
||||||
|
flux resume kustomization gitea-mobile -n flux-system
|
||||||
|
```
|
||||||
+34
-3
@@ -1,10 +1,14 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"log"
|
"log"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
"gitea.leeworks.dev/0xwheatyz/gitea-mobile/internal/config"
|
"gitea.leeworks.dev/0xwheatyz/gitea-mobile/internal/config"
|
||||||
giteaclient "gitea.leeworks.dev/0xwheatyz/gitea-mobile/internal/gitea"
|
giteaclient "gitea.leeworks.dev/0xwheatyz/gitea-mobile/internal/gitea"
|
||||||
@@ -36,8 +40,35 @@ func main() {
|
|||||||
handler = middleware.Auth(cfg.SessionSecret, cfg.GiteaToken)(handler)
|
handler = middleware.Auth(cfg.SessionSecret, cfg.GiteaToken)(handler)
|
||||||
handler = middleware.Logging()(handler)
|
handler = middleware.Logging()(handler)
|
||||||
|
|
||||||
slog.Info("server starting", "addr", cfg.ListenAddr, "gitea_url", cfg.GiteaURL)
|
srv := &http.Server{
|
||||||
if err := http.ListenAndServe(cfg.ListenAddr, handler); err != nil {
|
Addr: cfg.ListenAddr,
|
||||||
log.Fatalf("server error: %v", err)
|
Handler: handler,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Channel to receive shutdown signals.
|
||||||
|
quit := make(chan os.Signal, 1)
|
||||||
|
signal.Notify(quit, syscall.SIGTERM, syscall.SIGINT)
|
||||||
|
|
||||||
|
// Start server in a goroutine.
|
||||||
|
go func() {
|
||||||
|
slog.Info("server starting", "addr", cfg.ListenAddr, "gitea_url", cfg.GiteaURL)
|
||||||
|
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||||
|
log.Fatalf("server error: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
// Block until a shutdown signal is received.
|
||||||
|
sig := <-quit
|
||||||
|
slog.Info("shutdown signal received, draining in-flight requests", "signal", sig.String())
|
||||||
|
|
||||||
|
// Give in-flight requests up to 15 seconds to complete.
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
|
if err := srv.Shutdown(ctx); err != nil {
|
||||||
|
slog.Error("server forced to shutdown", "error", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
slog.Info("server stopped gracefully")
|
||||||
}
|
}
|
||||||
|
|||||||
+53
-2
@@ -1,4 +1,12 @@
|
|||||||
/* Gitea Mobile — Mobile-first CSS (~5KB target) */
|
/* Gitea Mobile — Mobile-first CSS
|
||||||
|
* Dark-mode-first: dark colors are the :root defaults.
|
||||||
|
* Light mode is applied via @media (prefers-color-scheme: light).
|
||||||
|
*
|
||||||
|
* Size note: The original ~5KB target was based on the initial Phase 1 scope.
|
||||||
|
* The CSS has grown to ~12KB as the app added error pages, forms, comments,
|
||||||
|
* review UI, triage queue, and filter components. All rules are in active use.
|
||||||
|
* Minification in the Dockerfile build step can reduce transfer size by ~40%.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Reset */
|
/* Reset */
|
||||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
@@ -533,7 +541,7 @@ a:active {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dark mode is default; light mode override if needed */
|
/* Dark mode is default; light mode override for prefers-color-scheme: light */
|
||||||
@media (prefers-color-scheme: light) {
|
@media (prefers-color-scheme: light) {
|
||||||
:root {
|
:root {
|
||||||
--bg-primary: #ffffff;
|
--bg-primary: #ffffff;
|
||||||
@@ -543,6 +551,49 @@ a:active {
|
|||||||
--text-primary: #1f2328;
|
--text-primary: #1f2328;
|
||||||
--text-secondary: #656d76;
|
--text-secondary: #656d76;
|
||||||
--text-link: #0969da;
|
--text-link: #0969da;
|
||||||
|
--accent-green: #1a7f37;
|
||||||
|
--accent-red: #cf222e;
|
||||||
|
--accent-yellow: #9a6700;
|
||||||
|
--accent-blue: #0969da;
|
||||||
|
--accent-purple: #8250df;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message.success {
|
||||||
|
background: #dafbe1;
|
||||||
|
border-color: #1a7f37;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message.error {
|
||||||
|
background: #ffebe9;
|
||||||
|
border-color: #cf222e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.message.info {
|
||||||
|
background: #ddf4ff;
|
||||||
|
border-color: #0969da;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: #1a7f37;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:active {
|
||||||
|
background: #116329;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger {
|
||||||
|
background: #ffebe9;
|
||||||
|
border-color: #cf222e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-issue {
|
||||||
|
background: rgba(9, 105, 218, 0.1);
|
||||||
|
border-color: rgba(9, 105, 218, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.type-pull {
|
||||||
|
background: rgba(26, 127, 55, 0.1);
|
||||||
|
border-color: rgba(26, 127, 55, 0.3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user