Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f22ab0e
feat: implement lab01 devops info service
sayfetik Jan 25, 2026
8d4ed3a
feat: implement lab01 bonus task devops info service
sayfetik Jan 25, 2026
857b965
Done Lab 2
sayfetik Jan 30, 2026
e196b4a
Merge pull request #1 from sayfetik/lab01
sayfetik Jan 30, 2026
0b16c77
Merge pull request #2 from sayfetik/lab02
sayfetik Jan 30, 2026
dc4d293
Check the workflow
sayfetik Feb 6, 2026
b4c72e7
Fix the workflow
sayfetik Feb 6, 2026
966948a
Fix the workflow
sayfetik Feb 6, 2026
325a35b
Fix the workflow
sayfetik Feb 6, 2026
28760c1
Fix the workflow
sayfetik Feb 6, 2026
8761f91
Fix the workflow
sayfetik Feb 6, 2026
6a1d089
Fix the workflow
sayfetik Feb 6, 2026
d364b62
Fix the workflow
sayfetik Feb 6, 2026
bb78712
Fix the workflow
sayfetik Feb 6, 2026
20608b9
Fix the workflow
sayfetik Feb 6, 2026
5e5de85
Fix the workflow
sayfetik Feb 6, 2026
b2faddb
Fix the workflow
sayfetik Feb 6, 2026
dca8a80
Fix the workflow
sayfetik Feb 6, 2026
d2ca94d
Fix the workflow final
sayfetik Feb 6, 2026
5b8270f
Fix the workflow final
sayfetik Feb 6, 2026
0ac1fdd
Fix the workflow final
sayfetik Feb 6, 2026
f7ab81a
Fix the workflow
sayfetik Feb 6, 2026
359c9af
Fix the workflow
sayfetik Feb 6, 2026
9d33b81
Fix the workflow
sayfetik Feb 6, 2026
b74e8be
Update README.md
sayfetik Feb 6, 2026
e172f38
Done lab 3
sayfetik Feb 6, 2026
62936ca
Done Bonus Task
sayfetik Feb 6, 2026
fc248ec
Done Bonus Task
sayfetik Feb 6, 2026
d2fed26
Fix go workflow
sayfetik Feb 6, 2026
e491698
Fix go workflow
sayfetik Feb 6, 2026
c238503
Done Bonus Lab 3
sayfetik Feb 6, 2026
3b860c0
Done lab 4
sayfetik Feb 13, 2026
0118763
Fix lab 4
sayfetik Feb 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Go CI

