CD eklentisi.
Some checks failed
Harita Build ve Deploy / build-and-deploy (push) Failing after 5s

This commit is contained in:
gitmuhammedalbayrak
2025-11-20 12:37:50 +03:00
parent c7e673d86a
commit 7a5b2737b3
2 changed files with 38 additions and 5 deletions

View File

@@ -1,17 +1,23 @@
name: Harita Build ve Deploy name: Harita Build ve Deploy
run-name: ${{ gitea.actor }} Harita Yayınlanıyor 🟢 run-name: ${{ gitea.actor }} Harita Build ve Deploy 🚀
on: [push] on: [push]
jobs: jobs:
build-and-deploy: build-and-deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# DOCKER_HOST tanımı KALDIRILDI! # KUBERNETES ÜZERİNDEKİ DOCKER BAĞLANTISI İÇİN GEREKLİ ORTAM DEĞİŞKENLERİ
env:
DOCKER_HOST: unix:///var/run/dind-socket-dir/docker.sock
DOCKER_TLS_CERTDIR: ""
steps: steps:
- name: Kodu Çek (Checkout) - name: Kodu Çek (Checkout)
uses: actions/checkout@v3 uses: actions/checkout@v3
# Sadece Docker'ı başlatmak kalıyor # -----------------------------------------------------------------
# CI KISMI
# -----------------------------------------------------------------
- name: Docker Buildx Kurulumu - name: Docker Buildx Kurulumu
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
@@ -22,11 +28,34 @@ jobs:
username: gitea_admin username: gitea_admin
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
# PUSH ADIMI: Yeni imajın kimliğini (digest) çıktı olarak alıyoruz
- name: Docker Build ve Push - name: Docker Build ve Push
id: docker_build # <-- Çıktı almak için bu ID gerekli
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
context: . context: .
push: true push: true
tags: git.konstantiniyye.studio/gitea_admin/dogu:latest tags: git.konstantiniyye.studio/gitea_admin/dogu:latest
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
# -----------------------------------------------------------------
# CD KISMI (Continuous Deployment)
# -----------------------------------------------------------------
- name: Kubernetes'e Deploy Et
uses: appleboy/kubectl-action@master # Popüler kubectl action'ı
with:
# Gitea'da tanımlanan Kubeconfig Secret'ı kullanır
kubeconfig_content: ${{ secrets.KUBE_CONFIG }}
# Tek bir shell komutunda imajı güncelleyip Deployment'ı yeniden başlatır
script: |
# Yeni imajın Digest'i (sha256:...) otomatik olarak alınır
NEW_IMAGE_DIGEST="git.konstantiniyye.studio/gitea_admin/dogu@${{ steps.docker_build.outputs.digest }}"
echo "Yeni imaj: $NEW_IMAGE_DIGEST"
# 1. Deployment'taki imajı yeni Digest ile günceller
kubectl set image deployment/dogu-haritasi web=${NEW_IMAGE_DIGEST} -n default
# 2. Güncellemenin hemen başlaması için Deployment'ı yeniden başlatır
kubectl rollout restart deployment/dogu-haritasi -n default

View File

@@ -13,9 +13,12 @@ spec:
labels: labels:
app: dogu-haritasi app: dogu-haritasi
spec: spec:
# KUBERNETES BURADAN İZİN BELGELERİNİ ALIR
imagePullSecrets:
- name: gitea-reg-cred
containers: containers:
- name: web - name: web
# Kendi kullanıcı adınla güncelle # İmajınız
image: git.konstantiniyye.studio/gitea_admin/dogu:latest image: git.konstantiniyye.studio/gitea_admin/dogu:latest
imagePullPolicy: Always imagePullPolicy: Always
ports: ports:
@@ -27,6 +30,7 @@ metadata:
name: dogu-haritasi-service name: dogu-haritasi-service
namespace: default namespace: default
spec: spec:
# Service objesine secrets eklenmez, sadece Pod'u seçer
selector: selector:
app: dogu-haritasi app: dogu-haritasi
type: ClusterIP type: ClusterIP