Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
fd3dcbe
.
dmitri-bibiluri Oct 13, 2025
4aed672
added yml file
dmitri-bibiluri Oct 14, 2025
e9c3126
deleted forced exit in yml file
dmitri-bibiluri Oct 14, 2025
a278e34
fixed the assignment with yml
dmitri-bibiluri Oct 14, 2025
b6b500d
CH2 - Tests/L1 Running Tests
dmitri-bibiluri Oct 15, 2025
64cc0fb
broken code
dmitri-bibiluri Oct 15, 2025
24389e1
put the broken code back together
dmitri-bibiluri Oct 15, 2025
98304e6
added coverage
dmitri-bibiluri Oct 15, 2025
dd2f6f4
added testing badge to readme.md file
dmitri-bibiluri Oct 15, 2025
ee13ba2
added style formating tests to ci.yml file
dmitri-bibiluri Oct 15, 2025
585afea
fixed job name capitalization issue
dmitri-bibiluri Oct 15, 2025
0e8c59a
staticcheck with wrong function
dmitri-bibiluri Oct 15, 2025
2f5828f
staticcheck with correct main.go
dmitri-bibiluri Oct 15, 2025
bd0da37
adding gosec
dmitri-bibiluri Oct 15, 2025
e7dd4b5
failed gosec
dmitri-bibiluri Oct 15, 2025
30651e8
added main.go back
dmitri-bibiluri Oct 15, 2025
523c74d
fixed gosec issues
dmitri-bibiluri Oct 15, 2025
a326420
did go fmt
dmitri-bibiluri Oct 15, 2025
b4653ae
first attempt on writing cd.yml file
dmitri-bibiluri Oct 16, 2025
31b2a81
fixed staticcheck by installing it first
dmitri-bibiluri Oct 16, 2025
356f1e6
second fix of cd
dmitri-bibiluri Oct 16, 2025
f9331dc
third cd fix
dmitri-bibiluri Oct 16, 2025
20908e6
added automated build and push of docker images to google artifact re…
dmitri-bibiluri Oct 17, 2025
f02382d
first attempt of fixing the automized docker image upload to gcloud
dmitri-bibiluri Oct 17, 2025
2950f0e
third attempt to fix the issues
dmitri-bibiluri Oct 17, 2025
db20981
4th try
dmitri-bibiluri Oct 17, 2025
1271008
5th try
dmitri-bibiluri Oct 17, 2025
f152f1c
5th try
dmitri-bibiluri Oct 17, 2025
a305c2e
7th try
dmitri-bibiluri Oct 17, 2025
dc8cdbe
new commit, created a pool
dmitri-bibiluri Oct 19, 2025
f288591
new commit, created a pool
dmitri-bibiluri Oct 19, 2025
154a4ca
new gcloud cd code
dmitri-bibiluri Oct 19, 2025
c05669c
new gcloud cd code/2 try - wrong project number
dmitri-bibiluri Oct 19, 2025
cde15e0
new gcloud cd code/3 try - wrong project number
dmitri-bibiluri Oct 19, 2025
edd99ac
cd code overhall
dmitri-bibiluri Oct 19, 2025
84709e5
3rd try cd code overhall
dmitri-bibiluri Oct 19, 2025
dd7858b
4th try cd code overhall
dmitri-bibiluri Oct 19, 2025
f14e9cb
5th attempt
dmitri-bibiluri Oct 19, 2025
4a0bf6c
5th attempt - changed dockerfile
dmitri-bibiluri Oct 19, 2025
18462a9
6th attempt - changed dockerfile and simplified cd workflows
dmitri-bibiluri Oct 19, 2025
5e5447e
6th attempt - changed dockerfile and simplified cd workflows
dmitri-bibiluri Oct 19, 2025
5569441
fiex go version in dockerfile
dmitri-bibiluri Oct 19, 2025
c78fc92
wrong job name
dmitri-bibiluri Oct 19, 2025
9002629
wrong job name 2nd try
dmitri-bibiluri Oct 19, 2025
e716204
changed my cd file
dmitri-bibiluri Oct 20, 2025
6b521a1
changed index.html
dmitri-bibiluri Oct 20, 2025
954b889
changed cd file
dmitri-bibiluri Oct 20, 2025
7ebd94c
fixed cicd file
dmitri-bibiluri Oct 20, 2025
292d1b2
first attempt in a week
dmitri-bibiluri Oct 29, 2025
466b9c1
secont iteration
dmitri-bibiluri Oct 29, 2025
4c32f7c
third iteration deleted a dot at the end
dmitri-bibiluri Oct 29, 2025
2908102
4th iteration changed CD file
dmitri-bibiluri Oct 29, 2025
b1713a8
5th iteration changed CD file
dmitri-bibiluri Oct 29, 2025
4a97178
new assignment
dmitri-bibiluri Oct 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Binary file added .DS_Store
Binary file not shown.
Binary file added .github/.DS_Store
Binary file not shown.
67 changes: 67 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: cd