on:
push:
branches: [ "master", "lab03" ]
paths:
- "app_go/**"
- '.github/workflows/go-ci.yml'
pull_request:
paths:
- "app_go/**"
- '.github/workflows/go-ci.yml'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('app_go/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Run Go tests with coverage
run: |
cd app_go
go test ./... -coverprofile=coverage.out
go tool cover -func=coverage.out | tee coverage.txt
TOTAL=$(go tool cover -func=coverage.out | grep total: | awk '{print substr($3, 1, length($3)-1)}')
echo "Total coverage: $TOTAL%"
if (( $(echo "$TOTAL < 70" | bc -l) )); then
echo "Coverage below 70%"
exit 1
fi

- name: Convert Go coverage to Cobertura
run: |
go install github.com/boumenot/gocover-cobertura@latest
cd app_go
gocover-cobertura < coverage.out > coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
format: cobertura
file: app_go/coverage.xml
flag-name: go
parallel: true

- name: Finalize Coveralls
uses: coverallsapp/github-action@v2
with:
parallel-finished: true


security:
runs-on: ubuntu-latest
needs: test

steps:
- name: Checkout repository
uses: actions/checkout@v4

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

- name: Run Snyk security scan
uses: snyk/actions/setup@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: test
args: --file=app_go/go.mod



docker:
needs: test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./app_go
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/info-service-go:latest
118 changes: 118 additions & 0 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Python CI

on:
push:
branches: [ "master", "lab03" ]
paths:
- "app_python/**"
- '.github/workflows/python-ci.yml'
pull_request:
paths:
- "app_python/**"
- '.github/workflows/python-ci.yml'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "^3.13"

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('app_python/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
pip install -r app_python/requirements.txt
pip install -r app_python/requirements-dev.txt

- name: Run tests with coverage
run: |
cd app_python
coverage run -m pytest
coverage report --fail-under=70
coverage xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
format: cobertura
file: app_python/coverage.xml
flag-name: python
parallel: true

security:
runs-on: ubuntu-latest
needs: test

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "^3.13"

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-security-${{ hashFiles('app_python/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-security-

- name: Install dependencies
run: |
pip install -r app_python/requirements.txt
pip install -r app_python/requirements-dev.txt

- name: Run Snyk scan for main dependencies
uses: snyk/actions/setup@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: test
args: --file=app_python/requirements.txt

- name: Run Snyk scan for dev dependencies
uses: snyk/actions/setup@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: test
args: --file=app_python/requirements-dev.txt

docker:
needs: test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./app_python
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/info-service-python:latest
47 changes: 47 additions & 0 deletions .github/workflows/terraform-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Terraform CI

on:
push:
branches: [ "master", "lab04" ]
paths:
- "terraform/**"
pull_request:
paths:
- 'terraform/**'
- '.github/workflows/terraform-ci.yml'

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: '1.14.5'

- name: Terraform fmt check
run: |
terraform -version
cd terraform
terraform fmt -check

- name: Terraform init
run: |
cd terraform
terraform init -input=false

- name: Terraform validate
run: |
cd terraform
terraform validate

- name: Setup TFLint
uses: terraform-linters/setup-tflint@v3

- name: Run TFLint
run: |
cd terraform
tflint --init
tflint --format compact
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
# Root gitignore for lab

# Terraform
terraform/*.tfstate
terraform/*.tfstate.*
terraform/.terraform/
terraform/terraform.tfvars

# Pulumi
pulumi/venv/
pulumi/Pulumi.*.yaml

# Keys and credentials
*.pem
*.key
*.json

# Python
__pycache__/
*.pyc
test
12 changes: 12 additions & 0 deletions app_go/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
devops-info-service
*.log
*.tmp
*.out
*.test
*.swp
*.swo
.idea/
.vscode/
docs/
README.md
*.md
9 changes: 9 additions & 0 deletions app_go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
__pycache__/
*.py[cod]
venv/
*.log
.DS_Store
.vscode/
.idea/
.pytest_cache
coverage.out
16 changes: 16 additions & 0 deletions app_go/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Multi-stage build for Go application
# Stage 1: Builder
FROM golang:1.22-alpine AS builder
WORKDIR /build
COPY go.mod .
RUN go mod download
COPY main.go .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o devops-info-service .

# Stage 2: Runtime
FROM gcr.io/distroless/static:nonroot
WORKDIR /app
COPY --from=builder /build/devops-info-service .
EXPOSE 8080
USER nonroot
ENTRYPOINT ["/app/devops-info-service"]
39 changes: 39 additions & 0 deletions app_go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# DevOps Info Service — Go Version

![CI/CD](https://github.com/sayfetik/DevOps-Core-Course/actions/workflows/python-ci.yml/badge.svg)

[![Coverage](https://codecov.io/gh/sayfetik/DevOps-Core-Course/branch/lab03/graph/badge.svg)](https://codecov.io/gh/sayfetik/DevOps-Core-Course)

## Overview

This is a compiled Go implementation of the DevOps Info Service. It provides the same functionality as the Python version but is delivered as a single statically compiled binary.

## Requirements

- Go 1.22 or higher

## Build and Run

Initialize the module (once):

```bash
go mod init devops-info-service
```

## Run

```bash
./devops-info-service
```

Or with custom configuration:

```bash
PORT=9090 ./devops-info-service
```

## API Endpoints

GET / — service and system information

GET /health — health check endpoint
Binary file added app_go/devops-info-service
Binary file not shown.
12 changes: 12 additions & 0 deletions app_go/docs/GO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Why Go

Go was selected for the compiled language implementation because it is widely used in DevOps and cloud-native environments.

## Advantages

- Compiles into a single static binary
- Very fast startup time
- Low memory usage
- Excellent support for containers and Kubernetes

Go binaries are ideal for multi-stage Docker builds where the final image contains only the compiled binary.
Loading