fix: downgrade artifacts to v3 and fix kubectl
This commit is contained in:
@@ -6,16 +6,15 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: git.fpmoz.sum.ba
|
REGISTRY: git.fpmoz.sum.ba
|
||||||
# Koristimo tvoju putanju sz11zs/hello-cicd
|
|
||||||
IMAGE: git.fpmoz.sum.ba/${{ github.repository }}
|
IMAGE: git.fpmoz.sum.ba/${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ── JOB 1: Izgradnja i spremanje Docker image-a ─────────
|
# ── JOB 1: Build ──────────────────────────────────────
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout koda
|
- name: Checkout koda
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3 # Vraćeno na v3
|
||||||
|
|
||||||
- name: Login u Gitea registry
|
- name: Login u Gitea registry
|
||||||
run: |
|
run: |
|
||||||
@@ -32,21 +31,21 @@ jobs:
|
|||||||
echo $TAG > tag.txt
|
echo $TAG > tag.txt
|
||||||
|
|
||||||
- name: Spremi image tag
|
- name: Spremi image tag
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v3 # OVO JE BITNO: v3 umjesto v4
|
||||||
with:
|
with:
|
||||||
name: image-tag
|
name: image-tag
|
||||||
path: tag.txt
|
path: tag.txt
|
||||||
|
|
||||||
# ── JOB 2: Slanje aplikacije na k3s klaster ─────────────
|
# ── JOB 2: Deploy ─────────────────────────────────────
|
||||||
deploy:
|
deploy:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout koda
|
- name: Checkout koda
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3 # Vraćeno na v3
|
||||||
|
|
||||||
- name: Preuzmi image tag
|
- name: Preuzmi image tag
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v3 # OVO JE BITNO: v3 umjesto v4
|
||||||
with:
|
with:
|
||||||
name: image-tag
|
name: image-tag
|
||||||
|
|
||||||
@@ -58,21 +57,19 @@ jobs:
|
|||||||
- name: Postavi kubeconfig
|
- name: Postavi kubeconfig
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.kube
|
mkdir -p ~/.kube
|
||||||
# Dekodiramo tvoj KUBE_CONFIG secret koji si zalijepila u postavkama
|
|
||||||
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > ~/.kube/config
|
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > ~/.kube/config
|
||||||
chmod 600 ~/.kube/config
|
chmod 600 ~/.kube/config
|
||||||
|
|
||||||
- name: Update image tag u manifestu
|
- name: Update image tag u manifestu
|
||||||
run: |
|
run: |
|
||||||
TAG=$(cat tag.txt)
|
TAG=$(cat tag.txt)
|
||||||
# Postavljamo točan tag u k8s/deployment.yaml
|
|
||||||
sed -i "s|image:.*|image: $IMAGE:$TAG|" k8s/deployment.yaml
|
sed -i "s|image:.*|image: $IMAGE:$TAG|" k8s/deployment.yaml
|
||||||
|
|
||||||
- name: Deploy na k3s
|
- name: Deploy na k3s
|
||||||
run: |
|
run: |
|
||||||
# DODATAK: --kubeconfig i --validate=false rješavaju "connection refused" grešku
|
# Koristimo eksplicitnu putanju i gasimo validaciju
|
||||||
kubectl --kubeconfig=$HOME/.kube/config apply -f k8s/ --validate=false
|
kubectl --kubeconfig=$HOME/.kube/config apply -f k8s/ --validate=false
|
||||||
|
|
||||||
# Provjera statusa za tvoj namespace: student-sz11zs
|
# Provjera statusa za tvoj namespace sz11zs
|
||||||
kubectl --kubeconfig=$HOME/.kube/config rollout status deployment/hello-cicd \
|
kubectl --kubeconfig=$HOME/.kube/config rollout status deployment/hello-cicd \
|
||||||
-n student-sz11zs --timeout=120s
|
-n student-sz11zs --timeout=120s
|
||||||
Reference in New Issue
Block a user