This commit is contained in:
@@ -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,7 +28,9 @@ 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: .
|
||||||
@@ -30,3 +38,24 @@ jobs:
|
|||||||
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
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user