From 2bae5088a6df1bca2672fc684faf44cc43db7a70 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 18:39:39 +0200 Subject: [PATCH 01/32] Add project attribution to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c2bec0368b7..144ec061cc4 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,5 @@ go build -o notely && ./notely *This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! + +Gerrit's version of Boot.dev's Notely app. From 2bc649570c99e48a450094dc3cd9552c28f9f1b1 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 18:47:16 +0200 Subject: [PATCH 02/32] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 144ec061cc4..7f91777ca47 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,4 @@ go build -o notely && ./notely You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! -Gerrit's version of Boot.dev's Notely app. +Gerrit B's version of Boot.dev's Notely app. From 8b2a3caa20424a50ab36601252b29351135ba347 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 19:40:18 +0200 Subject: [PATCH 03/32] Add CI workflow configuration --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..a2cf2a837ae --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: ci + +on: + pull_request: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: Force Failure + run: (exit 1) From 76177966170ece3e375c12be03b5b284a0ca5f09 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 19:47:06 +0200 Subject: [PATCH 04/32] Revert "Add project attribution to README" This reverts commit 2bae5088a6df1bca2672fc684faf44cc43db7a70. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 7f91777ca47..c2bec0368b7 100644 --- a/README.md +++ b/README.md @@ -21,5 +21,3 @@ go build -o notely && ./notely *This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! - -Gerrit B's version of Boot.dev's Notely app. From 85d86f99e6bc6cb9bb7661784342e244cdb7cd41 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 19:50:43 +0200 Subject: [PATCH 05/32] Add personal identifier to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index c2bec0368b7..058ae4e2541 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,5 @@ go build -o notely && ./notely *This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! + +MYNAME's version of Boot.dev's Notely app. From ec87f3f12830a405a0729cefa591518029efd3f7 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 19:53:29 +0200 Subject: [PATCH 06/32] Add CI workflow with Go testing pipeline --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..a2cf2a837ae --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: ci + +on: + pull_request: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: Force Failure + run: (exit 1) From e86bd463259a197443c36beec5f49c1c2e19dc46 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 20:02:28 +0200 Subject: [PATCH 07/32] Replace forced failure with Go version check in CI --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2cf2a837ae..c8b23961fe8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,5 +18,5 @@ jobs: with: go-version: "1.26.0" - - name: Force Failure - run: (exit 1) + - name: Go Version + run: go version From 6df2a5c7fca13410d529ce7df36ef942b71a872c Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 20:16:42 +0200 Subject: [PATCH 08/32] Add unit tests for GetAPIKey and update CI workflow --- .github/workflows/ci.yml | 4 +- internal/auth/get_api_key_test.go | 88 +++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 internal/auth/get_api_key_test.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8b23961fe8..80890525d1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,5 +18,5 @@ jobs: with: go-version: "1.26.0" - - name: Go Version - run: go version + - name: Unit Tests + run: "run: go test ./..." diff --git a/internal/auth/get_api_key_test.go b/internal/auth/get_api_key_test.go new file mode 100644 index 00000000000..9e02a0e01e5 --- /dev/null +++ b/internal/auth/get_api_key_test.go @@ -0,0 +1,88 @@ +package auth + +import ( + "errors" + "net/http" + "testing" +) + +func TestGetAPIKey(t *testing.T) { + tests := []struct { + name string + headers http.Header + wantKey string + wantErr error + wantErrText string + }{ + { + name: "Missing Authorization header", + headers: http.Header{}, + wantKey: "", + wantErr: ErrNoAuthHeaderIncluded, + }, + { + name: "Empty Authorization header value", + headers: http.Header{ + "Authorization": []string{""}, + }, + wantKey: "", + wantErr: ErrNoAuthHeaderIncluded, + }, + { + name: "Malformed header - missing ApiKey prefix", + headers: http.Header{ + "Authorization": []string{"Bearer 12345"}, + }, + wantKey: "", + wantErrText: "malformed authorization header", + }, + { + name: "Malformed header - missing key component", + headers: http.Header{ + "Authorization": []string{"ApiKey"}, + }, + wantKey: "", + wantErrText: "malformed authorization header", + }, + { + name: "Malformed header - invalid prefix casing", + headers: http.Header{ + "Authorization": []string{"apikey 12345"}, + }, + wantKey: "", + wantErrText: "malformed authorization header", + }, + { + name: "Valid Authorization header", + headers: http.Header{ + "Authorization": []string{"ApiKey my-secret-api-key-123"}, + }, + wantKey: "my-secret-api-key-123", + wantErr: nil, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gotKey, err := GetAPIKey(tt.headers) + + // Check error expectations + if tt.wantErr != nil { + if !errors.Is(err, tt.wantErr) { + t.Errorf("GetAPIKey() error = %v, wantErr %v", err, tt.wantErr) + } + } else if tt.wantErrText != "" { + if err == nil || err.Error() != tt.wantErrText { + t.Errorf("GetAPIKey() error = %v, wantErrText %q", err, tt.wantErrText) + } + } else if err != nil { + t.Errorf("GetAPIKey() unexpected error = %v", err) + } + + // Check key expectation + if gotKey != tt.wantKey { + t.Errorf("GetAPIKey() gotKey = %q, want %q", gotKey, tt.wantKey) + } + }) + } +} From 8cd13d821a6ce66759c412468d5df7a8d6a21802 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 20:16:57 +0200 Subject: [PATCH 09/32] Fix syntax error in CI unit test step --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80890525d1b..9e463889335 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Unit Tests - run: "run: go test ./..." + run: go test ./... From 474c4dfe06bd1cbe26b58e33141207b7033d894b Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 20:19:45 +0200 Subject: [PATCH 10/32] Enable test coverage in CI pipeline --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e463889335..06ac4ebc8dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Unit Tests - run: go test ./... + run: go test -cover ./... From 8867e4153ad329b9054abbdad93ea7dc96e51209 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 20:22:05 +0200 Subject: [PATCH 11/32] Add CI build status badge to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 058ae4e2541..696d6afc010 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +![Test Badge](https://github.com///actions/workflows//badge.svg) # learn-cicd-starter (Notely) This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev). From 836863639afe0a6ee4d72561af34db4f2ba3ef4c Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 20:23:56 +0200 Subject: [PATCH 12/32] Update test badge URL in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 696d6afc010..f39771be13d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Test Badge](https://github.com///actions/workflows//badge.svg) +![Test Badge](https://github.com/gerrithbrink/learn-cicd-starter/actions/workflows//badge.svg) # learn-cicd-starter (Notely) This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev). From 107a5159b14897fd2eda31e3fa88fe0016c49573 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 20:26:51 +0200 Subject: [PATCH 13/32] Update CI badge workflow path --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f39771be13d..03256047997 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Test Badge](https://github.com/gerrithbrink/learn-cicd-starter/actions/workflows//badge.svg) +![Test Badge](https://github.com/gerrithbrink/learn-cicd-starter/actions/workflows/ci/badge.svg) # learn-cicd-starter (Notely) This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev). From 768e1d3c9e64a9dd78534ff4e1391d6604b2c193 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 20:32:15 +0200 Subject: [PATCH 14/32] Fix broken CI badge URL in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03256047997..01494052f8b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Test Badge](https://github.com/gerrithbrink/learn-cicd-starter/actions/workflows/ci/badge.svg) +![Test Badge](https://github.com/gerrithbrink/learn-cicd-starter/actions/workflows/ci.yml/badge.svg) # learn-cicd-starter (Notely) This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev). From 51762f578617553414dcde486db21c3116b10af1 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 20:53:05 +0200 Subject: [PATCH 15/32] Add formatting checks to CI pipeline --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06ac4ebc8dc..bb2684df2f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,3 +20,11 @@ jobs: - name: Unit Tests run: go test -cover ./... + + style: + name: Style + runs-on: ubuntu-latest + + steps: + - name: Formatting Checks + run: test -z $(go fmt ./...) From c0dcf5c8364d09771786f37f8c37fad30b673968 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 21:15:18 +0200 Subject: [PATCH 16/32] Add staticcheck to CI pipeline --- .github/workflows/ci.yml | 6 ++++++ main.go | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb2684df2f7..3e399ad3718 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,3 +28,9 @@ jobs: steps: - name: Formatting Checks run: test -z $(go fmt ./...) + + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest + + - name: Run Staticcheck + run: staticcheck ./... diff --git a/main.go b/main.go index 19d7366c5f7..0cdadac81f6 100644 --- a/main.go +++ b/main.go @@ -96,3 +96,8 @@ func main() { log.Printf("Serving on port: %s\n", port) log.Fatal(srv.ListenAndServe()) } + +func unused() { + // this function does nothing + // and is called nowhere +} From 18fd3daf722d4f54da8f9965ed3ef3cbb925c3c2 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 21:29:34 +0200 Subject: [PATCH 17/32] Remove unused function --- main.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/main.go b/main.go index 0cdadac81f6..19d7366c5f7 100644 --- a/main.go +++ b/main.go @@ -96,8 +96,3 @@ func main() { log.Printf("Serving on port: %s\n", port) log.Fatal(srv.ListenAndServe()) } - -func unused() { - // this function does nothing - // and is called nowhere -} From c93dad86047aa4d6d44568ce80719ab5c1ff6a6c Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 21:37:31 +0200 Subject: [PATCH 18/32] Remove redundant newline in main.go --- main.go | 1 - 1 file changed, 1 deletion(-) diff --git a/main.go b/main.go index 19d7366c5f7..30df50eadc7 100644 --- a/main.go +++ b/main.go @@ -92,7 +92,6 @@ func main() { Addr: ":" + port, Handler: router, } - log.Printf("Serving on port: %s\n", port) log.Fatal(srv.ListenAndServe()) } From 68db60cc28663e69da0620239bddb22b0dc98676 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 21:40:01 +0200 Subject: [PATCH 19/32] Fix CI staticcheck path and add whitespace to main.go --- .github/workflows/ci.yml | 2 +- main.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e399ad3718..efe66381836 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,4 +33,4 @@ jobs: run: go install honnef.co/go/tools/cmd/staticcheck@latest - name: Run Staticcheck - run: staticcheck ./... + run: $(go env GOPATH)/bin/staticcheck ./... diff --git a/main.go b/main.go index 30df50eadc7..19d7366c5f7 100644 --- a/main.go +++ b/main.go @@ -92,6 +92,7 @@ func main() { Addr: ":" + port, Handler: router, } + log.Printf("Serving on port: %s\n", port) log.Fatal(srv.ListenAndServe()) } From 3ffd98d9a8992d98cdff682825f4f93217be312b Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 21:42:43 +0200 Subject: [PATCH 20/32] Update ci.yml --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efe66381836..2f580005be2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,8 +29,7 @@ jobs: - name: Formatting Checks run: test -z $(go fmt ./...) - - name: Install staticcheck - run: go install honnef.co/go/tools/cmd/staticcheck@latest - - name: Run Staticcheck - run: $(go env GOPATH)/bin/staticcheck ./... + uses: dominikh/staticcheck-action@v1.3.1 + with: + version: "latest" From 51b3dd0b27f909fce570d4f593c161acb4ab3a02 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 21:45:33 +0200 Subject: [PATCH 21/32] Update CI workflow to use setup-go and manual staticcheck installation --- .github/workflows/ci.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f580005be2..9a38a98414d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,10 +26,19 @@ jobs: runs-on: ubuntu-latest steps: - - name: Formatting Checks - run: test -z $(go fmt ./...) + - name: Check out code + uses: actions/checkout@v6 - - name: Run Staticcheck - uses: dominikh/staticcheck-action@v1.3.1 + - name: Set up Go + uses: actions/setup-go@v6 with: - version: "latest" + go-version: "1.25.1" + + - name: Check formatting + run: test -z $(go fmt ./...) + + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest + + - name: Run staticcheck + run: staticcheck ./... From 4dd2b699059dbfc7a5b94229d0716bc5336f1f22 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 22:00:21 +0200 Subject: [PATCH 22/32] Add gosec to CI workflow --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a38a98414d..b4c0d068b36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,9 @@ jobs: - name: Unit Tests run: go test -cover ./... + - name: Install gosec + run: go install github.com/securego/gosec/v2/cmd/gosec@latest + style: name: Style runs-on: ubuntu-latest From 24cf94ab31856ecee506b0759aea4b2de89978fc Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 22:06:47 +0200 Subject: [PATCH 23/32] Add security test step to CI pipeline --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4c0d068b36..0faf482568f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,11 @@ jobs: - name: Install gosec run: go install github.com/securego/gosec/v2/cmd/gosec@latest + - name: Security Test + run: test -z $(gosec ./...) + + + style: name: Style runs-on: ubuntu-latest From dcb2f6b1efa63226c10cf1e6d7141561a03d35d3 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 22:12:49 +0200 Subject: [PATCH 24/32] Improve server response handling and logging - Add error handling for JSON response writes - Set ReadHeaderTimeout to mitigate Slowloris attacks - Sanitize port string in log output to prevent log injection --- json.go | 4 ++++ main.go | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/json.go b/json.go index 1e6e7985e18..fabcd645592 100644 --- a/json.go +++ b/json.go @@ -30,5 +30,9 @@ func respondWithJSON(w http.ResponseWriter, code int, payload interface{}) { return } w.WriteHeader(code) + _, err := w.Write(dat) + if err != nil { + log.Printf("Failed to write response: %v", err) + } w.Write(dat) } diff --git a/main.go b/main.go index 19d7366c5f7..6c9495bc709 100644 --- a/main.go +++ b/main.go @@ -91,8 +91,11 @@ func main() { srv := &http.Server{ Addr: ":" + port, Handler: router, + ReadHeaderTimeout: 5 * time.Second, } - log.Printf("Serving on port: %s\n", port) + cleanPort := strings.ReplaceAll(strings.ReplaceAll(port, "\n", ""), "\r", "") + + log.Printf("Serving on port: %s\n", cleanPort) log.Fatal(srv.ListenAndServe()) } From e398ffe0a7ff34570ea71230dfee59a211e8f272 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 22:15:47 +0200 Subject: [PATCH 25/32] Fix JSON response double write and add server timeout --- json.go | 3 +-- main.go | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/json.go b/json.go index fabcd645592..c4cb71a3295 100644 --- a/json.go +++ b/json.go @@ -30,9 +30,8 @@ func respondWithJSON(w http.ResponseWriter, code int, payload interface{}) { return } w.WriteHeader(code) - _, err := w.Write(dat) + _, err = w.Write(dat) if err != nil { log.Printf("Failed to write response: %v", err) } - w.Write(dat) } diff --git a/main.go b/main.go index 6c9495bc709..ff22804fe0b 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,8 @@ import ( "log" "net/http" "os" + "strings" + "time" "github.com/go-chi/chi" "github.com/go-chi/cors" @@ -89,8 +91,8 @@ func main() { router.Mount("/v1", v1Router) srv := &http.Server{ - Addr: ":" + port, - Handler: router, + Addr: ":" + port, + Handler: router, ReadHeaderTimeout: 5 * time.Second, } From 6dd9c60ff9e1c9c917272a0afbdcdf973df96688 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 22:19:01 +0200 Subject: [PATCH 26/32] Update gosec command in CI workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0faf482568f..fb0cfd5aa72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: run: go install github.com/securego/gosec/v2/cmd/gosec@latest - name: Security Test - run: test -z $(gosec ./...) + run: gosec ./... From b96f37f8ebbb42050ccaef9577367bc12cdeee2b Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 22:57:09 +0200 Subject: [PATCH 27/32] Create cd.yml --- .github/workflows/cd.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000000..af31883066f --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,22 @@ +name: cd + +on: + push: + branches: [main] + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: Unit Tests + run: ./scripts/buildprod.sh From 2fcbe8baaed540bec024c815d57e958a43a6b968 Mon Sep 17 00:00:00 2001 From: gerrit Date: Sun, 26 Jul 2026 23:00:17 +0200 Subject: [PATCH 28/32] Update CD workflow step name to Deploy --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index af31883066f..35371da9677 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -18,5 +18,5 @@ jobs: with: go-version: "1.26.0" - - name: Unit Tests + - name: Deploy run: ./scripts/buildprod.sh From c3686eb9d65ed41de9a6a11b2199fe0f5dd9ddb0 Mon Sep 17 00:00:00 2001 From: gerrit Date: Tue, 28 Jul 2026 23:23:05 +0200 Subject: [PATCH 29/32] Configure GCP authentication and image build in CD pipeline Exclude google-cloud-sdk from version control and deployment uploads. --- .gcloudignore | 1 + .github/workflows/cd.yml | 14 ++++++++++++++ .gitignore | 2 ++ 3 files changed, 17 insertions(+) diff --git a/.gcloudignore b/.gcloudignore index 2c51591c28a..e4d7088be06 100644 --- a/.gcloudignore +++ b/.gcloudignore @@ -1 +1,2 @@ !notely +google-cloud-sdk diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 35371da9677..e9c28281577 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -20,3 +20,17 @@ jobs: - name: Deploy run: ./scripts/buildprod.sh + + - id: 'auth' + uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ secrets.GCP_CREDENTIALS }}' + + - name: 'Set up Cloud SDK' + uses: 'google-github-actions/setup-gcloud@v3' + + - name: 'Use gcloud CLI' + run: 'gcloud info' + + - name: 'Build Docker Image' + run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-503820/notely-ar-repo/notely:latest diff --git a/.gitignore b/.gitignore index 2092f54e78a..3292fe4a6f2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ out .env learn-cicd-starter notely +google-cloud-sdk +notely-503820-0b56b0c8c032.json From 860561df3e2eeaf307af49119906592090fd9e32 Mon Sep 17 00:00:00 2001 From: gerrit Date: Wed, 29 Jul 2026 00:02:51 +0200 Subject: [PATCH 30/32] Add Cloud Run deployment step to CD workflow --- .github/workflows/cd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e9c28281577..2f2ae783762 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -34,3 +34,6 @@ jobs: - name: 'Build Docker Image' run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-503820/notely-ar-repo/notely:latest + + - name: Deploy to Cloud Run + run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-503820/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely-503820 --max-instances=4 From 9be59574e36ef5e22acc98996ff07ea0a443d4f1 Mon Sep 17 00:00:00 2001 From: gerrit Date: Wed, 29 Jul 2026 00:03:59 +0200 Subject: [PATCH 31/32] Update landing page heading --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index 72be101028c..5d4ad73c095 100644 --- a/static/index.html +++ b/static/index.html @@ -7,7 +7,7 @@ -

Notely

+

Welcome to Notely

From 54277e1e2780d02988c3825a7e6a1e89faafbc31 Mon Sep 17 00:00:00 2001 From: gerrit Date: Wed, 29 Jul 2026 00:34:31 +0200 Subject: [PATCH 32/32] Add database migration step to CD pipeline --- .github/workflows/cd.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 2f2ae783762..b73f5f055a9 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -9,6 +9,9 @@ jobs: name: Deploy runs-on: ubuntu-latest + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} + steps: - name: Check out code uses: actions/checkout@v6 @@ -18,6 +21,9 @@ jobs: with: go-version: "1.26.0" + - name: Install Goose + run: go install github.com/pressly/goose/v3/cmd/goose@latest + - name: Deploy run: ./scripts/buildprod.sh @@ -35,5 +41,8 @@ jobs: - name: 'Build Docker Image' run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-503820/notely-ar-repo/notely:latest + - name: Migrate + run: ./scripts/migrateup.sh + - name: Deploy to Cloud Run run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-503820/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely-503820 --max-instances=4