init: hello-cicd projectsetup
Some checks failed
CI/CD Pipeline popravak / build (push) Successful in 1m19s
CI/CD Pipeline popravak / deploy (push) Failing after 1m5s

This commit is contained in:
2026-05-03 09:50:32 +02:00
parent 6b201ad7b8
commit 9969093c91

23
main.py
View File

@@ -1,22 +1,17 @@
from fastapi import FastAPI
import os
import os, datetime
app = FastAPI()
_healthy = True
@app.get("/health")
def health():
if not _healthy:
return {"status": "unhealthy"}, 503
return {"status": "ok"}
@app.post("/break")
def break_health():
"""Simulira pad servisa za testiranje liveness probe-a"""
global _healthy
_healthy = False
return {"message": "Servis je sada nezdrav — ocekuj restart"}
return {
"status": "ok",
"version": os.getenv("APP_VERSION", "dev"),
"timestamp": datetime.datetime.utcnow().isoformat()
}
@app.get("/")
def read_root():
return {"poruka": "Hello iz mog Docker containera!"}
def root():
return {"poruka": "Zdravo s k3s!", "host": os.uname().nodename}