on:
push:
branches: [main]

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest

env:
PROJECT_ID: notely-475312
REGION: us-central1
REPO: cloud-run-source-deploy
SERVICE: notely
IMAGE: us-central1-docker.pkg.dev/notely-475312/cloud-run-source-deploy/notely:${{ github.sha }}
# IMPORTANT: create a GitHub Actions secret named DATABASE_URL that contains your full libsql URL (no quotes)
DATABASE_URL: ${{ secrets.DATABASE_URL }}

steps:
- name: Check out code
uses: actions/checkout@v4

# Install Go so we can install goose for migrations
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22.x"

- name: Install goose
run: go install github.com/pressly/goose/v3/cmd/goose@latest

- 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@v2

- name: Ensure Artifact Registry repo
run: |
gcloud artifacts repositories create "$REPO" \
--repository-format=docker --location="$REGION" || true

- name: Build and push image
run: gcloud builds submit --tag "$IMAGE"

# Run DB migrations AFTER build, BEFORE deploy
- name: Migrate database
run: ./scripts/migrateup.sh
env:
# (Optional redundancy) Ensure the script sees it even if job-level env changes later
DATABASE_URL: ${{ secrets.DATABASE_URL }}

- name: List pushed images (debug)
run: gcloud artifacts docker images list "$REGION-docker.pkg.dev/$PROJECT_ID/$REPO" --include-tags

- name: Deploy to Cloud Run
run: |
gcloud run deploy "$SERVICE" \
--image "$IMAGE" \
--region "$REGION" \
--allow-unauthenticated \
--project "$PROJECT_ID" \
--max-instances=3
51 changes: 51 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: ci

on:
pull_request:
branches: [main]

jobs:
tests:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.1"

- name: Test the code
run: go test ./... -cover

- name: API tests
run:

- name: Install gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest

- name: Run gosec
run: gosec ./...

style:
name: Style
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.25.1"
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest

- name: style
run: test -z $(go fmt ./...)

- name: staticcheck
run: staticcheck ./...
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
FROM --platform=linux/amd64 debian:stable-slim
# Stage 1: Build the Go binary
FROM golang:1.22-bookworm AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -v -o /app/notely .

RUN apt-get update && apt-get install -y ca-certificates

ADD notely /usr/bin/notely

CMD ["notely"]
# Stage 2: Create the final, lightweight image
FROM gcr.io/distroless/static-debian11
WORKDIR /app
COPY --from=builder /app/notely .
EXPOSE 8080
CMD ["./notely"]
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![alt text goes here](https://github.com/dmitri-bibiluri/<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).
Expand All @@ -18,6 +20,8 @@ Run the server:
go build -o notely && ./notely
```

*This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`.
_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!

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!
Dmitrii's version of Boot.dev's Notely app.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230512164433-5d1fd1a340c9 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/libsql/sqlite-antlr4-parser v0.0.0-20230802215326-5cb5bb604475 // indirect
github.com/stretchr/testify v1.11.1 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
nhooyr.io/websocket v1.8.7 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/tursodatabase/libsql-client-go v0.0.0-20240220085343-4ae0eb9d0898 h1:1MvEhzI5pvP27e9Dzz861mxk9WzXZLSJwzOU67cKTbU=
github.com/tursodatabase/libsql-client-go v0.0.0-20240220085343-4ae0eb9d0898/go.mod h1:9bKuHS7eZh/0mJndbUOrCx8Ej3PlsRDszj4L7oVYMPQ=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
Expand Down
Binary file added google-cloud-sdk/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions google-cloud-sdk/.install/bq-nix.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/bq
44 changes: 44 additions & 0 deletions google-cloud-sdk/.install/bq-nix.snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"components": [
{
"data": {
"contents_checksum": "0a2bf62530849e8882a1cf4c7699078f44e1ca965c2dd9d90d18d3452d1d8d1b",
"source": "",
"type": "tar"
},
"dependencies": [
"bq",
"core"
],
"details": {
"description": "Provides the bq tool for interacting with the BigQuery service.",
"display_name": "BigQuery Command Line Tool (Platform Specific)"
},
"gdu_only": false,
"id": "bq-nix",
"is_configuration": false,
"is_hidden": true,
"is_required": false,
"platform": {
"operating_systems": [
"CYGWIN",
"LINUX",
"MACOSX",
"MSYS"
]
},
"platform_required": false,
"version": {
"build_number": 20251010143653,
"version_string": "2.1.24"
}
}
],
"revision": 20251010143653,
"schema_version": {
"no_update": false,
"url": "https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.tar.gz",
"version": 3
},
"version": "543.0.0"
}
Loading